query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
Get IPFIX Switch Collection Instance API will return details of IPFIX switch collection. If instance does not exist, it will return 404. This API is deprecated. Please use the following API:
def read_ipfix_switch_collection_instance(tier_1_id, ipfix_switch_collection_instance_id, opts = {}) data, _status_code, _headers = read_ipfix_switch_collection_instance_with_http_info(tier_1_id, ipfix_switch_collection_instance_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_ipfix_switch_collection_instance_0(tier_1_id, ipfix_switch_collection_instance_id, opts = {})\n data, _status_code, _headers = read_ipfix_switch_collection_instance_0_with_http_info(tier_1_id, ipfix_switch_collection_instance_id, opts)\n data\n end", "def list_ipfix_switch_collection_instan...
[ "0.6578789", "0.6093791", "0.5888092", "0.5843407", "0.5773496", "0.57648486", "0.56815374", "0.55512065", "0.55299085", "0.5439885", "0.5255996", "0.52203256", "0.519903", "0.5185896", "0.51524246", "0.5070957", "0.49886152", "0.4973737", "0.48870564", "0.48727778", "0.48551...
0.6773679
0
Get IPFIX Switch Collection Instance API will return details of IPFIX switch collection. If instance does not exist, it will return 404. This API is deprecated. Please use the following API:
def read_ipfix_switch_collection_instance_0(tier_1_id, ipfix_switch_collection_instance_id, opts = {}) data, _status_code, _headers = read_ipfix_switch_collection_instance_0_with_http_info(tier_1_id, ipfix_switch_collection_instance_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_ipfix_switch_collection_instance(tier_1_id, ipfix_switch_collection_instance_id, opts = {})\n data, _status_code, _headers = read_ipfix_switch_collection_instance_with_http_info(tier_1_id, ipfix_switch_collection_instance_id, opts)\n data\n end", "def list_ipfix_switch_collection_instances(...
[ "0.67731196", "0.6092825", "0.5888023", "0.58433115", "0.57736087", "0.5764898", "0.5681913", "0.55514646", "0.55298996", "0.5439963", "0.5258395", "0.52203876", "0.51994544", "0.5186086", "0.5153071", "0.5067561", "0.49890447", "0.49743792", "0.48864806", "0.48708442", "0.48...
0.65785813
1
PATCH/PUT /class_groups/1 PATCH/PUT /class_groups/1.json
def update respond_to do |format| if @class_group.update(class_group_params) format.html { redirect_to @class_group, notice: 'Class group was successfully updated.' } format.json { render :show, status: :ok, location: @class_group } else format.html { render :edit } forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n logger.info \"Put parameters: #{params.to_json}\"\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end", "def UpdateGroup params = {}\n \n ...
[ "0.684557", "0.68406147", "0.6784806", "0.6770377", "0.6685045", "0.6577373", "0.65245724", "0.65189916", "0.65141785", "0.6495233", "0.6485215", "0.6469512", "0.64679813", "0.64679813", "0.6456753", "0.6456753", "0.6456753", "0.64433736", "0.64266884", "0.64126277", "0.63861...
0.74156
0
POST /outdoors POST /outdoors.json
def create @outdoor = Outdoor.new(params[:outdoor]) respond_to do |format| if @outdoor.save format.html { redirect_to @outdoor, notice: 'Outdoor was successfully created.' } format.json { render json: @outdoor, status: :created, location: @outdoor } else format.html { render...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @outdoor = Outdoor.new(params[:outdoor])\n\n respond_to do |format|\n if @outdoor.save\n format.html { redirect_to(@outdoor, :notice => 'Outdoor was successfully created.') }\n format.xml { render :xml => @outdoor, :status => :created, :location => @outdoor }\n else\n ...
[ "0.5792218", "0.56099564", "0.5601321", "0.55729955", "0.55695367", "0.549897", "0.5481633", "0.5440665", "0.537941", "0.52746004", "0.5247932", "0.52155155", "0.5211143", "0.52040786", "0.51951146", "0.51838905", "0.51728445", "0.515931", "0.51167655", "0.50826406", "0.50771...
0.63239694
0
PUT /outdoors/1 PUT /outdoors/1.json
def update @outdoor = Outdoor.find(params[:id]) respond_to do |format| if @outdoor.update_attributes(params[:outdoor]) format.html { redirect_to @outdoor, notice: 'Outdoor was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @outdoor = Outdoor.find(params[:id])\n\n respond_to do |format|\n if @outdoor.update_attributes(params[:outdoor])\n format.html { redirect_to(@outdoor, :notice => 'Outdoor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :actio...
[ "0.60762066", "0.5987233", "0.5893973", "0.58219206", "0.58091325", "0.577871", "0.57539845", "0.56301284", "0.561885", "0.56066644", "0.5590928", "0.55858153", "0.5576367", "0.5521336", "0.5496735", "0.54871583", "0.54798573", "0.5472508", "0.5466329", "0.5458767", "0.545127...
0.6376477
0
DELETE /outdoors/1 DELETE /outdoors/1.json
def destroy @outdoor = Outdoor.find(params[:id]) @outdoor.destroy respond_to do |format| format.html { redirect_to outdoors_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @outdoor = Outdoor.find(params[:id])\n @outdoor.destroy\n\n respond_to do |format|\n format.html { redirect_to(outdoors_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @indoor = Indoor.find(params[:id])\n @indoor.destroy\n\n respond_to do |format|\n ...
[ "0.7076454", "0.6938417", "0.69238096", "0.68711317", "0.6818427", "0.67873627", "0.6776209", "0.6770524", "0.67526793", "0.6714425", "0.6706894", "0.67002445", "0.66931385", "0.66808945", "0.6652992", "0.6644892", "0.66371685", "0.66258866", "0.6606571", "0.6603665", "0.6601...
0.74166465
0
Excel doesn't record types for some cells, only its display style, so we have to back out the type from that style. Some of these styles can be determined from a known set (see NumFmtMap), while others are 'custom' and we have to make a best guess. This is the array of types corresponding to the styles a spreadsheet us...
def style_types @xml.xpath('/styleSheet/cellXfs/xf').map do |xstyle| style_type_by_num_fmt_id( xstyle.attributes['numFmtId']&.value ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def style_types\n %w( primary success info )\n end", "def style_type_by_num_fmt_id(id)\n return nil if id.nil?\n\n id = id.to_i\n NumFmtMap[id] || custom_style_types[id]\n end", "def list12tablestyleclientinfo(io)\n attrs = io.read(2).unpack('v').first\n attrs = Unxls::B...
[ "0.6358321", "0.6204794", "0.6000062", "0.599601", "0.575174", "0.555051", "0.5450153", "0.54463166", "0.53738153", "0.53373134", "0.53280807", "0.5281042", "0.5279421", "0.5257019", "0.5230523", "0.51949245", "0.5192969", "0.5169068", "0.51677245", "0.5163618", "0.5142233", ...
0.8589393
0
Finds the type we think a style is; For example, fmtId 14 is a date style, so this would return :date. Note, custom styles usually (are supposed to?) have a numFmtId >= 164, but in practice can sometimes be simply out of the usual "Any Language" id range that goes up to 49. For example, I have seen a numFmtId of 59 spe...
def style_type_by_num_fmt_id(id) return nil if id.nil? id = id.to_i NumFmtMap[id] || custom_style_types[id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_custom_style_type(string)\n return :float if string[0] == '_'\n return :float if string[0] == ' 0'\n\n # Looks for one of ymdhis outside of meta-stuff like [Red]\n return :date_time if string =~ /(^|\\])[^\\[]*[ymdhis]/i\n\n :unsupported\n end", "def style_ty...
[ "0.68311834", "0.6655394", "0.59521365", "0.5901215", "0.58085287", "0.57354367", "0.5705079", "0.5692276", "0.56654924", "0.5598578", "0.5558651", "0.5511769", "0.55023265", "0.54248613", "0.5413547", "0.5408251", "0.5402986", "0.5387966", "0.5384442", "0.5378303", "0.536437...
0.7540799
0
each layout must belong to a company
def test_company @layouts.each do |x| assert_not_nil x.company end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_layout(layout); end", "def has_company?\n if self.group && self.group.company\n true\n else\n false\n end\n end", "def site_enable?\n self[:type] == \"CompanyZ\" && !self.layout.architecture_type.nil?\n end", "def company?\n directive.company?\n end", "def print_lay...
[ "0.5914794", "0.5903545", "0.5782603", "0.57811815", "0.57800007", "0.57253194", "0.56978637", "0.56978637", "0.5553281", "0.5545636", "0.55390406", "0.54598397", "0.54354024", "0.541388", "0.53952456", "0.53629696", "0.5357652", "0.53348434", "0.53223693", "0.5316738", "0.52...
0.6693026
0
each layout must have layoutid within the group, there must be no duplicate layoutids
def test_layoutid flunk mysql_bug if defined?(mysql_bug) @layouts.each do |x| assert_not_nil x.layoutid, "#{x} has no local layout number" end groupids = @layouts.map{|x| x.groupid}.uniq groupids.each do |gid| # find all group's layoutids pub = Web::Layout.find(:all, :con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_layout(layout); end", "def layout_tags\n unless @layout_tags\n @layout_tags = Array.new\n layout_config[\"groups\"].each do |group, gdata|\n gdata[\"all_tags\"].each do |tag, tdata|\n @layout_tags.push tag\n end\n end\n @layout_tags.uniq!\n @layout_...
[ "0.6553895", "0.6163501", "0.61123466", "0.5949073", "0.5949073", "0.5756663", "0.5739335", "0.5642731", "0.55620325", "0.5491902", "0.5482698", "0.54756033", "0.5464741", "0.54156214", "0.5395903", "0.537721", "0.5359057", "0.53355354", "0.5328063", "0.53258884", "0.5324702"...
0.8020033
0
each layout must have a friendlyurl
def test_friendlyurl @layouts.each do |x| assert !x.friendlyurl.nil?, "#{x} has no friendlyurl" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layout_by_resource\n if request.original_url.include? \"/wechat_service/\" \n 'wechat_service_application'\n else\n if devise_controller?\n 'devise'\n else\n 'application'\n # case action_name \n # when 'index' then 'list'\n # when 'show', 'new', 'edit', ...
[ "0.58849293", "0.58302176", "0.57642084", "0.57373935", "0.5674467", "0.56650096", "0.5640811", "0.56111205", "0.55971193", "0.55971193", "0.55421615", "0.55421615", "0.5538556", "0.5526922", "0.54906255", "0.54906255", "0.5479026", "0.5477962", "0.54673564", "0.54606193", "0...
0.71401465
0
each layout must have a typesettings, and the defined portlets exist
def test_portlets flunk mysql_bug if defined?(mysql_bug) @layouts.each do |layout| assert_not_nil layout.typesettings, "#{layout} has no typesettings" layout.portlets.each do |p| assert_equal layout, p.layout if p.is_a?(Web::PortletPreferences) assert_equal layout, p.lay...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layouts; end", "def layouts; end", "def layout(layout_type)\n\t\t#most content. that is loaded into the artist content area (just content)\n\t\tif layout_type.nil? || layout_type.blank?\n\t\t\t@layout = false\n\t\t\t@hook = \"#content\"\n\t\t#when artist page has to be loaded (logo, nave and content)\n\t\...
[ "0.63361883", "0.63361883", "0.6332877", "0.62919694", "0.61419624", "0.61419624", "0.6013425", "0.5982526", "0.59470975", "0.5927321", "0.5927032", "0.58803284", "0.58742356", "0.58616555", "0.5853098", "0.582143", "0.5799866", "0.5785846", "0.57831556", "0.57582235", "0.572...
0.7301485
0
Generic parsing function sof: function > takes the current input and combines it in some way with the items arravied at so far opupdate: function > modifies the function appropriately when an new item is parsed.
def parse_ginfix(opsym, opupdate, sof, subparser, inp) e1, inp1 = subparser.call(inp) if inp1 != [] && inp1[0] == opsym parse_ginfix(opsym, opupdate, opupdate.curry.call(sof, e1), subparser, inp1[1..-1]) else return sof.call(e1), inp1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_process (*args)\n if(args.size == 1)\n input = args[0]\n operation = input.initial\n elsif(args.size == 2)\n input = args[1]\n operation = input[0]\n else\n return\n end\n \n total = get_numbers(input, operation)\n\n if operation == \"+\"\n $totalvalue += addition(*total)\n elsi...
[ "0.5547628", "0.5524337", "0.532228", "0.528324", "0.51737493", "0.5170195", "0.5162636", "0.5138557", "0.5138557", "0.5114613", "0.51117796", "0.50910056", "0.5051846", "0.5020766", "0.5020766", "0.5020766", "0.49941134", "0.49708918", "0.49677956", "0.49606752", "0.4953373"...
0.57094556
0
Applies a function to the first element of a pair. The idea being to modify the returned abstract syntax tree while leaving the `unparsed input` alone
def papply(f, ast, rest) return f.call(ast), rest end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pair=(_arg0); end", "def mutate(aPair)\n\t\treturn MutateToken.new(aPair.keys.first, aPair.values.first)\n\tend", "def map_input_tuples(tuples, &mapper)\n return enum_for(:with_input_tuples, tuples) unless mapper\n\n if tuples.respond_to? :merge\n mapper[tuples]\n else\n tuples...
[ "0.55320626", "0.52644163", "0.50993836", "0.50748605", "0.48502478", "0.46965703", "0.46865812", "0.46864998", "0.46547294", "0.46507293", "0.4641601", "0.4641186", "0.46286598", "0.46056196", "0.4588389", "0.45832524", "0.44960943", "0.44899887", "0.44445732", "0.44445732", ...
0.53201824
1
Deals with the common situation of syntastic items enclosed in brackets It simply calls the subparser and then checks and eliminates the closing bracket. In principle, the therminating character can be anything, so this function could equally be used for other purposes.
def parse_bracketed(subparser, closing_character, inp) ast, rest = subparser.call(inp) return ast, rest[1..-1] if nextin(rest, closing_character) fail(ExpressionError, "Expected closing character '#{closing_character}'") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _nested_paren\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"(\")\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = scan(/\\A(?-mix:[^()]+)/)\n break if _tmp\n self.pos = _save2\n ...
[ "0.6199723", "0.61498743", "0.5925521", "0.5855886", "0.58503056", "0.5793685", "0.57798254", "0.5737077", "0.5706925", "0.5690955", "0.5690955", "0.5690955", "0.56310815", "0.5630346", "0.5622019", "0.56180984", "0.5614617", "0.55470365", "0.55220604", "0.55157584", "0.55052...
0.74541813
0
Mutually connect vertices from both direction with given distance
def connect_mutually(vertex1, vertex2, distance = 1) self.connect vertex1, vertex2, distance self.connect vertex2, vertex1, distance end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(vertex1, vertex2, edge_attributes = {})\n self.vertices << vertex1 unless self.vertices.include? vertex1\n self.vertices << vertex2 unless self.vertices.include? vertex2\n edge = Edge.new(edge_attributes)\n self.edges << edge\n edge << vertex1 << vertex2\n end", "def conne...
[ "0.67959934", "0.63730246", "0.63572633", "0.63572633", "0.612721", "0.6103807", "0.59605664", "0.59460354", "0.59111816", "0.5839553", "0.5823693", "0.5823693", "0.58224267", "0.5807244", "0.5804915", "0.5752891", "0.5731054", "0.5708193", "0.56971514", "0.5681449", "0.56563...
0.8369424
0
Required Return your choice of :paper, :rock or :scissors
def choose [:rock, :paper, :scissors, :spock, :lizard].sample end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comp_choose_rps\n\trand_num = rand(3) \n\tif rand_num == 1 \n\t \"rock\"\n\telsif rand_num == 2 \n\t \"paper\"\n\telse \n\t \"scissors\"\n\tend\nend", "def game\n if p1 == \"rock\" && p2 == \"scissors\"\n victor = \"rock\"\n elsif p1 == \"scissors\" && p2 == \"rock\"\n victor = \"rock\"...
[ "0.78500545", "0.7716266", "0.7452636", "0.73998326", "0.7312786", "0.73054767", "0.72775656", "0.7273943", "0.72689563", "0.72689563", "0.72689563", "0.72689563", "0.72689563", "0.72689563", "0.72689563", "0.72689563", "0.72689563", "0.72689563", "0.72689563", "0.72689563", ...
0.7787427
1
Optional Called after each choice you make to give feedback Params: you [Symbol]: Your choice them [Symbol]: Your opponents choice win_lose_or_draw [Symbol]: holds the result of your choice
def result(you, them, win_lose_or_draw) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pbAfterBattle(decision,canlose)\n for i in $Trainer.party\n (i.makeUnmega rescue nil); (i.makeUnprimal rescue nil)\n end\n if $PokemonGlobal.partner\n pbHealAll\n for i in $PokemonGlobal.partner[3]\n i.heal\n (i.makeUnmega rescue nil); (i.makeUnprimal rescue nil)\n end\n end\n if dec...
[ "0.6784321", "0.66293114", "0.65738606", "0.6518283", "0.6434408", "0.64252317", "0.64166296", "0.639096", "0.6384794", "0.63376737", "0.6300971", "0.6287487", "0.6284093", "0.6281477", "0.62765914", "0.6233791", "0.62327343", "0.6226494", "0.6206645", "0.62047815", "0.620297...
0.7542198
0
Returns the listeners instances for the given hook.
def hook_listeners(hook) @@hook_listeners[hook] ||= listeners.select {|listener| listener.respond_to?(hook)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hook_listeners(hook)\n @@hook_listeners[hook] ||= listeners.select { |listener| listener.respond_to?(hook) }\n end", "def listeners\n @@listeners ||= @@listener_classes.collect { |listener| listener.instance }\n end", "def listeners\n @@listeners ||= @@listener_classes.collect {|li...
[ "0.7328696", "0.6783209", "0.6753541", "0.656434", "0.63373697", "0.6311987", "0.6131996", "0.60998577", "0.6082498", "0.5989648", "0.59783345", "0.5944503", "0.5854714", "0.5838381", "0.57812965", "0.5757509", "0.5692536", "0.5673109", "0.5642283", "0.5623001", "0.55500114",...
0.7378258
0
Calls a hook. Returns the listeners response.
def call_hook(hook, context={}) template = context[:controller].instance_variable_get('@template') returning [] do |response| hls = hook_listeners(hook) if hls.any? hls.each {|listener| response << listener.send(hook, template)} end end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_hook(hook, context={})\n [].tap do |response|\n hls = hook_listeners(hook)\n if hls.any?\n hls.each { |listener| response << listener.send(hook, context) }\n end\n end\n end", "def fire(hook, *args); end", "def call_hook(before, ok)\n logger.debug(\"ca...
[ "0.8061121", "0.6755931", "0.65076405", "0.6287078", "0.6283771", "0.6248675", "0.6239208", "0.62378377", "0.6225361", "0.62201256", "0.6216497", "0.6193377", "0.61451095", "0.6141653", "0.6128263", "0.6091145", "0.60537285", "0.60121673", "0.6009809", "0.6004454", "0.5975807...
0.7528201
1
Only lookup for methods defined in Surrealist::Serializer subclasses to prevent invoke of Kernel methods
def method_defined?(method) return true if instance_methods(false).include?(method) return false if superclass == Surrealist::Serializer super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disableSerialization \n \"disableSerialization\" \n end", "def ignore_method_conflicts; end", "def method_missing(sym, *a, &b) # :nodoc:\n if REMOVED_METHODS.include?(sym)\n removed_method_calls << sym\n return\n end\n\n if @specification_version > CURRENT_SPECIFICATION_VERSION a...
[ "0.61764926", "0.5968779", "0.58004266", "0.5699501", "0.56953883", "0.5688789", "0.5623173", "0.5619078", "0.5616607", "0.56154555", "0.56130064", "0.560336", "0.5599646", "0.55949086", "0.55821365", "0.5569374", "0.55487704", "0.5540206", "0.5531036", "0.5526016", "0.552553...
0.6435144
0
Passes build_schema to Surrealist
def build_schema(**args) if Helper.collection?(object) build_collection_schema(**args) else Surrealist.build_schema(instance: self, **args) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_schema(**args)\n if object.respond_to?(:each)\n build_collection_schema(args)\n else\n Surrealist.build_schema(instance: self, **args)\n end\n end", "def build(data)\n raise Sawyer::Error, \"No schema for this relation: #{inspect}\" unless @schema\n @schema.bui...
[ "0.7847364", "0.67096186", "0.6707812", "0.65270525", "0.6518783", "0.65071946", "0.6506769", "0.64615136", "0.6382201", "0.6313566", "0.62549967", "0.6177289", "0.6167557", "0.61563826", "0.6134592", "0.607562", "0.600008", "0.59844697", "0.59711075", "0.5935546", "0.5921332...
0.7892906
0
Maps collection and builds schema for each instance.
def build_collection_schema(**args) object.map { |object| self.class.new(object, **context).build_schema(**args) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_collection_schema(**args)\n object.map { |object| self.class.new(object, context).build_schema(args) }\n end", "def build_schema(**args)\n if object.respond_to?(:each)\n build_collection_schema(args)\n else\n Surrealist.build_schema(instance: self, **args)\n end\n ...
[ "0.75386643", "0.69643307", "0.6725464", "0.67129016", "0.6648686", "0.6631678", "0.6365982", "0.6183202", "0.60855967", "0.59456795", "0.5908253", "0.59031874", "0.58804923", "0.58474725", "0.5832935", "0.5774783", "0.5718048", "0.56822103", "0.5670449", "0.56691265", "0.561...
0.754216
0
POST /register/financeiro/providers POST /register/financeiro/providers.json
def create @register_financeiro_provider = Register::Financeiro::Provider.new(register_financeiro_provider_params) respond_to do |format| if @register_financeiro_provider.save format.html { redirect_to @register_financeiro_provider, notice: 'Fornecedor Cadastrado com Sucesso!' } format.js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @provider = current_company.providers.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n ...
[ "0.66603345", "0.6581058", "0.6513194", "0.63549715", "0.623372", "0.62192124", "0.6166771", "0.61587363", "0.6126632", "0.61177856", "0.60972947", "0.600137", "0.5976652", "0.5916798", "0.5907525", "0.59043396", "0.5863392", "0.585269", "0.5823982", "0.58029413", "0.5780357"...
0.7149954
0
PATCH/PUT /register/financeiro/providers/1 PATCH/PUT /register/financeiro/providers/1.json
def update respond_to do |format| if @register_financeiro_provider.update(register_financeiro_provider_params) format.html { redirect_to @register_financeiro_provider, warning: 'Fornecedor Atualizado com Sucesso!' } format.json { render :show, status: :ok, location: @register_financeiro_provid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @provider = current_company.providers.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { head :no_content }\n else\n ...
[ "0.6206614", "0.5920748", "0.5916309", "0.583468", "0.5800413", "0.5777471", "0.5777471", "0.5764032", "0.5756555", "0.57433856", "0.5702065", "0.56736434", "0.5672531", "0.56522113", "0.56373966", "0.5633957", "0.5608266", "0.55842835", "0.55450106", "0.554356", "0.5541728",...
0.6556122
0
DELETE /register/financeiro/providers/1 DELETE /register/financeiro/providers/1.json
def destroy @register_financeiro_provider.destroy respond_to do |format| format.html { redirect_to register_financeiro_providers_url, warning: 'Fornecedor deletado com Sucesso!' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Fornecedor apagado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider = current_company.providers.find(params[:id])\n @provider.destroy\n\n...
[ "0.69506615", "0.68857414", "0.68733144", "0.6791359", "0.6771196", "0.676669", "0.6753969", "0.67456716", "0.6702498", "0.66901577", "0.66725415", "0.666834", "0.66574365", "0.66545665", "0.6645745", "0.663581", "0.6635573", "0.6635573", "0.6635573", "0.6620095", "0.6613273"...
0.7471994
0
Copies errors from source to target if either nested or original keys selected
def copy_errors(source, target, name, key, value, **opts) nested = opts[:nested_keys] original = opts[:original_keys] if !nested && !original target.errors.add(name, key, record: target, value: value) else source.errors.messages.each do |k, texts| targe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_errors(source)\n source.errors.each do |key, error|\n self.errors.add(key, error)\n end\n end", "def derive_errors_from_error(error)\n @errors = self.errors.merge(error.details)\n end", "def merge_errors(hash)\n self.merge!(hash) if hash.any?\n end", "def load_errors_...
[ "0.68928754", "0.56096524", "0.55461067", "0.5525311", "0.5517231", "0.54426765", "0.5412688", "0.5412688", "0.54102814", "0.5268009", "0.5195334", "0.5138226", "0.51298165", "0.51280516", "0.5092859", "0.5084438", "0.5064917", "0.5064329", "0.5064329", "0.5064329", "0.504182...
0.80497855
0
action to get an api_token from the client side, by sending our email+password previously we should have created a registered user
def token authenticate_with_http_basic do |email, password| user = User.find_by(email: email) if user && user.authenticate(password) render json: { token: user.api_token } else render json: { error: 'Incorrect credentials' }, status: 401 end end en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_token\n client.get(\"/user/api_token\").fetch(\"result\")\n end", "def create\n user = User.find_by(email: auth_params[:email])\n if user&.valid_password?(auth_params[:password])\n @token = user.api_tokens.find_or_create_by(name: (auth_params[:name] || \"default\")) do |token|\n ...
[ "0.7890619", "0.7541727", "0.74216557", "0.73960036", "0.73782367", "0.7282306", "0.7269416", "0.71849024", "0.71713746", "0.7142478", "0.71292084", "0.70910656", "0.7089959", "0.7073969", "0.7054988", "0.7050023", "0.70125544", "0.6981843", "0.69642735", "0.69626915", "0.695...
0.7639249
1
checking whether the user is watching the task or not (if yes, it will return true, otherwiese false)
def watched?(userid, taskid) cnt = Watchlist.where(user_id: userid).where(task_id: taskid).count if cnt > 0 true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def watching?\n @watcher && @watcher.alive? ? true : false\n end", "def watches?(task_list)\n watched_task_lists.include?(task_list)\n end", "def watch?\n false\n end", "def is_watchable?\n true\n end", "def can_watch?(song)\n song.open? ||\n song.closed? && ...
[ "0.70853376", "0.7025285", "0.68004584", "0.6668441", "0.66678256", "0.6591326", "0.6582866", "0.6559195", "0.65517044", "0.6504331", "0.64542127", "0.64374214", "0.6422233", "0.641041", "0.641041", "0.63672066", "0.63646954", "0.6359754", "0.6354411", "0.63533837", "0.632276...
0.7664663
0
GET /abuse_categories/new GET /abuse_categories/new.json
def new @abuse_category = AbuseCategory.new respond_to do |format| format.html # new.html.erb format.json { render json: @abuse_category } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n puts @category.inspect\n @internal = @category.internals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internal }\n end\n end", "def new\n @category = current_mall.categories.new\n\n respond_to do |format|\n format.html # new...
[ "0.7887449", "0.76459724", "0.75706923", "0.75631225", "0.75631225", "0.75631225", "0.75631225", "0.75631225", "0.75631225", "0.75631225", "0.75631225", "0.75631225", "0.7520242", "0.742218", "0.73192835", "0.73040724", "0.72827667", "0.72827667", "0.728058", "0.72777534", "0...
0.7753828
1
POST /abuse_categories POST /abuse_categories.json
def create @abuse_category = AbuseCategory.new(params[:abuse_category]) respond_to do |format| if @abuse_category.save format.html { redirect_to @abuse_category, notice: 'Abuse category was successfully created.' } format.json { render json: @abuse_category, status: :created, location: @a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end", "def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend", "def addCat()\n if(!authentic...
[ "0.7015381", "0.69101614", "0.6826195", "0.6811979", "0.67609817", "0.67379797", "0.6713252", "0.66824347", "0.6642314", "0.6640483", "0.6593945", "0.6590342", "0.65075916", "0.6499784", "0.6460388", "0.63935435", "0.6387792", "0.6368421", "0.6362098", "0.63493747", "0.631065...
0.7093352
0
DELETE /abuse_categories/1 DELETE /abuse_categories/1.json
def destroy @abuse_category = AbuseCategory.find(params[:id]) @abuse_category.destroy respond_to do |format| format.html { redirect_to abuse_categories_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.find(params[:id])\n status = c.destroy\n error = \"\"\n if(c.errors.full_messages.count > 0)\n...
[ "0.74289536", "0.740274", "0.7347488", "0.7327199", "0.72402877", "0.7225732", "0.7172734", "0.717107", "0.71639466", "0.7146715", "0.71407855", "0.7095608", "0.7084423", "0.7080711", "0.7046172", "0.70432365", "0.7021145", "0.7010392", "0.7005864", "0.6996867", "0.69841355",...
0.7635272
0
GET /profile_pictures/new GET /profile_pictures/new.json
def new @profile_picture = ProfilePicture.new respond_to do |format| format.html # new.html.erb format.json { render json: @profile_picture } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @picture = Picture.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @picture }\n end\n end", "def new\n @picture = Picture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @picture }\...
[ "0.79164124", "0.7842709", "0.7842709", "0.7842709", "0.766889", "0.7626107", "0.7555177", "0.7542304", "0.7527279", "0.7419216", "0.73574966", "0.72773004", "0.7202677", "0.719446", "0.71482724", "0.71424955", "0.7135759", "0.71096313", "0.7107514", "0.71073776", "0.71073776...
0.8027002
0
DELETE /profile_pictures/1 DELETE /profile_pictures/1.json
def destroy @profile_picture = ProfilePicture.find(params[:id]) @profile_picture.destroy respond_to do |format| format.html { redirect_to profile_pictures_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @profile_pic.destroy\n respond_to do |format|\n format.html { redirect_to profile_pics_path(@profile) }\n format.json { head :no_content }\n end\n end", "def destroy\n @picture = current_user.pictures.find(params[:id])\n @picture.destroy\n\n respond_to do |format|\n ...
[ "0.7810487", "0.76157963", "0.7479192", "0.7310452", "0.7298334", "0.7298334", "0.7298334", "0.72598726", "0.7210157", "0.71934754", "0.7175975", "0.716429", "0.71199125", "0.70998865", "0.7097233", "0.70954376", "0.70862436", "0.70862436", "0.70862436", "0.70862436", "0.7086...
0.77758694
1
return just project id instead path
def project_path(options) options[:id].id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_id\n data[:project_id]\n end", "def project_id(project_key)\n project_info(project_key)['id']\n end", "def project_id\n return @project_id\n end", "def project_id\n service.project\n end", "def project_id\n service.project\n ...
[ "0.75666577", "0.75124115", "0.74059916", "0.73986936", "0.73986936", "0.73986936", "0.7386187", "0.7321017", "0.73048574", "0.72841156", "0.721047", "0.71736103", "0.71642333", "0.71532637", "0.71444213", "0.71371454", "0.7135125", "0.7114541", "0.7094825", "0.702197", "0.70...
0.810088
0
=== Delete story. Delete a story. ==== Parameters id:: (Integer) Story id. ==== Example
def delete_story(id) @client.raw('delete', "/content/stories/#{id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_story(story_id)\n delete_request(\"stories/#{story_id}\")\n end", "def delete_story(story)\n if story.is_a?(Story)\n api_url = URI.parse(\"#{CONFIG[:api_location]}/projects/#{@id}/stories/#{story.id}\")\n elsif story.is_a?(Integer) || story.to_i.is_a?(Integer)\n api_url = URI.p...
[ "0.8755883", "0.7940897", "0.7845996", "0.77252233", "0.7723095", "0.7703726", "0.7451392", "0.7364622", "0.7271596", "0.7271596", "0.72702444", "0.72594196", "0.722823", "0.72176534", "0.72176534", "0.72176534", "0.72176534", "0.7217427", "0.71882993", "0.7186902", "0.718690...
0.879289
0
GET /neighborhoods/1 GET /neighborhoods/1.xml
def show @neighborhood = Neighborhood.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @neighborhood } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighborhood\n respond_to do |format|\n format.xml { render :template => \"locations/neighborhood\", \n :formats => [:xml], :handlers => :builder, :layout => false, \n :locals => {:kml => @venue.location.neighborhood.as_kml} }\n format.json { rende...
[ "0.699532", "0.68939996", "0.685363", "0.68177617", "0.6773552", "0.67511725", "0.6485151", "0.64821935", "0.63414925", "0.6332241", "0.62476814", "0.61456627", "0.61018574", "0.6022572", "0.5980252", "0.5980252", "0.596445", "0.5959069", "0.5955021", "0.5947288", "0.5928081"...
0.74902964
0
GET /neighborhoods/new GET /neighborhoods/new.xml
def new @neighborhood = Neighborhood.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @neighborhood } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end", "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { ren...
[ "0.7539635", "0.7539635", "0.7497491", "0.723275", "0.7047816", "0.7047816", "0.6854556", "0.6716445", "0.66752", "0.6669994", "0.6601273", "0.65954304", "0.65735185", "0.65063995", "0.6492292", "0.64819056", "0.64708114", "0.6453422", "0.64458334", "0.64458334", "0.6408775",...
0.8057044
0
POST /neighborhoods POST /neighborhoods.xml
def create @neighborhood = Neighborhood.new(params[:neighborhood]) respond_to do |format| if @neighborhood.save flash[:notice] = 'Neighborhood was successfully created.' format.html { redirect_to(@neighborhood) } format.xml { render :xml => @neighborhood, :status => :created, :lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @neighborhood = Neighborhood.new(params[:neighborhood])\n\n respond_to do |format|\n if @neighborhood.save\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully created.' }\n format.json { render json: @neighborhood, status: :created, location: @nei...
[ "0.7243964", "0.7243964", "0.7110647", "0.6764479", "0.67072785", "0.66523", "0.65495926", "0.64211434", "0.64068633", "0.6364915", "0.6362567", "0.6270441", "0.6252755", "0.61857164", "0.61802614", "0.61390114", "0.6136047", "0.61125785", "0.60313994", "0.6013997", "0.601399...
0.7451864
0
PUT /neighborhoods/1 PUT /neighborhoods/1.xml
def update @neighborhood = Neighborhood.find(params[:id]) respond_to do |format| if @neighborhood.update_attributes(params[:neighborhood]) flash[:notice] = 'Neighborhood was successfully updated.' format.html { redirect_to(@neighborhood) } format.xml { head :ok } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @neighborhood = Neighborhood.find(params[:id])\n\n respond_to do |format|\n if @neighborhood.update_attributes(params[:neighborhood])\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully updated.' }\n format.json { head :no_content }\n else\n ...
[ "0.68779117", "0.68779117", "0.6692699", "0.66424227", "0.6353942", "0.6335279", "0.6159418", "0.6159418", "0.6094013", "0.6026052", "0.6000399", "0.59357804", "0.585839", "0.58509976", "0.5774955", "0.5735724", "0.57170296", "0.5708825", "0.5703231", "0.56700855", "0.5670085...
0.71705484
0
DELETE /neighborhoods/1 DELETE /neighborhoods/1.xml
def destroy @neighborhood = Neighborhood.find(params[:id]) @neighborhood.destroy respond_to do |format| format.html { redirect_to(neighborhoods_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @neighborhood = Neighborhood.find(params[:id])\n @neighborhood.destroy\n\n respond_to do |format|\n format.html { redirect_to neighborhoods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @neighborhood = Neighborhood.find(params[:id])\n @neighborho...
[ "0.7095744", "0.7095744", "0.69894266", "0.6892514", "0.68211657", "0.6812233", "0.66815424", "0.66675717", "0.63999486", "0.6399937", "0.63651586", "0.62596554", "0.6239755", "0.62306786", "0.6227989", "0.6186426", "0.6169863", "0.6117123", "0.60964054", "0.6095586", "0.6090...
0.7625531
0
GET /neighborhood/select/1 there is no view for selected neighborhood
def select begin neighborhood = Neighborhood.find(params[:id]) session[:neighborhood_id] = neighborhood.id rescue ActiveRecord::RecordNotFound logger.error("Attempt to add an invalid neighborhood #{params[:id]}") flash[:error] = "Attempt to add an invalid neighborhood #{params[:id]}" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @neighborhoods = Neighborhood.all\n end", "def show\n @neighborhood = Neighborhood.find(params[:id])\n\n render json: @neighborhood\n end", "def show\n @neighborhood = Neighborhood.find_by_slug(params[:id])\n @branches = Branch.select(\"DISTINCT branches.id, branches.name, branches...
[ "0.6522308", "0.645916", "0.6362504", "0.63375247", "0.6327183", "0.63201666", "0.6135209", "0.6066522", "0.59711874", "0.5970757", "0.592784", "0.592784", "0.591722", "0.5814879", "0.57963705", "0.57903206", "0.5790147", "0.5717487", "0.5702177", "0.5702177", "0.5694525", ...
0.6685248
0
GET /neighborhoods/select/1 there is no view for selected emirate
def select begin neighborhood = Neighborhood.find(params[:id]) session[:emirate_id] = neighborhood.emirate.id session[:emirate_name] = neighborhood.emirate.name session[:neighborhood_id] = neighborhood.id session[:neighborhood_name] = neighborhood.name rescue ActiveRec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @neighborhoods = Neighborhood.all\n end", "def select\n begin\n neighborhood = Neighborhood.find(params[:id])\n session[:neighborhood_id] = neighborhood.id\n rescue ActiveRecord::RecordNotFound\n logger.error(\"Attempt to add an invalid neighborhood #{params[:id]}\")\n f...
[ "0.5984067", "0.59282905", "0.5889158", "0.58823776", "0.5823313", "0.57434195", "0.5712763", "0.56129855", "0.5568571", "0.555003", "0.55148584", "0.5503354", "0.545559", "0.54389584", "0.5424104", "0.5417219", "0.5393993", "0.53892875", "0.53783244", "0.5375865", "0.5369384...
0.6397589
0
GET /neighborhoods/reset/1 there is no view for selected emirate
def reset session[:neighborhood_id] = nil session[:neighborhood_name] = nil session[:project_id] = nil session[:project_name] = nil session[:building_id] = nil session[:building_name] = nil flash[:notice] = "Selected value for Neighborhood has been reseted." redirect_to(request.env['HTTP...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n session[:emirate_id] = nil\n session[:emirate_name] = nil\n session[:neighborhood_id] = nil\n session[:neighborhood_name] = nil\n session[:project_id] = nil\n session[:project_name] = nil\n session[:building_id] = nil\n session[:building_name] = nil\n flash[:notice] = \"Selec...
[ "0.6180517", "0.5873813", "0.58043814", "0.5784534", "0.5755886", "0.5720026", "0.5517793", "0.54083914", "0.53096104", "0.52835053", "0.52822757", "0.5247628", "0.5246263", "0.5245358", "0.5242879", "0.5239202", "0.52141935", "0.5186752", "0.5152402", "0.5138301", "0.5137798...
0.6415626
0
CONSTRAINTS Teacher availability constraint: If the teacher of the course is not available to teach that course at a given period, then no lecture of the course can be scheduled at that period. Each lecture in a period unavailable for that course is one violation.
def teacher_availability @problem.never{ conjunct{ [ Timetable::Entry.asp(:course_component_id => "C", :weekday_id => "WD", :timeframe_id => "TF"), Course::Component.asp(:id => "C", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tutor_double_booked\n lesson_start = self.start_time\n lesson_end = self.end_time\n overlap = tutor.appointments.any? do |appointment|\n check_start = appointment.start_time\n check_end = appointment.end_time\n check_start < lesson_end && lesson_end < check_end || check_start < lesson_s...
[ "0.6527474", "0.6184341", "0.6051274", "0.5908992", "0.5885086", "0.5862278", "0.58438253", "0.58104813", "0.5749183", "0.5741483", "0.56403565", "0.5621893", "0.5585321", "0.5572547", "0.5547446", "0.5531165", "0.552233", "0.5511417", "0.55072623", "0.5507026", "0.5490216", ...
0.7335049
0
Room Availability: If a room is unavailable during a certain time, lectures must not be held in this room at that time.
def room_availability @problem.never{ same(:room_id, :weekday_id, :timeframe_id).for(Timetable::Entry, Room::Unavailability) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def room_availability_check\n if hotel_room.present? && !hotel_room.available?(check_in, check_out)\n errors.add(:hotel_room, \"is not available right now and booked already\")\n end\n end", "def availability_of_room\n room_type = RoomType.find(self.room_type_id) rescue nil\n errors.add(:room_t...
[ "0.77049506", "0.7641074", "0.7404412", "0.7250252", "0.6795036", "0.67234015", "0.6672044", "0.66351044", "0.66196525", "0.65986794", "0.656682", "0.65648776", "0.6557728", "0.6532578", "0.64731956", "0.64486104", "0.6427369", "0.64058083", "0.6386058", "0.636526", "0.634047...
0.7765664
0
PATCH/PUT /carparks/1/update_bookings PATCH/PUT /carparks/1/update_bookings.json
def update_bookings respond_to do |format| if @carpark.update_attributes(carpark_udpate_bookings_params) format.html { redirect_to(@carpark, :notice => I18n.t('text.general.successfully_updated', :name => Carpark.model_name.human)) } format.xml { head :ok } format.js { render :text => ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @booking = Booking.find(params[:id])\n\n if @booking.update(booking_params)\n head :no_content\n else\n render json: @booking.errors, status: :unprocessable_entity\n end\n end", "def update\n @booking = Booking.find(params[:id])\n @booking.update_attributes(params[:booki...
[ "0.7233329", "0.7184548", "0.7175621", "0.7097805", "0.7080843", "0.7080843", "0.7080843", "0.70541507", "0.70251113", "0.70155054", "0.70037454", "0.6955881", "0.69507915", "0.6935257", "0.69324833", "0.69324833", "0.69324833", "0.6924246", "0.6924246", "0.6924246", "0.69242...
0.72984105
0
Returns the value of attribute inbound_email. source://actionmailbox//lib/action_mailbox/base.rb68
def inbound_email; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def original_email\n read_attribute(:email)\n end", "def original_email\n read_attribute(:email)\n end", "def email\n get_attribute('Email')\n end", "def email\n attributes['email']\n end", "def email_inboxes\n @attributes[:email_inboxes]\n end", "def email\n ...
[ "0.64986277", "0.64986277", "0.64153326", "0.6340147", "0.6327908", "0.630969", "0.630969", "0.630969", "0.630969", "0.6309424", "0.624184", "0.61932176", "0.6112", "0.6094265", "0.6089738", "0.6089738", "0.60714287", "0.60686404", "0.6068631", "0.60520077", "0.60505956", "...
0.70906144
1
Creates an InboundEmail by specifying through options or a block. ==== Options :status The +status+ to set for the created InboundEmail. For possible statuses, see its documentation. ==== Creating a simple email When you only need to set basic fields like +from+, +to+, +subject+, and +body+, you can pass them directly ...
def create_inbound_email_from_mail(status: T.unsafe(nil), **mail_options, &block); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_inbound_email_from_mail(status: :processing, **mail_options, &block)\n mail = Mail.new(mail_options, &block)\n # Bcc header is not encoded by default\n mail[:bcc].include_in_headers = true if mail[:bcc]\n\n create_inbound_email_from_source mail.to_s, status: status\n end", "def ...
[ "0.6958478", "0.6123538", "0.59719783", "0.5874632", "0.57082033", "0.5640651", "0.56024206", "0.5590026", "0.5583072", "0.5567248", "0.5556859", "0.553881", "0.55299294", "0.55148965", "0.5506786", "0.54813045", "0.5461119", "0.54186225", "0.54142076", "0.53808504", "0.53687...
0.69938505
0
Create an InboundEmail using the raw rfc822 +source+ as text. source://actionmailbox//lib/action_mailbox/test_helper.rb72
def create_inbound_email_from_source(source, status: T.unsafe(nil)); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_inbound_email_from_source(source, status: :processing)\n ActionMailbox::InboundEmail.create_and_extract_message_id! source, status: status\n end", "def receive_inbound_email_from_source(*args)\n create_inbound_email_from_source(*args).tap(&:route)\n end", "def receive_inbound_email_f...
[ "0.7233509", "0.6671392", "0.65473944", "0.65473944", "0.6537838", "0.62553495", "0.60673034", "0.6029494", "0.5988849", "0.5988849", "0.59786636", "0.58903456", "0.58903456", "0.588277", "0.58394855", "0.5811762", "0.576595", "0.5690317", "0.56107455", "0.55417347", "0.55179...
0.739753
1
POST /vacinas or /vacinas.json
def create @vacina = current_usuario.vacinas.build(vacina_params) respond_to do |format| if @vacina.save format.html { redirect_to @vacina, notice: "Vacina was successfully created." } format.json { render :show, status: :created, location: @vacina } else format.html { rende...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @vacina = Vacina.new(vacina_params)\n\n respond_to do |format|\n if @vacina.save\n format.html { redirect_to @vacina, notice: 'Vacina cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @vacina }\n format.js { head :ok }\n else\n ...
[ "0.6891478", "0.686693", "0.6682931", "0.6623095", "0.6613758", "0.65612674", "0.65386486", "0.65287334", "0.6491182", "0.64106536", "0.63900745", "0.6365973", "0.63637704", "0.6355555", "0.6349115", "0.63459766", "0.6327248", "0.6316363", "0.63150185", "0.631404", "0.6312583...
0.71005625
0
PATCH/PUT /vacinas/1 or /vacinas/1.json
def update respond_to do |format| if @vacina.update(vacina_params) format.html { redirect_to @vacina, notice: "Vacina was successfully updated." } format.json { render :show, status: :ok, location: @vacina } else format.html { render :edit, status: :unprocessable_entity } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @vacina.update(vacina_params)\n format.html { redirect_to @vacina, notice: 'Vacina editada com sucesso.' }\n format.json { render :show, status: :ok, location: @vacina }\n else\n format.html { render :edit }\n format.json { render js...
[ "0.706184", "0.67319643", "0.66583675", "0.6622953", "0.65904796", "0.6568274", "0.6556815", "0.65556157", "0.6507636", "0.6496167", "0.63631254", "0.6357631", "0.6354124", "0.6343329", "0.6339488", "0.6338594", "0.63289404", "0.63118154", "0.63111466", "0.63046473", "0.62579...
0.7075699
0
save this user to the database
def save r = Episodey::DB::User.create( :name => self.name, :email => self.email ) @id = r.id return self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\r\n @@users.push self\r\n end", "def save\n return false unless valid?\n self.user = User.create!(name: name)\n true\n end", "def save\n CONNECTION.execute(\"UPDATE users SET name = '#{self.name}' WHERE id = #{self.id};\")\n end", "def save\n\t\t\tis_new = param...
[ "0.7281", "0.71302557", "0.6965593", "0.69588834", "0.68817455", "0.68813825", "0.678438", "0.67694175", "0.6757151", "0.67487615", "0.6721779", "0.6719574", "0.67121774", "0.670702", "0.67040485", "0.66933244", "0.66372347", "0.6590747", "0.65861857", "0.6584338", "0.6584095...
0.7379475
0
Get the Member object for this user Always present if space is_open?
def member(user) return unless user.present? is_open? ? add_member(user) : get_member(user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def member\n Member.find(@member.name)\n end", "def member(id)\n space_memberships.find_by(user_id: id)\n end", "def member\n Member.find(id) if auth == 'customer'\n end", "def member\n group&.member_for(user)\n end", "def get_member(id)\n is_admin? ? ::Refinery::Memberships::Member...
[ "0.72555083", "0.7097399", "0.6810032", "0.680544", "0.6779025", "0.6748968", "0.65414286", "0.64996725", "0.6473042", "0.6448093", "0.6430497", "0.63767916", "0.63760865", "0.63177633", "0.63063747", "0.62682295", "0.62362826", "0.6235187", "0.6225014", "0.6209468", "0.62025...
0.746264
0
Describe a valid IPv4 address
def Valid4 #Translators: dot: "." _( "A valid IPv4 address consists of four integers\nin the range 0-255 separated by dots." ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ip_v4_address; end", "def ipv4\n puts 'For the more accurate Regex of IP please refer to ruby standard library \"resolv\"'\n puts 'require \"resolve\"'\n puts 'Resolv::IPv4::Regex256'\n puts 'Resolv::IPv4::Regex'\n\n ip_octet = '(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])'.freeze\n...
[ "0.76957905", "0.7369479", "0.7115904", "0.7053634", "0.7020537", "0.6999037", "0.68928576", "0.6773228", "0.6740806", "0.67130166", "0.67120075", "0.67120075", "0.6579841", "0.65596217", "0.6396302", "0.6387535", "0.63801664", "0.6370863", "0.6360697", "0.63593996", "0.63069...
0.7666706
1
Check syntax of IPv6 address
def Check6(ip) return false if ip == nil || ip == "" #string num = "([1-9a-fA-F][0-9a-fA-F]*|0)"; num = "([0-9a-fA-F]{1,4})" # 1:2:3:4:5:6:7:8 if Builtins.regexpmatch( ip, Ops.add(Ops.add(Ops.add(Ops.add("^", num), "(:"), num), "){7}$") ) return true ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ipv6_address?(addr)\n return true if addr =~ /:/\n return false\n end", "def has_ipv6_ip_address?\n self.options[:ip].is_a?(String) && self.options[:ip].include?(':')\n end", "def ipv6?\n self.kind_of? IPAddress::IPv6\n end", "def ipv6?\n self.kind_of? IPAddress::IPv6\n end",...
[ "0.8178515", "0.7567127", "0.74793476", "0.74793476", "0.7444087", "0.715966", "0.71098715", "0.6687663", "0.66457635", "0.65590805", "0.65477395", "0.65186375", "0.6518104", "0.64593154", "0.6449622", "0.63936925", "0.63665944", "0.63364595", "0.6208894", "0.6126716", "0.611...
0.77778435
1
If param contains IPv6 in one of its various forms, extracts it. if ip is closed in [ ] or contain % then it can be special case of IPv6 syntax, so extract ipv6 (see description later) and continue with check. IPv6 syntax: pure ipv6 blob (e.g. f008::1) ipv6 blob with link local suffix (e.g. f008::1%eth0) dtto in square...
def UndecorateIPv6(ip) if Builtins.regexpmatch(ip, "^\\[.*\\]") || Builtins.regexpmatch(ip, "^[^][%]+(%[^][%]+){0,1}$") ip = Builtins.regexpsub( ip, "^\\[?([^][%]+)(%[^][%]+){0,1}(\\]|$)", "\\1" ) end ip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Check6(ip)\n return false if ip == nil || ip == \"\"\n\n #string num = \"([1-9a-fA-F][0-9a-fA-F]*|0)\";\n num = \"([0-9a-fA-F]{1,4})\"\n\n # 1:2:3:4:5:6:7:8\n if Builtins.regexpmatch(\n ip,\n Ops.add(Ops.add(Ops.add(Ops.add(\"^\", num), \"(:\"), num), \"){7}$\")\n ...
[ "0.69861984", "0.6656515", "0.6589395", "0.6554902", "0.6246059", "0.6218405", "0.60721314", "0.60392153", "0.60217947", "0.59464884", "0.5869485", "0.58584404", "0.58584404", "0.5828361", "0.5819102", "0.57903016", "0.5783504", "0.56838596", "0.56706303", "0.56153786", "0.56...
0.7282725
0
Returns string of valid network definition. Both IPv4 and IPv6.
def ValidNetwork # TRANSLATORS: description of the valid network definition _( "A valid network definition can contain the IP,\n" + "IP/Netmask, IP/Netmask_Bits, or 0/0 for all networks.\n" + "\n" + "Examples:\n" + "IP: 192.168.0.1 or 2001:db8:0::1\n" + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def netmask_ext()\n return(NetAddr.ip_int_to_str(@netmask, 4))\n end", "def network(options=nil)\n known_args = [:Objectify, :Short]\n objectify = false\n short = false\n\n if (options)\n if (!options.kind_of?(Hash))\n raise ArgumentError, \"Expecte...
[ "0.66290843", "0.66032284", "0.65199804", "0.6402782", "0.6341965", "0.6251555", "0.6221061", "0.6186897", "0.6153124", "0.61429363", "0.61064637", "0.61064637", "0.6034383", "0.60214275", "0.60027504", "0.599918", "0.5967098", "0.5922214", "0.58892584", "0.585689", "0.581387...
0.75469166
0
Converts IPv4 into its 32 bit binary representation.
def IPv4ToBits(ipv4) if !Check4(ipv4) Builtins.y2error("Not a valid IPv4: %1", ipv4) return nil end ret = "" Builtins.foreach(Builtins.splitstring(ipv4, ".")) do |ipv4_part| ipv4_part_i = Builtins.tointeger(ipv4_part) Builtins.foreach(@bit_weight_row) do |try_i| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binary_to_ipv4(ipv4addr)\n ia = ipv4addr.to_s.split('.')\n if ia.size != 4\n return \"0.0.0.0\"\n end\n output = \"\"\n i = 1\n for octett in ia\n output = output + octett.to_s.to_i(2).to_s\n if i < 4\n output = output + \".\"\n end\n i += 1\n end\n outpu...
[ "0.7195191", "0.71735984", "0.7018101", "0.6877158", "0.6808105", "0.63773257", "0.6369644", "0.61781776", "0.6147375", "0.6124256", "0.6121128", "0.5947445", "0.5876764", "0.58442765", "0.5838978", "0.5725394", "0.56335646", "0.5630719", "0.5630719", "0.56046265", "0.552456"...
0.7513471
0
Checks the given IPv4 network entry.
def CheckNetwork4(network) generic_check = CheckNetworkShared(network) if generic_check != nil return generic_check # 192.168.0.1, 0.8.55.999 elsif Check4(network) return true # 192.168.0.0/20, 0.8.55/158 elsif Builtins.regexpmatch( network, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ipv4_address?(n)\n arr = n.split('.')\n if arr.count != 4 ||\n !('1'..'255').include?(arr[0])\n return false\n end\n\n arr.each do |num|\n return false if !('1'..'255').include?(num)\n end\n true\nend", "def Check4(ip)\n return false if ip == nil || ip == \"\"\n num = \"(25[0-5]|2[0...
[ "0.6924916", "0.6814058", "0.6659774", "0.65107095", "0.6501735", "0.6453501", "0.6276694", "0.6276694", "0.6187533", "0.617165", "0.61176383", "0.6052721", "0.5987528", "0.5903428", "0.58407485", "0.5832531", "0.58169943", "0.5797328", "0.5755056", "0.57177263", "0.5684559",...
0.72816133
0
Checks the given IPv6 network entry.
def CheckNetwork6(network) generic_check = CheckNetworkShared(network) if generic_check != nil return generic_check # 2001:db8:0::1 elsif Check6(network) return true # 2001:db8:0::1/64 elsif Builtins.regexpmatch( network, Ops.add( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ipv6_address?(addr)\n return true if addr =~ /:/\n return false\n end", "def Check6(ip)\n return false if ip == nil || ip == \"\"\n\n #string num = \"([1-9a-fA-F][0-9a-fA-F]*|0)\";\n num = \"([0-9a-fA-F]{1,4})\"\n\n # 1:2:3:4:5:6:7:8\n if Builtins.regexpmatch(\n ...
[ "0.72513175", "0.7087769", "0.6978723", "0.6978723", "0.68954325", "0.6710609", "0.6559932", "0.6558151", "0.6244913", "0.62033683", "0.61882335", "0.6141521", "0.6086646", "0.6011638", "0.5981825", "0.5920026", "0.5880508", "0.5829044", "0.58251774", "0.5792623", "0.57864803...
0.7746827
0
Combine all the sizes with reduce
def company_total_sizes companies companies.reduce(0) { |total_size, company| total_size + company.size} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine companies \n companies.reduce(0) {|sum, company| sum + company.size}\nend", "def _reduce_512(val, _values, result); end", "def _reduce_512(val, _values, result); end", "def _reduce_257(val, _values, result)\n result = val[0] << @builder.associate(nil, val[2], nil)\n ...
[ "0.6169672", "0.5922082", "0.5922082", "0.5868041", "0.5851765", "0.58464515", "0.5840214", "0.5805372", "0.5759373", "0.57470345", "0.57470345", "0.57162124", "0.57145864", "0.5705487", "0.5690968", "0.5670599", "0.5670599", "0.5669503", "0.5669503", "0.5647965", "0.5647965"...
0.6188907
0
Find the company named "Beta"
def find_company_by_name companies, name = "Beta" companies.find {|company| company.name == name} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def company_name_beta(companies)\n companies.find do |company|\n if company.name == 'Beta'\n company\n end\n end \nend", "def company_name\n element_with_value('CompanyName', opts[:company_name][0..34])\n end", "def search_company(name = \"\", limit = 50)\n\t\t@nutshe...
[ "0.82538646", "0.65528184", "0.64500123", "0.6437919", "0.64057416", "0.6344344", "0.62896013", "0.6283896", "0.6243588", "0.61975384", "0.6160563", "0.6098526", "0.6069741", "0.6060587", "0.6028932", "0.59824", "0.5960298", "0.59342134", "0.5827718", "0.58013517", "0.5761561...
0.75924385
1
Find the largest company
def find_largest_company companies companies.reduce() do |largest_company, company| company.size > largest_company.size ? company : largest_company end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_company(companies)\n values = companies.map do |company|\n company.size\n end\n max = values.max\n companies.find do |company|\n if max == company.size\n return company.name\n end\n end\nend", "def largest companies \n size = 0\n biggest = companie...
[ "0.8628099", "0.79357576", "0.7170246", "0.6838197", "0.6612869", "0.64097553", "0.63845176", "0.634346", "0.6337065", "0.63201416", "0.6306406", "0.6272829", "0.6270161", "0.6237764", "0.6212911", "0.61644554", "0.61642045", "0.6162476", "0.6147165", "0.6120871", "0.611551",...
0.8217865
1
Internal: Parses through the rooms JSON response and returns the Integer room ID. json the rooms Hash of JSON data. Returns the Integer room number. Raises NotFound if a room cannot be found for the given name.
def find_room_in_json(json) room_hash = json["rooms"].find { |r| r["name"] == room } if room_hash room_hash["id"] else raise NotFound, "Room name '#{room}' could not be found." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rooms \n json_rooms = IO.popen(\"curl -u #{@config['campfire_config']['API_KEY']}:X #{@config['campfire_config']['URL']}/presence.json\") \n parsed_rooms = JSON.parse(json_rooms.readlines.first)[\"rooms\"]\n rooms = parsed_rooms.collect {|room| [room[\"name\"],room[\"id\"]]} \nend", "def index\n ...
[ "0.5709173", "0.56110674", "0.56097525", "0.5544348", "0.55382395", "0.5403763", "0.5308042", "0.5209985", "0.5207437", "0.51769876", "0.5175701", "0.51493055", "0.51090074", "0.5097483", "0.5091128", "0.50803924", "0.5070779", "0.5069862", "0.50563353", "0.50466126", "0.5040...
0.7897486
0
Internal: Returns a Net::HTTPRequest object initialized with authentication and content headers set. verb A Symbol representing an HTTP verb. path The String path of the request. Examples http_request(:get, "/rooms.json") http_request(:post, "/room/1/speak.json") Returns a Net::HTTPRequest object.
def http_request(verb, path) klass = klass = Net::HTTP.const_get(verb.to_s.capitalize) request = klass.new(path) request.basic_auth(token, "X") request["Content-Type"] = "application/json" request end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_request(verb, uri, options = {})\n opts = {\n :form_data => resource[:http_post_form_data],\n :body => resource[:http_request_body],\n :headers => resource[:http_request_headers],\n :content_type => resource[:http_request_content_type],\n :http_user => resour...
[ "0.72321177", "0.7084825", "0.7077787", "0.7064876", "0.69969285", "0.69556326", "0.6884853", "0.6850117", "0.6805454", "0.6788964", "0.6775169", "0.67512643", "0.6677117", "0.66337174", "0.6625242", "0.66028166", "0.65888095", "0.65236825", "0.6472183", "0.64709634", "0.6461...
0.75516945
0
Group Memberships Only nonmembers can new/create a membership
def may_create_group_membership?(group) !is_group_member?(group) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def may_update_group_membership?(membership)\n\t\t\tmay_administrate? || is_group_moderator?(membership.group)\n\t\tend", "def may_create_groups?\n\t\t\tmay_administrate?\n\t\tend", "def create\n group_id = params[:group_id]\n user = User.find(params[:user_id])\n group = Group.find_by_id(group_id)\n ...
[ "0.6975206", "0.6966211", "0.6942558", "0.6836485", "0.6836485", "0.66994053", "0.6636933", "0.65902", "0.6569631", "0.6558085", "0.6548856", "0.65079755", "0.65061796", "0.64850163", "0.6481529", "0.6477887", "0.6477437", "0.64271563", "0.6426801", "0.64239985", "0.640891", ...
0.75290245
0
Only admins and group members can read the groups memberships
def may_read_group_memberships?(group) may_administrate? || is_group_reader?(group) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def may_read_groups?\n\t\t\tmay_administrate?\n\t\tend", "def may_read_group_membership?(membership)\n\t\t\tmay_administrate? || is_group_reader?(membership.group) || self == membership.user\n\t\tend", "def members\n set_group \n @members = User.joins(:groups).where(\"group_id = ? and acceptance_statu...
[ "0.7618578", "0.72203285", "0.7184566", "0.7175277", "0.71717674", "0.7114391", "0.70643455", "0.70517945", "0.7017804", "0.7008824", "0.69724274", "0.68775415", "0.68669283", "0.68555784", "0.68198884", "0.6803546", "0.6795119", "0.67744267", "0.6772698", "0.6760126", "0.675...
0.73472637
1
Group Announcements Only members can new/create a group announcement
def may_create_group_announcements?(group) may_administrate? || is_group_editor?(group) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def may_update_group_announcements?(group)\n\t\t\tmay_administrate? || is_group_editor?(group)\n\t\tend", "def may_destroy_group_announcements?(group)\n\t\t\tmay_administrate? || is_group_moderator?(group)\n\t\tend", "def may_read_group_announcements?(group)\n\t\t\tmay_administrate? || is_group_reader?(group)\...
[ "0.73138136", "0.7129636", "0.70114046", "0.66984916", "0.6517478", "0.651488", "0.6386286", "0.6383842", "0.61652654", "0.60691786", "0.60548526", "0.59532094", "0.5942169", "0.5922958", "0.5913934", "0.5905656", "0.58920413", "0.58720523", "0.58650684", "0.5841993", "0.5822...
0.7887394
0
Only admins and group moderators can destroy the group announcements
def may_destroy_group_announcements?(group) may_administrate? || is_group_moderator?(group) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n if @membership.admin \n @group.destroy\n else\n render json: {error: \"YOU MUST BE AN ADMINISTRATOR TO COMPLETE THIS ACTION\"}, status: :unprocessable_entity\n end \n head :no_content\n end", "def before_destroy_group\n controller = PublicActivity.get_controller\n\n # ...
[ "0.72583985", "0.71118426", "0.7109758", "0.70933497", "0.69536775", "0.68572", "0.68443066", "0.684158", "0.68203664", "0.6819461", "0.6817094", "0.6795154", "0.6772047", "0.6725834", "0.67130864", "0.6678497", "0.66461056", "0.66031456", "0.65991485", "0.658878", "0.6574592...
0.782434
0
Groups Only admins can new/create groups
def may_create_groups? may_administrate? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_required\n required_group = Group.find_or_create_by(:name => \"Admin\")\n unless current_user.groups.is_member?(required_group)\n flash[:error] = \"The function you wish to use is only available to admin users\"\n redirect_to root_path\n end\n end", "def group_admin?\n return f...
[ "0.79621017", "0.7511618", "0.74678373", "0.74119294", "0.7386989", "0.7359218", "0.7357209", "0.72140497", "0.72093564", "0.7198957", "0.7177259", "0.71226484", "0.70920837", "0.70885015", "0.7065247", "0.7043473", "0.7039274", "0.70377463", "0.7032393", "0.7030257", "0.6986...
0.82708544
0
Only admins and group moderators can edit/update groups
def may_update_group?(group) may_administrate? || is_group_moderator?(group) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_edit\n producer.admin?(user) || group_admin?\n end", "def can_edit?(user)\n group.can_edit?(user) # only let admins of a group edit an event\n end", "def admin_of(group)\n current_user.is_admin?(group)\n end", "def group_admin? group\n g = group.groups_userss.detect{|i| i.use...
[ "0.7817451", "0.76125234", "0.7499248", "0.74679834", "0.74262226", "0.7260814", "0.72501457", "0.7189455", "0.7173035", "0.71408266", "0.7110697", "0.7093", "0.7086075", "0.70494807", "0.69641066", "0.6947829", "0.6912918", "0.69050467", "0.6893313", "0.6871975", "0.6860145"...
0.7727491
1
Only admins can read groups
def may_read_groups? may_administrate? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_admin? group\n g = group.groups_userss.detect{|i| i.user_id == session[:id]}\n g.is_admin unless g.nil?\n end", "def group_admin?\n return false unless group\n\n group.admin?(user)\n end", "def is_group_admin_for_user? user\n !primary_network.restrict_access && UserGroup.where(...
[ "0.77566177", "0.7582693", "0.75632876", "0.7541516", "0.7530723", "0.7449132", "0.73259556", "0.73258626", "0.7264141", "0.72392297", "0.7235197", "0.72321457", "0.7210089", "0.72060907", "0.7203268", "0.7198283", "0.71553046", "0.7116349", "0.7111957", "0.70731443", "0.7070...
0.80056256
0
Only admins and group members can read a given group
def may_read_group?(group) may_administrate? || is_group_reader?(group) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def may_read_group_memberships?(group)\n\t\t\tmay_administrate? || is_group_reader?(group)\n\t\tend", "def may_read_groups?\n\t\t\tmay_administrate?\n\t\tend", "def read_allowed?(user)\n return true unless self.group_restrictions.any? || (user.nil? && self.categories.detect { |c| !c.public })\n return fa...
[ "0.77464056", "0.76708406", "0.75616556", "0.75352436", "0.74253553", "0.7424148", "0.73920715", "0.7269809", "0.7252664", "0.72461617", "0.7201932", "0.7187124", "0.71690947", "0.71684265", "0.7125707", "0.7105392", "0.7103621", "0.7069934", "0.70424366", "0.7002654", "0.698...
0.7950434
0
Only admins can destroy a given group
def may_destroy_group?(group) may_administrate? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n return access_denied unless is_admin?(current_user)\n\n @group = Group.find(params[:id])\n @group.destroy\n redirect_to(groups_url)\n end", "def destroy\n @current_user_group = UserGroup.find_by(id: current_user.id)\n @user_group = UserGroup.find_by(id: params[:id])\n if @user...
[ "0.7906135", "0.7712112", "0.76994306", "0.7612206", "0.7592401", "0.751165", "0.75018996", "0.74432874", "0.7392577", "0.7383913", "0.7360507", "0.7340534", "0.7253362", "0.7242871", "0.72086155", "0.7208554", "0.7195189", "0.71477383", "0.71424145", "0.71424145", "0.7140242...
0.81107664
0
Page to show all old announcements
def index @announcements = Announcement.all.order('created_at DESC').paginate(page: params[:page], per_page: 10) @title = 'Announcements' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @announcements = Announcement.for_today.visible_to(current_user)\n\n render\n end", "def index\n @announcements = Announcement.all\n end", "def index\n @announcements = Announcement.all\n end", "def index\n @announcements = Announcement.all\n end", "def index\n @announ...
[ "0.743664", "0.7324512", "0.7321673", "0.7321673", "0.7277775", "0.7229001", "0.7148226", "0.69725525", "0.6905304", "0.68494415", "0.67053485", "0.6638478", "0.6609778", "0.66072565", "0.6519425", "0.64598167", "0.64445716", "0.6385418", "0.6347758", "0.6325579", "0.63043916...
0.73784953
1
Form to create a new announcement
def new @announcement = Announcement.new @title = 'New announcement' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @announcement = Announcement.new\n end", "def create\n @announcement = Announcement.new(params[:announcement])\n if @announcement.save\n redirect_to admin_announcements_path, :notice => t('flash.admin.announcements.create')\n else\n render :action => \"new\"\n end\n end", "...
[ "0.7727944", "0.76282024", "0.743911", "0.742235", "0.7421701", "0.73705214", "0.7306454", "0.72608113", "0.72201014", "0.72068805", "0.7155722", "0.7149691", "0.7144811", "0.7114935", "0.7111497", "0.7111497", "0.7105122", "0.7079418", "0.7079418", "0.7076101", "0.7073982", ...
0.7808345
0
Deletes a single announcement
def destroy @announcement = Announcement.find(params[:id]) @announcement.destroy redirect_to root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n head :no_content\n end", "def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to(announcements_url) }\n format...
[ "0.8313422", "0.80016917", "0.80016917", "0.79985166", "0.7984481", "0.7796592", "0.7771324", "0.7766596", "0.7766596", "0.7766596", "0.77521443", "0.7732715", "0.77307546", "0.77013576", "0.76558596", "0.76558596", "0.76558596", "0.75846064", "0.7554678", "0.74853814", "0.74...
0.8194686
1
The data definition defines what 'subtract' means in the conext of that data item item_ids can be singular or plural But if data item is singular, use singular param_data_item = ['a', 'b', 'c'] param_data_item_subtract('a') = ['b', 'c'] param_data_item_subtract(['a']) = ['b', 'c'] param_data_item_subtract(['a', 'b', 'c...
def remove_item(id, param, item_ids) remove_command = "#{param}_subtract".to_sym node = @tinkit_class.get(id) node.__send__(remove_command, item_ids) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_subtract (opts)\n\tsum = @original\n\tparams = opts[:parameters]\n\tif !params || params.size(:seq) == 0 then -@original\n\telse do_sequential(opts) { |a, b| a - b }\n\tend\n end", "def subtract(input_a, input_b, name: nil)\n input_a, input_b = check_data_types(input_a, input_b)\n sub(input_a...
[ "0.59194565", "0.58748627", "0.58254695", "0.5726061", "0.54982805", "0.5478363", "0.52557915", "0.52035224", "0.5203481", "0.5203481", "0.5203481", "0.5203481", "0.51426995", "0.51172775", "0.5100199", "0.5083222", "0.5072431", "0.5062166", "0.5033366", "0.5025377", "0.49481...
0.61255205
0
GET /dispatch_centers/1 GET /dispatch_centers/1.xml
def show @dispatch_center = DispatchCenter.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @dispatch_center } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @center = Center.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @center }\n end\n end", "def index\n @service_centers = ServiceCenter.all\n end", "def show\n @service_center = ServiceCenter.find(params[:id])\n\n ...
[ "0.6630455", "0.6455507", "0.64345515", "0.6363066", "0.6308777", "0.6275708", "0.6225025", "0.6219532", "0.61619204", "0.6160335", "0.6108513", "0.61027396", "0.60823697", "0.60719657", "0.60683984", "0.601737", "0.5970698", "0.5942612", "0.5938634", "0.59111714", "0.586753"...
0.719981
0
GET /dispatch_centers/new GET /dispatch_centers/new.xml
def new @dispatch_center = DispatchCenter.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @dispatch_center } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @center = Center.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @center }\n end\n end", "def create\n @dispatch_center = DispatchCenter.new(params[:dispatch_center])\n\n respond_to do |format|\n if @dispatch_center.save\n ...
[ "0.737121", "0.71110094", "0.6957955", "0.67884517", "0.6779739", "0.6714872", "0.6702666", "0.66930324", "0.6519998", "0.64345634", "0.6418013", "0.64127624", "0.6404895", "0.63850737", "0.636806", "0.6366297", "0.63240266", "0.6309665", "0.6305123", "0.6298473", "0.62977445...
0.75902766
0
POST /dispatch_centers POST /dispatch_centers.xml
def create @dispatch_center = DispatchCenter.new(params[:dispatch_center]) respond_to do |format| if @dispatch_center.save format.html { redirect_to(@dispatch_center, :notice => 'Dispatch center was successfully created.') } format.xml { render :xml => @dispatch_center, :status => :creat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @center = Center.new(params[:center])\n\n respond_to do |format|\n if @center.save\n format.html { redirect_to(@center, :notice => 'Center was successfully created.') }\n format.xml { render :xml => @center, :status => :created, :location => @center }\n else\n for...
[ "0.65254474", "0.6144653", "0.60536784", "0.605281", "0.5999464", "0.59879535", "0.59743226", "0.5927045", "0.59217536", "0.58753407", "0.5857826", "0.58323807", "0.5822796", "0.5821836", "0.57396954", "0.5707515", "0.5702718", "0.56986547", "0.56813043", "0.56748444", "0.566...
0.69672775
0
PUT /dispatch_centers/1 PUT /dispatch_centers/1.xml
def update @dispatch_center = DispatchCenter.find(params[:id]) respond_to do |format| if @dispatch_center.update_attributes(params[:dispatch_center]) format.html { redirect_to(dispatch_centers_path, :notice => 'Dispatch center was successfully updated.') } format.xml { head :ok } e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @center = Center.find(params[:id])\n\n respond_to do |format|\n if @center.update_attributes(params[:center])\n format.html { redirect_to(@center, :notice => 'Center was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \...
[ "0.6338849", "0.62019724", "0.6156793", "0.6121101", "0.6111251", "0.6081152", "0.5989927", "0.59520763", "0.59454334", "0.5859529", "0.5832936", "0.573707", "0.5720457", "0.5717253", "0.56900257", "0.56783116", "0.56211555", "0.5605892", "0.5598634", "0.55878216", "0.5578079...
0.7037793
0
DELETE /dispatch_centers/1 DELETE /dispatch_centers/1.xml
def destroy @dispatch_center = DispatchCenter.find(params[:id]) @dispatch_center.destroy respond_to do |format| format.html { redirect_to(dispatch_centers_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @center = Center.find(params[:id])\n @center.destroy\n\n respond_to do |format|\n format.html { redirect_to(centers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @service_center = ServiceCenter.find(params[:id])\n @service_center.destroy\n\n respond_...
[ "0.72351", "0.6988861", "0.68586475", "0.68506163", "0.67045426", "0.6592895", "0.6530373", "0.6520233", "0.64987165", "0.64822644", "0.64394945", "0.6397145", "0.6396157", "0.6373137", "0.63707334", "0.6351882", "0.63434654", "0.63048303", "0.6297795", "0.62902886", "0.62732...
0.77294594
0
Determine if this client is equivalent to another object.
def ==(other) return false unless other.is_a?(Client) cluster == other.cluster && options == other.options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equivalent?(other)\n Equivalence.new.call(self, other)\n end", "def mirrors?(other)\n @reflectee == other\n end", "def equal?(other)\n object_id == other.object_id\n end", "def eql?(other)\n self.class == other.class && self.id == other.id\n end", "def ==(object)\n ...
[ "0.7196497", "0.675601", "0.6535049", "0.6518412", "0.6483975", "0.64515424", "0.6425511", "0.63823617", "0.6377798", "0.6346929", "0.63450915", "0.6342167", "0.634116", "0.63333565", "0.6331473", "0.6329495", "0.6329052", "0.6318687", "0.63112223", "0.6307041", "0.629391", ...
0.6961853
1
Get the server (read) preference from the options passed to the client.
def server_preference @server_preference ||= ServerPreference.get(options[:read] || {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_preference\n @read_preference ||= options[:read] || database.read_preference\n end", "def read_preference\n @read_preference ||= options[:read]\n end", "def server_selector\n @server_selector ||= if read_preference\n ServerSelector.get(read_preference)\n else\n ...
[ "0.6836205", "0.678192", "0.6751006", "0.6545461", "0.5947082", "0.5904837", "0.58938175", "0.5884847", "0.585203", "0.58283204", "0.58134687", "0.5719111", "0.56811833", "0.565076", "0.5614311", "0.5570222", "0.55688727", "0.5537564", "0.5532699", "0.54858243", "0.54555", ...
0.83870417
0
Use the database with the provided name. This will switch the current database the client is operating on.
def use(name) with(database: name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def database! name\n create_db(name) rescue nil\n database name\n end", "def set_database_name(name)\n @database_name = name\n end", "def database(name)\n Database.new(connection.db(name))\n end", "def database(name)\n Database.new(self, name)\n end", "def selec...
[ "0.7859886", "0.78089136", "0.7731592", "0.7683725", "0.76661235", "0.7544625", "0.74049073", "0.7380541", "0.73653585", "0.7224781", "0.72019106", "0.71643466", "0.70185643", "0.70160216", "0.697522", "0.69529736", "0.69526947", "0.680314", "0.67630607", "0.6757698", "0.6671...
0.84162027
1
Get the write concern for this client. If no option was provided, then a default single server acknowledgement will be used.
def write_concern @write_concern ||= WriteConcern::Mode.get(options[:write]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_concern\n @write_concern ||= WriteConcern.get(options[:write_concern] || options[:write])\n end", "def write_concern\n @write_concern ||= WriteConcern.get(\n options[:write_concern] || options[:write] || database.write_concern)\n end", "def write_concern_with_session(session)\n...
[ "0.7209247", "0.69880813", "0.6108984", "0.57374805", "0.51983577", "0.51647824", "0.4981999", "0.49798116", "0.49613383", "0.49549782", "0.4871449", "0.47559345", "0.47559345", "0.47077486", "0.47043926", "0.46636373", "0.46496373", "0.455185", "0.45473236", "0.4399612", "0....
0.74415797
0
a function that is used to parse Ansible (static) inventory files and return a list of the node addresses contained in the file
def addr_list_from_inventory_file(inventory_file, group_name) inventory_str = `./common-utils/inventory/static/hostsfile.py --filename #{inventory_file} --list` inventory_json = JSON.parse(inventory_str) inventory_group = inventory_json[group_name] # if we found a corresponding group in the inventory file, then...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getnodes\n nodes = []\n\n pattern = @netip.split('.')[0..-2] * '.'\n File.open('Vagrantfile', 'r'){|f|\n f.readlines.each{|x|\n if x =~ /#{pattern}.*/\n nodes << Node.new(x[/k8snode[\\d]+/], x[/#{pattern}\\.\\d+/])\n end\n }\n }\n\n return nodes\n end", "def i...
[ "0.7040412", "0.6463522", "0.6218813", "0.6065604", "0.5986418", "0.5923239", "0.5923239", "0.5921096", "0.5906057", "0.5894592", "0.5871605", "0.5750625", "0.574349", "0.5731749", "0.56868035", "0.56649286", "0.5657564", "0.563348", "0.56105644", "0.5597737", "0.55821246", ...
0.7426334
0
Get the details for a network zone ==== Params +id+ ID of the network zone
def show(id) response = request(:get, "/network_zones/#{id}.json") response['network_group'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zone(zone_id:)\n raise('zone_id required') if zone_id.nil?\n cf_get(path: \"/zones/#{zone_id}\")\n end", "def network_zones(id)\n response = request(:get, \"/users/#{id}/network_zones.json\")\n response.collect { |vm| vm['network_group']}\n end", "def zones(id:)\n id_check(:id,...
[ "0.7559391", "0.7097195", "0.70327365", "0.68887943", "0.6858956", "0.6763142", "0.673631", "0.66097224", "0.6589807", "0.65793556", "0.65641904", "0.6550512", "0.6500038", "0.64395636", "0.6384636", "0.63510615", "0.62301004", "0.6155691", "0.6142811", "0.6141511", "0.611931...
0.76987857
0
Updates an existing network zone ==== Params +id+ ID of the network zone ==== Options See create
def edit(id, options = {}) response = request(:put, "/network_zones/#{id}.json", :query => {:pack => options}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @zone = Zone.find(params[:id])\n\n if @zone.update(zone_params)\n head :no_content\n else\n render json: @zone.errors, status: :unprocessable_entity\n end\n end", "def edit(id, options = {})\n response = request(:put, \"/settings/hypervisor_zones/#{id}.json\", :query => {...
[ "0.6465887", "0.6447762", "0.6357722", "0.6245741", "0.62009454", "0.62009454", "0.61669916", "0.6143282", "0.6072672", "0.60281944", "0.5999448", "0.5963972", "0.59435433", "0.5908492", "0.5895068", "0.5885043", "0.5866421", "0.585819", "0.5821506", "0.580896", "0.5799495", ...
0.79180765
0
Creates a new network zone ==== Options +label+ Label for the network zone
def create(options = {}) response = request(:post, "/network_zones.json", :query => {:pack => options}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zone_create(zone)\n obj_create zone, Zone\n end", "def create_zone(zone, email, ttl)\n @dnsh.name = zone\n @dnsh.email = email\n @dnsh.ttl = ttl\n if @dnsh.save == true\n Puppet.notice \"Created dns zone #{zone} with id #{@dnsh.id}\"\n else\n Pu...
[ "0.71132547", "0.7047148", "0.6910698", "0.6368361", "0.6252676", "0.62120885", "0.6138369", "0.6073044", "0.6071505", "0.6036517", "0.590282", "0.5875413", "0.58358455", "0.5789455", "0.5769937", "0.5732169", "0.5720855", "0.5717624", "0.56605834", "0.5614373", "0.56091607",...
0.73892057
0
Deletes an existing network zone ==== Params +id+ ID of the network zone
def delete(id) request(:delete, "/network_zones/#{id}.json") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_zone(zone_id:)\n raise('zone_id required') if zone_id.nil?\n cf_delete(path: \"/zones/#{zone_id}\")\n end", "def delete(id)\n request(:delete, \"/settings/hypervisor_zones/#{id}.json\")\n end", "def delete_network(id)\n fog_service_interface.delete_network(id)\n end"...
[ "0.7541095", "0.7183168", "0.69939375", "0.6990932", "0.69053024", "0.68769467", "0.666311", "0.66390485", "0.6633653", "0.66258705", "0.65638065", "0.65636617", "0.6479598", "0.6469901", "0.64551926", "0.6452728", "0.6423707", "0.6340636", "0.6339031", "0.63165665", "0.62747...
0.8786102
0
Attach a network to a network zone ==== Params +id+ ID of the network zone +network_id+ ID of the network
def attach(id, network_id) request(:post, "/network_zones/#{id}/networks/#{network_id}/attach.json") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attach(id, cidr)\n self.execute(['--local', 'attach', cidr, '--rewrite-hosts', id])\n end", "def create(network_id, options = {})\n response = request(:post, \"/settings/networks/#{network_id}/ip_addresses.json\", default_params(options))\n end", "def add_network_join(id, options={})\n ...
[ "0.64135563", "0.6358463", "0.6337561", "0.6308971", "0.62770265", "0.6262553", "0.62025", "0.62025", "0.62025", "0.62025", "0.62025", "0.6127523", "0.6092302", "0.6072843", "0.5939301", "0.5835274", "0.5826959", "0.5647974", "0.5607485", "0.55898494", "0.5559122", "0.55316...
0.88454556
0
Detach a network from a network zone ==== Params +id+ ID of the network zone +network_id+ ID of the network
def detach(id, network_id) request(:post, "/network_zones/#{id}/networks/#{network_id}/detach.json") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_network(id)\n fog_service_interface.delete_network(id)\n end", "def detach_network \r\n new_network_id = AlnNetworkId.get_network_id \r\n self.reassign_network_id(new_network_id)\r\n self.reload\r\n self.reassign_layer_id_for_network(new_network_id)\r\n self.reload\r\n end"...
[ "0.744156", "0.7151775", "0.7125424", "0.68789965", "0.68622535", "0.65824467", "0.65456444", "0.64852697", "0.64671755", "0.6450227", "0.6379039", "0.62736326", "0.61701393", "0.59244305", "0.5846351", "0.5843411", "0.581569", "0.5779734", "0.5775674", "0.5753899", "0.570044...
0.87686694
0
Group events by the pod name, and sort them by ending time (using the pod name as a tiebreaker).
def sort_events(all_events) all_events.group_by(&:pod).sort_by { |name, ev| [ev.last.stamp, name] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort\n\t@events = @events.sort_by { | e | e.time_from_start }\n\trecalc_delta_from_times()\n end", "def sort_events(events)\n events.sort_by { |e| e['time'] }.reverse\nend", "def sorted_events\n events.sort\n end", "def sort()\n\t\t@events = @events.sort do |a,b| a[0] <=> b[0] end\n\tend", "def...
[ "0.6450023", "0.64218676", "0.6054177", "0.5982262", "0.5952469", "0.57882947", "0.56774515", "0.56090003", "0.5592402", "0.55397546", "0.5516508", "0.55110735", "0.5489896", "0.53761685", "0.525416", "0.52254856", "0.5180252", "0.5123798", "0.5114709", "0.5111422", "0.506556...
0.8043609
0
Emit some text at the given position (given as the topleft corner).
def etext(text, x_pos, y_pos) puts %( <text x='#{x_pos}' y='#{y_pos}' style='dominant-baseline: text-before-edge;' >#{text}</text> ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_text(loc, txt, font)\n pt = pixel_top_left(loc[:x], loc[:y])\n horiz_adjust = (@box_side_length - font.text_width(\"#{txt}\")) / 2\n vert_adjust = (@box_side_length - font.height) / 2\n font.draw(\"#{txt}\", pt.right(horiz_adjust)[:x], pt.down(vert_adjust)[:y], 0, 1, 1, BLACK)\n end", "def ...
[ "0.69017655", "0.6628188", "0.6548486", "0.65250504", "0.65103406", "0.64742523", "0.6380802", "0.6338761", "0.6325639", "0.6314755", "0.6310091", "0.6292433", "0.6288278", "0.62556297", "0.625267", "0.62215", "0.61936414", "0.61751854", "0.61626524", "0.61613953", "0.6157848...
0.6928004
0
Emit the SVG file trailer
def etail puts '</svg>' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_graph_svg_data machine, opts = { }\n require 'tempfile'\n tmp = Tempfile.new(\"red_steak_dot\")\n self.file_dot = tmp.path + \".dot\"\n self.file_svg = nil\n render_graph(machine, opts)\n result = File.open(self.file_svg, \"r\") { | fh | fh.read }\n if opts[:xml_header...
[ "0.61761135", "0.61258435", "0.595413", "0.58250034", "0.5808175", "0.5785009", "0.57274246", "0.57186925", "0.5699109", "0.56769013", "0.5656624", "0.5628523", "0.56263137", "0.56084377", "0.551963", "0.53627783", "0.5334121", "0.524606", "0.5238387", "0.5232532", "0.5186103...
0.6660486
0
ebox emits a box at (x, y)+(width, height) with color based on the text
def ebox(text:, x_pos:, y_pos:, width:, height:, title: '') puts %( <rect x="#{x_pos}" y="#{y_pos}" width="#{width}" height="#{height}" style="fill: #{color text}; stroke: black;"> <title>#{title}</title> </rect> ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def colored_box(box_text, options={})\n options = { :fill_color => DARK_GRAY,\n :stroke_color => nil,\n :text_color => LIGHT_GRAY,\n :leading => LEADING\n }.merge(options)\n\n \n text_options = { :leading => options[:leading], \n :fallback_fon...
[ "0.6985783", "0.68559563", "0.66020274", "0.65095896", "0.6433853", "0.64225775", "0.63954383", "0.63712126", "0.63699436", "0.628927", "0.6224694", "0.6175934", "0.6105177", "0.6095429", "0.6090629", "0.60746986", "0.60658604", "0.6048457", "0.60342574", "0.60062593", "0.600...
0.7904676
0
Opens a new port on the local host and forwards it to the given host/port via the gateway host. If a block is given, the newly allocated port number will be yielded to the block, and the port automatically closed (see close) when the block finishes. Otherwise, the port number will be returned, and the caller is respons...
def open(host, port, local_port=nil) ensure_open! actual_local_port = local_port || next_port @session_mutex.synchronize do @session.forward.local(actual_local_port, host, port) end if block_given? begin yield actual_local_port ensure close(actual_local_port) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local(*args)\n if args.length < 3 || args.length > 4\n raise ArgumentError, \"expected 3 or 4 parameters, got #{args.length}\"\n end\n\n local_port_type = :long\n\n socket = begin\n if defined?(UNIXServer) and args.first.class == UNIXServer\n ...
[ "0.62808645", "0.6058165", "0.5987452", "0.59837663", "0.58592266", "0.5817312", "0.5733969", "0.5697772", "0.5674667", "0.56717825", "0.5651453", "0.56072724", "0.55296034", "0.54183203", "0.5388935", "0.537928", "0.5374899", "0.53684586", "0.53510666", "0.53470457", "0.5315...
0.8142555
0