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
Test the remove_from_parent! method.
def test_remove_from_parent_bang setup_test_tree assert(@root.has_children?, "Should have children") assert(!@root.is_leaf?, "Root is not a leaf here") child1 = @root[0] assert_not_nil(child1, "Child 1 should exist") assert_same(@root, child1.root, "Child 1's root should be ROOT") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeFromParent\n @parent.remove(self) if @parent\n end", "def remove_parent\n # has to go from parent to child\n self.parent.remove_child(self)\n end", "def remove_parent(selector); end", "def remove_from_parent\n @change_set = ChangeSet.for(resource)\n parent_resource = find...
[ "0.7715611", "0.7382604", "0.7307142", "0.68450654", "0.68401265", "0.6837654", "0.6741294", "0.66547126", "0.6604148", "0.6529854", "0.6482111", "0.6477159", "0.64689726", "0.6445911", "0.64372575", "0.63909924", "0.63823104", "0.6352334", "0.63177717", "0.6310191", "0.62356...
0.7794357
0
Test the first_child method.
def test_first_child setup_test_tree assert_equal(@child1, @root.first_child, "Root's first child is Child1") assert_nil(@child1.first_child, "Child1 does not have any children") assert_equal(@child4, @child3.first_child, "Child3's first child is Child4") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_first_sibling\n setup_test_tree\n\n # TODO: Need to fix the first_sibling method to return nil for nodes with no siblings.\n assert_same(@root, @root.first_sibling, \"Root's first sibling is itself\")\n assert_same(@child1, @child1.first_sibling, \"Child1's first sibling is itself\")\n...
[ "0.7982242", "0.77640253", "0.77415323", "0.73569846", "0.73472583", "0.72539914", "0.6833663", "0.677806", "0.67485505", "0.67452073", "0.6468998", "0.64033115", "0.6375613", "0.6367125", "0.62516266", "0.61623526", "0.61593854", "0.60892355", "0.60821503", "0.60335475", "0....
0.85284865
0
Test the last_child method.
def test_last_child setup_test_tree assert_equal(@child3, @root.last_child, "Root's last child is Child3") assert_nil(@child1.last_child, "Child1 does not have any children") assert_equal(@child4, @child3.last_child, "Child3's last child is Child4") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_last_sibling\n setup_test_tree\n\n assert_same(@root, @root.last_sibling, \"Root's last sibling is itself\")\n assert_same(@child3, @child1.last_sibling, \"Child1's last sibling should be child3\")\n assert_same(@child3, @child2.last_sibling, \"Child2's last sibling should be child3\")...
[ "0.8076884", "0.77156967", "0.7451575", "0.7406189", "0.73204654", "0.69250536", "0.67753804", "0.6684065", "0.66303384", "0.6609797", "0.6565042", "0.6476528", "0.6403612", "0.639643", "0.6366839", "0.6366839", "0.6366839", "0.63501596", "0.632775", "0.632775", "0.6220421", ...
0.8650782
0
Test the each_leaf method.
def test_each_leaf setup_test_tree nodes = [] @root.each_leaf { |node| nodes << node } assert_equal(3, nodes.length, "Should have THREE LEAF NODES") assert(!nodes.include?(@root), "Should not have root") assert(nodes.include?(@child1), "Should have child 1") assert(nodes.incl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_leaf!\n raise \"Method not yet written.\"\n\n self.each do |leaf|\n yield(leaf)\n end\n end", "def each_leaf(&block)\n each_leaf_node([], @root, block)\n end", "def each_leaf#:yields: leaf\n leafs.compact!\n \n leafs.each do |leaf|\n yield leaf\n e...
[ "0.80726945", "0.7618389", "0.75051165", "0.73378736", "0.72592145", "0.72518724", "0.72058684", "0.7045499", "0.7045499", "0.6691756", "0.6641135", "0.6595139", "0.6587919", "0.6518978", "0.6484925", "0.6477158", "0.64397836", "0.6378181", "0.6264441", "0.6232343", "0.620719...
0.7992356
1
Test the print_tree method.
def test_print_tree setup_test_tree #puts #@root.print_tree end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_tree\n ''\n end", "def print_tree\n if root.children\n puts \" - root : #{root.children.length} - \"\n root.children.each(&:print_node)\n puts ''\n end\n end", "def printTree(options = {})\n # Set defaults\n options[:name] ||= true\n options[:content] ||= false\n ...
[ "0.7902457", "0.7844856", "0.76276535", "0.76085335", "0.7580548", "0.75174874", "0.73933315", "0.7332164", "0.7263764", "0.72026175", "0.71303356", "0.71237785", "0.71031094", "0.7033289", "0.70139384", "0.69903165", "0.6978808", "0.69728065", "0.69462276", "0.67919517", "0....
0.9064362
0
Tests the binary dumping mechanism with an Object content node
def test_marshal_dump # Setup Test Data test_root = Tree::TreeNode.new("ROOT", "Root Node") test_content = {"KEY1" => "Value1", "KEY2" => "Value2" } test_child = Tree::TreeNode.new("Child", test_content) test_content2 = ["AValue1", "AValue2", "AValue3"] test_grand_child = Tree::...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_be_fully_dumped?(object)\n begin\n Marshal.dump(object)\n true\n rescue TypeError, IOError\n false\n end\n end", "def dump(object)\n raise NotImplementedError, \"#{self.class} must implement #dump\"\n end", "def structure_dump() end", "def marshal_dump; end", "def _...
[ "0.6263297", "0.61053145", "0.6102183", "0.6070473", "0.6068636", "0.606498", "0.6060673", "0.603301", "0.60080266", "0.5982621", "0.5982621", "0.59586066", "0.5907594", "0.58899474", "0.58816576", "0.5851618", "0.58489805", "0.58051205", "0.5704244", "0.57041013", "0.5695208...
0.6296182
0
Test freezing the tree
def test_freeze_tree_bang setup_test_tree @root.content = "ABC" assert_equal("ABC", @root.content, "Content should be 'ABC'") @root.freeze_tree! # Note: The error raised here depends on the Ruby version. # For Ruby > 1.9, RuntimeError is raised # For Ruby ~ 1.8, TypeError is r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cheap_wait; end", "def test_should_block_recursion_in_tree\n group = Group.find @greeks_group.id\n\n assert_raises(RecursionInTree) { group.parent = Group.find @cretes_group.id }\n end", "def test_save_tree\n end", "def test_cyclic\n end", "def test_breadth_each\n j = Tree::TreeNode.new(\...
[ "0.5896011", "0.5835977", "0.5793127", "0.56592774", "0.5588644", "0.5534555", "0.55041546", "0.5460143", "0.54390097", "0.5420358", "0.54201794", "0.54101765", "0.5403881", "0.5403881", "0.53922224", "0.5389457", "0.5378399", "0.5378399", "0.5378399", "0.5332773", "0.5303974...
0.7029016
0
Run the assertions for the deprecated depth method.
def do_deprecated_depth assert_equal(1, @root.depth, "A single node's depth is 1") @root << @child1 assert_equal(2, @root.depth, "This should be of depth 2") @root << @child2 assert_equal(2, @root.depth, "This should be of depth 2") @child2 << @child3 assert_equal(3, @root.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_depth\n begin\n require 'structured_warnings'\n assert_warn(DeprecatedMethodWarning) { do_deprecated_depth }\n rescue LoadError\n # Since the structued_warnings package is not present, we revert to good old Kernel#warn behavior.\n do_deprecated_depth\n end\n e...
[ "0.77921015", "0.55722946", "0.5520603", "0.54864395", "0.5477407", "0.5471653", "0.54617983", "0.5444409", "0.54002744", "0.5350991", "0.5350007", "0.53381425", "0.5314139", "0.5314139", "0.52814263", "0.5274706", "0.5245313", "0.5232082", "0.5204234", "0.5113039", "0.508011...
0.72621274
1
Test the depth computation algorithm. Note that this is the correct depth computation. The original Tree::TreeNodedepth was incorrectly computing the height of the node instead of its depth.
def test_node_depth assert_equal(0, @root.node_depth, "A root node's depth is 0") setup_test_tree for child in [@child1, @child2, @child3] assert_equal(1, child.node_depth, "Node #{child.name} should have depth 1") end assert_equal(2, @child4.node_depth, "Child 4 should have dep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_depth_of_method\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n tree.insert(45, \"movie b\")\n tree.insert(40, \"movie c\")\n tree.insert(35, \"movie d\")\n assert_equal 3, tree.depth_of(35)\n end", "def depth\n if empty?\n 0\n else\n if @left==nil || @r...
[ "0.6864693", "0.6757938", "0.6713219", "0.6686807", "0.6681568", "0.6674517", "0.65427613", "0.6526818", "0.65262014", "0.6513792", "0.64473724", "0.64045507", "0.63973296", "0.6364339", "0.6276778", "0.6271265", "0.6258746", "0.62341547", "0.6209124", "0.6202515", "0.6086186...
0.74402314
0
Test the level method. Since this is an alias of node_depth, we just test for equivalence
def test_level assert_equal(0, @root.level, "A root node's level is 0") assert_equal(@root.node_depth, @root.level, "Level and depth should be the same") setup_test_tree for child in [@child1, @child2, @child3] assert_equal(1, child.level, "Node #{child.name} should have level 1") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_depth_two_levels\n @tree.insert(\"a\")\n @tree.insert(\"b\")\n assert_equal 1, @tree.depth_of?(\"b\")\n end", "def test_node_depth\n assert_equal(0, @root.node_depth, \"A root node's depth is 0\")\n\n setup_test_tree\n\n for child in [@child1, @child2, @child3]\n assert_e...
[ "0.6713321", "0.64925057", "0.64134645", "0.63959444", "0.63704574", "0.63364893", "0.6289961", "0.62431514", "0.6223875", "0.6188657", "0.6180239", "0.61747295", "0.61284477", "0.6109462", "0.6109462", "0.6109462", "0.6109462", "0.6109462", "0.6109462", "0.6109397", "0.61064...
0.74802727
0
Test the breadth computation algorithm
def test_breadth assert_equal(1, @root.breadth, "A single node's breadth is 1") @root << @child1 assert_equal(1, @root.breadth, "This should be of breadth 1") @root << @child2 assert_equal(2, @child1.breadth, "This should be of breadth 2") assert_equal(2, @child2.breadth, "This sho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_breadth_each\n j = Tree::TreeNode.new(\"j\")\n f = Tree::TreeNode.new(\"f\")\n k = Tree::TreeNode.new(\"k\")\n a = Tree::TreeNode.new(\"a\")\n d = Tree::TreeNode.new(\"d\")\n h = Tree::TreeNode.new(\"h\")\n z = Tree::TreeNode.new(\"z\")\n\n # The expected order of r...
[ "0.6748863", "0.6638496", "0.6524973", "0.64008266", "0.6240808", "0.62361646", "0.6219844", "0.6144744", "0.61364985", "0.61242646", "0.60998636", "0.6016119", "0.60131943", "0.60131943", "0.60131943", "0.60131943", "0.60131943", "0.60131943", "0.60131943", "0.60131943", "0....
0.66878647
1
Test the breadth for each
def test_breadth_each j = Tree::TreeNode.new("j") f = Tree::TreeNode.new("f") k = Tree::TreeNode.new("k") a = Tree::TreeNode.new("a") d = Tree::TreeNode.new("d") h = Tree::TreeNode.new("h") z = Tree::TreeNode.new("z") # The expected order of response expected_array...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_breadth\n assert_equal(1, @root.breadth, \"A single node's breadth is 1\")\n\n @root << @child1\n assert_equal(1, @root.breadth, \"This should be of breadth 1\")\n\n @root << @child2\n assert_equal(2, @child1.breadth, \"This should be of breadth 2\")\n assert_equal(2, @child2...
[ "0.68890536", "0.6702945", "0.64721006", "0.6361148", "0.619658", "0.6179271", "0.6152221", "0.61176646", "0.6109527", "0.6078409", "0.6042431", "0.604147", "0.6034782", "0.60049886", "0.5931217", "0.59139794", "0.5910914", "0.5906268", "0.5904258", "0.5873253", "0.58702934",...
0.7331208
0
Test the preordered_each method.
def test_preordered_each j = Tree::TreeNode.new("j") f = Tree::TreeNode.new("f") k = Tree::TreeNode.new("k") a = Tree::TreeNode.new("a") d = Tree::TreeNode.new("d") h = Tree::TreeNode.new("h") z = Tree::TreeNode.new("z") # The expected order of response expected_ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(&block)\n\t\t\t@ordered.each(&block)\n\t\tend", "def each(&block)\n @ordered_elements.each(&block)\n end", "def each order=:preorder, &block\n # I know, I know. SGF is only preorder. Well, it's implemented, ain't it?\n # Stop complaining.\n case order\n when :preorder\n ...
[ "0.64636976", "0.644502", "0.6233939", "0.60754436", "0.59109217", "0.5780458", "0.5622207", "0.55871916", "0.5566852", "0.55113477", "0.55030495", "0.54603636", "0.5453088", "0.53986776", "0.53867394", "0.5367764", "0.5332064", "0.53297645", "0.531629", "0.5304872", "0.52816...
0.7615955
0
test the detached_copy method.
def test_detached_copy setup_test_tree assert(@root.has_children?, "The root should have children") copy_of_root = @root.detached_copy assert(!copy_of_root.has_children?, "The copy should not have children") assert_equal(@root.name, copy_of_root.name, "The names should be equal") #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_detached_subtree_copy\n setup_test_tree\n\n assert(@root.has_children?, \"The root should have children.\")\n tree_copy = @root.detached_subtree_copy\n\n assert_equal(@root.name, tree_copy.name, \"The names should be equal.\")\n assert_not_equal(@root.object_id, tree_copy.object_i...
[ "0.700882", "0.6117217", "0.5791448", "0.55092436", "0.54721403", "0.53427446", "0.5323102", "0.53072613", "0.5289093", "0.5273171", "0.5242975", "0.5192002", "0.5188811", "0.51586384", "0.5153594", "0.51498854", "0.51441985", "0.5126331", "0.5114862", "0.5114246", "0.5114246...
0.7740094
0
Test the detached_subtree_copy method.
def test_detached_subtree_copy setup_test_tree assert(@root.has_children?, "The root should have children.") tree_copy = @root.detached_subtree_copy assert_equal(@root.name, tree_copy.name, "The names should be equal.") assert_not_equal(@root.object_id, tree_copy.object_id, "Object_ids s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_detached_copy\n setup_test_tree\n\n assert(@root.has_children?, \"The root should have children\")\n copy_of_root = @root.detached_copy\n assert(!copy_of_root.has_children?, \"The copy should not have children\")\n assert_equal(@root.name, copy_of_root.name, \"The names should be ...
[ "0.8262548", "0.55862147", "0.55859387", "0.5510041", "0.5429278", "0.54041034", "0.5393935", "0.51875526", "0.5151589", "0.5133615", "0.51270664", "0.5110476", "0.5052661", "0.5042424", "0.50371915", "0.50181377", "0.5002533", "0.5002492", "0.4940325", "0.49332863", "0.49327...
0.8244235
1
Test the is_root? method.
def test_is_root_eh setup_test_tree assert(@root.is_root?, "The ROOT node must respond as the root node") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_root?\n false\n end", "def root?\n root == self\n end", "def has_root?\n @root != nil\n end", "def root?\n root\n end", "def root?\n true\n end", "def root?\n true\n end", "def root?\n true\n end", "def is_root?\n \troot == id\n end", ...
[ "0.82637626", "0.81894755", "0.8150901", "0.81488985", "0.805424", "0.8050058", "0.8050058", "0.8029191", "0.7975747", "0.7963455", "0.7958967", "0.7940238", "0.77978915", "0.7666345", "0.76224166", "0.7549867", "0.7534729", "0.7499187", "0.7497382", "0.7497382", "0.7478093",...
0.83728653
0
Test the in_degree method.
def test_in_degree setup_test_tree assert_equal(0, @root.in_degree, "Root's in-degree should be zero") assert_equal(1, @child1.in_degree, "Child 1's in-degree should be 1") assert_equal(1, @child2.in_degree, "Child 2's in-degree should be 1") assert_equal(1, @child3.in_degree, "Child 3's ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def degree(v) in_degree(v); end", "def in_degree(vertex)\n\tend", "def degree\n self.in_degree + self.out_degree\n end", "def test_out_degree\n setup_test_tree\n\n assert_equal(3, @root.out_degree, \"Root's out-degree should be 3\")\n assert_equal(0, @child1.out_degree, \"Child 1's out-...
[ "0.7368912", "0.6845612", "0.6654296", "0.6463978", "0.63506055", "0.61380655", "0.6129609", "0.6096297", "0.609111", "0.6089261", "0.60667974", "0.59744346", "0.59245294", "0.58623236", "0.58312917", "0.58229214", "0.58207643", "0.57796717", "0.5744778", "0.56702095", "0.564...
0.7744613
0
Test the out_degree method.
def test_out_degree setup_test_tree assert_equal(3, @root.out_degree, "Root's out-degree should be 3") assert_equal(0, @child1.out_degree, "Child 1's out-degree should be 0") assert_equal(0, @child2.out_degree, "Child 2's out-degree should be 0") assert_equal(1, @child3.out_degree, "Child...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def degree\n self.in_degree + self.out_degree\n end", "def out_degree(vertex)\n\tend", "def out_degree\n @out_edges.length\n end", "def out_degree(v)\n r = 0\n each_adjacent(v) { |u| r += 1 }\n r\n end", "def out_degree(node)\n @adj[node].length\n end", "def out_degree(n...
[ "0.6726331", "0.67059845", "0.6697559", "0.65575594", "0.653462", "0.6340498", "0.6224677", "0.61898947", "0.60682994", "0.60337806", "0.6027786", "0.597832", "0.5760423", "0.5600363", "0.5587584", "0.5559842", "0.5537469", "0.54718786", "0.54524803", "0.5435376", "0.5410193"...
0.780635
0
Test usage of integers as node names
def test_integer_node_names require 'structured_warnings' assert_warn(StandardWarning) do @n_root = Tree::TreeNode.new(0, "Root Node") @n_child1 = Tree::TreeNode.new(1, "Child Node 1") @n_child2 = Tree::TreeNode.new(2, "Child Node 2") @n_child3 = Tree::TreeNode.new("three", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodetype2num(x)\n @nodetypes.find_index(x)\nend", "def visit_node(n); end", "def gen_node_key(num)\n \"node#{num}\".to_sym\nend", "def test_access_feature_name\n assert_equal 'krung go', @one_to_nine.child_node.name\n assert_equal 'ཀྲུང་གོ', @one_to_nine.parent_node.name\n end", "def test_acce...
[ "0.5880383", "0.57831836", "0.576323", "0.5723512", "0.5706851", "0.54743654", "0.5442897", "0.54287714", "0.53955", "0.53803945", "0.53787047", "0.5362258", "0.5346841", "0.5346841", "0.53371245", "0.533357", "0.533357", "0.5321807", "0.52802956", "0.5262876", "0.526039", ...
0.75187016
0
Test the addition of a node to itself as a child
def test_add_node_to_self_as_child root = Tree::TreeNode.new("root") # Lets check the direct parentage scenario assert_raise(ArgumentError) {root << root} # And now a scenario where the node addition is done down the hierarchy # @todo This scenario is not yet fixed. child = Tree:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def just_add_child(node)\n return if @children.member?(node)\n @children << node\n node.parent = self\n update_boxes \n end", "def add(child); end", "def child_node; end", "def test_add\n assert(!@root.has_children?, \"Should not have any children\")\n\n assert_equal(1, @root.size, ...
[ "0.74029994", "0.72090757", "0.69931376", "0.69070613", "0.686713", "0.6851359", "0.6851359", "0.6785406", "0.67298084", "0.6728562", "0.6685328", "0.6662659", "0.6607456", "0.65953904", "0.6593382", "0.65564173", "0.65564173", "0.65564173", "0.652232", "0.6496561", "0.647320...
0.74339324
0
STEPS: 1. login on turtle using facebook account 2. search for listing 3. upload image to listing 4. check image 5. hide image
def test_fb_sign_up_and_upload_monkey_image # Step 1 @user.email = @fb_user['email'] login_fb_user!(@fb_user, @user) # Step 2 assign_http(Config["panda"]["host"]) opts = { 'vrid' => @user.vrid } get_consumer_search_resp('ramen', 'glendale, ca', opts) assert_response(@response, :succes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def atest_ID_25836_edit_profile_pic_03\n login_as_user1\n go_to_edit_profile_page\n verify_user_able_to_close_photo_upload_dialog\n end", "def uploading_pictures\n end", "def atest_ID_25836_edit_profile_pic_02\n login_as_user1\n go_to_edit_profile_page\n verify_unable_to_upload_non_image_fi...
[ "0.5973723", "0.5827267", "0.58178514", "0.58116597", "0.5743193", "0.57244116", "0.5716951", "0.5665135", "0.56402797", "0.5595061", "0.558402", "0.5533642", "0.55262864", "0.55206966", "0.551238", "0.5486385", "0.5484302", "0.5481954", "0.5470436", "0.5465468", "0.5462275",...
0.5998476
0
Returns the list of partition types supported by the Device
def partition_types_ext ptr1 = MemoryPointer::new( :size_t, 1) error = OpenCL.clGetDeviceInfo(self, PARTITION_TYPES_EXT, 0, nil, ptr1) error_check(error) ptr2 = MemoryPointer::new( ptr1.read_size_t ) error = OpenCL.clGetDeviceInfo(self, PARTITION_TYPES_EXT, ptr1.read_size_t, ptr2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_partitions_with_size_and_type # by nelsongs. => list: partition size type\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\") print $1\":\"$5\":\"$6;else print $1\":\"$4\":\"$5}' | sed s/+//g`.split\nend", "def list_partitions #by nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk...
[ "0.7248117", "0.63458914", "0.62699544", "0.6232824", "0.61675614", "0.6139866", "0.60773873", "0.6015134", "0.59679866", "0.59332496", "0.58867615", "0.5861007", "0.58582693", "0.58413965", "0.5800998", "0.5777511", "0.5731578", "0.56630963", "0.56233054", "0.56147826", "0.5...
0.75209886
0
Returns the parent Device if it exists
def parent_device_ext ptr = MemoryPointer::new( Device ) error = OpenCL.clGetDeviceInfo(self, PARENT_DEVICE_EXT, Device.size, ptr, nil) error_check(error) return nil if ptr.null? return Device::new(ptr.read_pointer) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_whole_disk\n Device.new('/dev/' + self['ParentWholeDisk'])\n end", "def parent_object\n if has_parent?\n actual_class = parent_class_name.camelize.constantize\n actual_class.find(parent_id)\n else\n nil\n end\n end", "def get_parent child_path\n parent_maj_min =...
[ "0.69526756", "0.6830269", "0.6823165", "0.67923945", "0.6683053", "0.6677846", "0.666579", "0.6550104", "0.6542374", "0.64039856", "0.637274", "0.6357295", "0.6278255", "0.62720096", "0.62618977", "0.6219054", "0.6180903", "0.6165943", "0.6160411", "0.61377126", "0.612947", ...
0.6999914
0
Emit the CSS classes for inclusion in the '' element definition.
def emit_page_classes @page_classes ||= default_page_classes @page_classes.flatten! @page_classes.compact_blank! @page_classes.map! { |c| c.to_s.gsub(/[^a-z_0-9-]/i, '_') } @page_classes.uniq! @page_classes.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def css_classes\n classes= [\"row\"]\n unless @element.content_by_name(:classi_css).essence.body.nil?\n classes << @element.content_by_name(:classi_css).essence.body\n end\n classes #todo estrapolare valori da options\n end", "def comp_class\n @xml += '<class> '\n while @i < ...
[ "0.6809233", "0.6532971", "0.6450472", "0.6357284", "0.63551396", "0.6306282", "0.6257774", "0.619884", "0.6198387", "0.6197295", "0.61258864", "0.61211944", "0.611239", "0.611239", "0.60921395", "0.6091575", "0.6088885", "0.60771734", "0.6056501", "0.6045831", "0.60227454", ...
0.65412295
1
GET /euclid_users/1 GET /euclid_users/1.json
def show @euclid_user = EuclidUser.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @euclid_user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response ...
[ "0.6822484", "0.6801907", "0.65722764", "0.6542782", "0.64431804", "0.6437672", "0.6422124", "0.64149046", "0.6385286", "0.63612884", "0.6361115", "0.6361115", "0.63608205", "0.63596237", "0.63580936", "0.6351446", "0.635084", "0.6350172", "0.6340591", "0.6300943", "0.6299135...
0.7289374
0
GET /euclid_users/new GET /euclid_users/new.json
def new @euclid_user = EuclidUser.new respond_to do |format| format.html # new.html.erb format.json { render json: @euclid_user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "def new\n @user = user.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n ...
[ "0.7714887", "0.77041", "0.7681287", "0.7508355", "0.7479379", "0.7457338", "0.74127156", "0.7396769", "0.73927766", "0.7378929", "0.73718935", "0.7359137", "0.73421896", "0.73421896", "0.72694767", "0.7265147", "0.7265147", "0.7265147", "0.7261225", "0.7261225", "0.7261225",...
0.78537786
0
POST /euclid_users POST /euclid_users.json
def create @euclid_user = EuclidUser.new(params[:euclid_user]) @euclid_user.proximity = "distant"; respond_to do |format| if @euclid_user.save format.html { redirect_to @euclid_user, notice: 'Euclid user was successfully created.' } format.json { render json: @euclid_user, status: :cr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "def new\n @euclid_user = ...
[ "0.6259141", "0.62283283", "0.6210158", "0.61411136", "0.6134746", "0.6126794", "0.61217546", "0.6099993", "0.60931695", "0.60412914", "0.60357714", "0.6026509", "0.6025068", "0.600273", "0.5993673", "0.5958619", "0.5947786", "0.59270746", "0.5915842", "0.5915638", "0.5915366...
0.6727144
0
PUT /euclid_users/1 PUT /euclid_users/1.json
def update @euclid_user = EuclidUser.find(params[:id]) respond_to do |format| if @euclid_user.update_attributes(params[:euclid_user]) format.html { redirect_to @euclid_user, notice: 'Euclid user was successfully updated.' } format.json { head :no_content } else format.html {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, ...
[ "0.67932063", "0.6774995", "0.6708661", "0.6584418", "0.65644723", "0.6553645", "0.6550216", "0.6545514", "0.6471925", "0.646046", "0.6438865", "0.64369965", "0.64322716", "0.6414681", "0.6414681", "0.6402894", "0.64004993", "0.63678604", "0.63527614", "0.63241565", "0.632415...
0.71763444
0
DELETE /euclid_users/1 DELETE /euclid_users/1.json
def destroy @euclid_user = EuclidUser.find(params[:id]) @euclid_user.destroy respond_to do |format| format.html { redirect_to euclid_users_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def user_management_delete_user id\n # the base uri for api requests\...
[ "0.72144127", "0.7078144", "0.7068458", "0.70267", "0.7009003", "0.69466496", "0.6919501", "0.6901847", "0.6868615", "0.68578565", "0.6841119", "0.6840021", "0.6832048", "0.68235826", "0.6821509", "0.6820895", "0.6800377", "0.6786589", "0.6784441", "0.6784441", "0.6781281", ...
0.76037097
0
GET /quandaries GET /quandaries.json
def index @quandaries = Quandary.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @enquiries = @product.enquiries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enquiries }\n end\n end", "def index\n @qandas = Qanda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:...
[ "0.61279315", "0.6097457", "0.6088066", "0.6036146", "0.6034176", "0.60301036", "0.60092074", "0.59902686", "0.5989661", "0.5957071", "0.59337425", "0.5905685", "0.59052444", "0.59038985", "0.590354", "0.5884594", "0.5883558", "0.5877946", "0.585553", "0.5842793", "0.5827917"...
0.7351676
0
POST /quandaries POST /quandaries.json
def create @quandary= current_user.quandaries.build(quandary_params) respond_to do |format| if @quandary.save format.html { redirect_to @quandary, notice: 'Quandary was successfully created.' } format.json { render :show, status: :created, location: @quandary } else format.h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @qu = Qu.new(params[:qu])\n\n respond_to do |format|\n if @qu.save\n format.html { redirect_to @qu, :notice => 'Qu was successfully created.' }\n format.json { render :json => @qu, :status => :created, :location => @qu }\n else\n format.html { render :action => \"n...
[ "0.62389404", "0.62389404", "0.6151092", "0.61087877", "0.6073034", "0.6004367", "0.593869", "0.5891279", "0.58522236", "0.5834811", "0.58176064", "0.57938856", "0.5793638", "0.57666874", "0.57587105", "0.575488", "0.57460207", "0.57189983", "0.56820595", "0.5674164", "0.5650...
0.7157882
0
PATCH/PUT /quandaries/1 PATCH/PUT /quandaries/1.json
def update respond_to do |format| if @quandary.update(quandary_params) format.html { redirect_to @quandary, notice: 'Quandary was successfully updated.' } format.json { render :show, status: :ok, location: @quandary } else format.html { render :edit } format.json { render...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @qu = Qu.find(params[:id])\n respond_to do |format|\n if @qu.update_attributes(params[:qu])\n format.html { redirect_to @qu, :notice => 'Qu was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n ...
[ "0.6535625", "0.6535625", "0.6463256", "0.6404475", "0.6357032", "0.6356482", "0.63205767", "0.63128835", "0.6258589", "0.6254157", "0.62235", "0.61985064", "0.6196127", "0.6118855", "0.6104543", "0.60871434", "0.6069321", "0.606445", "0.6039602", "0.60374117", "0.60209024", ...
0.69665366
0
DELETE /quandaries/1 DELETE /quandaries/1.json
def destroy @quandary.destroy respond_to do |format| format.html { redirect_to quandaries_url, notice: 'Quandary was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @quatum.destroy\n respond_to do |format|\n format.html { redirect_to quata_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @qu = Qu.find(params[:id])\n @qu.destroy\n\n respond_to do |format|\n format.html { redirect_to qus_url }\n format....
[ "0.71185946", "0.7070663", "0.70522606", "0.7052003", "0.69715416", "0.69682944", "0.6847839", "0.68292654", "0.6829206", "0.68079275", "0.6757404", "0.6745749", "0.6730558", "0.6705325", "0.6683369", "0.6668477", "0.6653593", "0.6652635", "0.6635347", "0.66319096", "0.662888...
0.7315046
0
Formats a CarbonDate::Date with minute precision as a string Returns: A humanreadable string representing the Date
def minute(date) time = [pad(date.hour.to_s), pad(date.minute.to_s)].join(':') [time, day(date)].join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatted_date(date)\n return '' if date.nil?\n sprintf('%d/%d/%d alle %d:%d', date.day, date.month, date.year,\n date.hour, date.min)\n end", "def format_datetime(date, format = :long)\n date.to_formatted_s(format)\n end", "def start_time_string\n date_component = self.start_tim...
[ "0.65942013", "0.61959046", "0.59428924", "0.59124947", "0.5905701", "0.5872843", "0.5849906", "0.5840041", "0.58203125", "0.5809602", "0.57933164", "0.57621205", "0.57257676", "0.57216126", "0.5713124", "0.5702826", "0.56995213", "0.5685221", "0.5661887", "0.56459457", "0.56...
0.63774943
1
Formats a CarbonDate::Date with century precision Returns: A humanreadable string representing the Date
def century(date) c = ((date.year.abs.to_i / 100) + 1).ordinalize + ' century' return [c, BCE_SUFFIX].join(' ') if (date.year <= -1) c end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_str_for_century\n return unless orig_date_str\n return if orig_date_str =~ /B\\.C\\./\n\n century_str_matches = orig_date_str.match(CENTURY_WORD_REGEXP)\n return century_str_matches.to_s if century_str_matches\n\n century_matches = orig_date_str.match(CENTURY_4CHAR_RE...
[ "0.6688998", "0.6508177", "0.63961935", "0.63858837", "0.63814676", "0.63205165", "0.63205165", "0.6317557", "0.6222274", "0.62221074", "0.62148434", "0.6214128", "0.6212795", "0.6190952", "0.6176208", "0.6171632", "0.614571", "0.61113495", "0.6083428", "0.6071608", "0.607016...
0.68591857
0
Formats a CarbonDate::Date with ten_thousand_years precision Returns: A humanreadable string representing the Date
def ten_thousand_years(date) coarse_precision(date.year, 10e3.to_i) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ten_million_years(date)\n coarse_precision(date.year, 10e6.to_i)\n end", "def hundred_thousand_years(date)\n coarse_precision(date.year, 100e3.to_i)\n end", "def hundred_million_years(date)\n coarse_precision(date.year, 100e6.to_i)\n end", "def billion_years(date)\n coarse_pr...
[ "0.6480022", "0.62412304", "0.6012005", "0.59666866", "0.5856101", "0.5848344", "0.5779537", "0.5720695", "0.5717529", "0.5710835", "0.5669659", "0.565364", "0.56508756", "0.56508756", "0.56446445", "0.56200486", "0.55205345", "0.55137295", "0.5507825", "0.54464793", "0.54361...
0.681807
0
Formats a CarbonDate::Date with hundred_thousand_years precision Returns: A humanreadable string representing the Date
def hundred_thousand_years(date) coarse_precision(date.year, 100e3.to_i) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ten_thousand_years(date)\n coarse_precision(date.year, 10e3.to_i)\n end", "def hundred_million_years(date)\n coarse_precision(date.year, 100e6.to_i)\n end", "def billion_years(date)\n coarse_precision(date.year, 1e9.to_i)\n end", "def ten_million_years(date)\n coarse_precisio...
[ "0.65144795", "0.6489899", "0.6168684", "0.6153184", "0.6072605", "0.60651904", "0.60636854", "0.60636854", "0.60246164", "0.5978676", "0.5938752", "0.58899736", "0.5809043", "0.5778706", "0.57681113", "0.57350665", "0.57097524", "0.57077795", "0.56959915", "0.5690208", "0.56...
0.6821243
0
Formats a CarbonDate::Date with million_years precision Returns: A humanreadable string representing the Date
def million_years(date) coarse_precision(date.year, 1e6.to_i) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ten_million_years(date)\n coarse_precision(date.year, 10e6.to_i)\n end", "def hundred_million_years(date)\n coarse_precision(date.year, 100e6.to_i)\n end", "def billion_years(date)\n coarse_precision(date.year, 1e9.to_i)\n end", "def format_date_nicely(date)\nend", "def ten_thou...
[ "0.64051497", "0.63893443", "0.62808996", "0.6013068", "0.5954019", "0.59120136", "0.5871082", "0.58656216", "0.5839477", "0.58277667", "0.58230555", "0.5721606", "0.57044834", "0.57044834", "0.56823957", "0.56441736", "0.56210005", "0.56068146", "0.56017363", "0.55892205", "...
0.65519065
0
Formats a CarbonDate::Date with ten_million_years precision Returns: A humanreadable string representing the Date
def ten_million_years(date) coarse_precision(date.year, 10e6.to_i) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ten_thousand_years(date)\n coarse_precision(date.year, 10e3.to_i)\n end", "def hundred_million_years(date)\n coarse_precision(date.year, 100e6.to_i)\n end", "def million_years(date)\n coarse_precision(date.year, 1e6.to_i)\n end", "def billion_years(date)\n coarse_precision(da...
[ "0.6353445", "0.6072817", "0.6047292", "0.6042898", "0.5839487", "0.5815037", "0.57690495", "0.57598335", "0.5718243", "0.5715554", "0.56648076", "0.56621873", "0.5647103", "0.5595492", "0.5591696", "0.5591696", "0.5563381", "0.5522932", "0.5522932", "0.5477907", "0.54554003"...
0.6582434
0
Formats a CarbonDate::Date with hundred_million_years precision Returns: A humanreadable string representing the Date
def hundred_million_years(date) coarse_precision(date.year, 100e6.to_i) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hundred_thousand_years(date)\n coarse_precision(date.year, 100e3.to_i)\n end", "def ten_million_years(date)\n coarse_precision(date.year, 10e6.to_i)\n end", "def million_years(date)\n coarse_precision(date.year, 1e6.to_i)\n end", "def billion_years(date)\n coarse_precision(da...
[ "0.6489859", "0.6457484", "0.6398476", "0.639723", "0.6288928", "0.6007059", "0.5962666", "0.5959947", "0.5928867", "0.58949167", "0.5890696", "0.5890696", "0.58042276", "0.57296354", "0.56888074", "0.56431854", "0.5635764", "0.562886", "0.56057197", "0.5601694", "0.5569729",...
0.6697717
0
Formats a CarbonDate::Date with billion_years precision Returns: A humanreadable string representing the Date
def billion_years(date) coarse_precision(date.year, 1e9.to_i) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ten_million_years(date)\n coarse_precision(date.year, 10e6.to_i)\n end", "def born_date\n super.to_s(:long)\n end", "def hundred_million_years(date)\n coarse_precision(date.year, 100e6.to_i)\n end", "def million_years(date)\n coarse_precision(date.year, 1e6.to_i)\n end", "de...
[ "0.62779206", "0.6269726", "0.6256434", "0.6193199", "0.6075388", "0.6039006", "0.59714353", "0.59678423", "0.5964613", "0.5924666", "0.58241886", "0.58034986", "0.5721897", "0.57174057", "0.5687389", "0.5676393", "0.5662646", "0.5645062", "0.5645062", "0.5620154", "0.5607685...
0.6634146
0
A helper function used to format dates that have less than millenium precision Params: +date_year+ The year component of the CarbonDate::Date being formatted +interval+ The precision in years Returns: A humanreadable string representing the Date
def coarse_precision(date_year, interval) date_year = date_year.to_i interval = interval.to_i year_diff = date_year - ::Date.today.year return "Within the last #{number_with_delimiter(interval)} years" if (-(interval - 1)..0).include? year_diff return "Within the next #{number_with_delim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_year(year)\n \"#{year}-#{year+1}\"\n end", "def year_display_str(date_el_array)\n result = date_parsing_result(date_el_array, :date_str_for_display)\n return result if result\n\n _ignore, orig_str_to_parse = self.class.earliest_year_str(date_el_array)\n DateParsing....
[ "0.6280327", "0.6059551", "0.5932191", "0.5856547", "0.58483297", "0.5831654", "0.5743017", "0.57356036", "0.5716297", "0.5713683", "0.5687473", "0.5682759", "0.5666735", "0.56667316", "0.56667316", "0.56612724", "0.56084424", "0.5565997", "0.5554113", "0.5546421", "0.5546087...
0.72255886
0
Converts an integer number into a humanreadable string with thousands delimiters. Example: number_with_delimiter(1234567890, ',') => 1,234,567,890 Params: +n+ the number to be delimited. Will be converted to an integer +delim+ the string to be used as the thousands delimiter. Defaults to ','
def number_with_delimiter(n, delim = ',') n.to_i.to_s.reverse.chars.each_slice(3).map(&:join).join(delim).reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_with_delimiter(number, delimiter=\",\", separator=\".\")\n begin\n parts = number.to_s.split('.')\n parts[0].gsub!(/(\\d)(?=(\\d\\d\\d)+(?!\\d))/, \"\\\\1#{delimiter}\")\n parts.join separator\n rescue\n number\n end\n end", "def number_with_delimiter(number, delimiter=',...
[ "0.7326732", "0.72563124", "0.7165631", "0.69503784", "0.6702533", "0.6702533", "0.65833974", "0.65534914", "0.65467596", "0.65204567", "0.63578504", "0.6355236", "0.62852895", "0.6274327", "0.62351584", "0.6188494", "0.6182683", "0.6159662", "0.61479753", "0.6138624", "0.613...
0.79559654
0
Pad a string with '0' to ensure it has two characters. If a string of 2 or more characters is used as parameter, will not alter the string. Example: pad('1') => "01" Params: +s+ The string to pad. Returns: A string of at least 2 characters
def pad(s) s.rjust(2, '0') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(s)\n s.to_s.rjust(3,\"0\")\nend", "def pad_string(s)\n # s = s[0..80]\n b = s.bytes\n b << 0\n b << 0 while b.size % 4 > 0\n b.pack(\"c*\")\n end", "def pad(p=0, s=0, c=0, from=g_from_direction)\n prefix(p, c, from) unless p.zero?\n suffix(s, c, from) unless s.zero?\n end"...
[ "0.73824114", "0.67277753", "0.65294373", "0.6359395", "0.63288176", "0.62704307", "0.6252459", "0.62415195", "0.6169826", "0.6131705", "0.61214495", "0.61131394", "0.6092477", "0.6088558", "0.60070175", "0.5998051", "0.5961358", "0.59270835", "0.5920687", "0.59139615", "0.58...
0.80405915
0
diff a +Roomorama::Diff+ object On initialization the +validate!+ method of the diff is called therefore, an operation cannot be built unless the property given is conformant to the basic validations performed on that class.
def initialize(diff) @property_diff = diff property_diff.validate! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diff=(o); end", "def validations_for_diff\n []\n end", "def set_diff\n @diff = Diff.find(params[:id])\n end", "def diff(other)\n Distance.diff_total(self, other, true)\n end", "def set_diff\n @diff = Diff.find(params[:id])\n end", "def create\n @diff = Diff.new(diff...
[ "0.5888004", "0.579868", "0.5742015", "0.5716486", "0.5702969", "0.5677127", "0.5677127", "0.5672885", "0.56115377", "0.5599995", "0.55511904", "0.54775083", "0.54403776", "0.539374", "0.5368911", "0.5368604", "0.53400016", "0.53202206", "0.53082556", "0.5255844", "0.521863",...
0.78430396
0
Asynchronously upgrade an environment
def async_upgrade(environment, plugin, options = {}) job = Job.new(:upgrade) async(:upgrade, job, environment, plugin, options) job.ticket end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade\n project.run \"apk upgrade\"\n end", "def sync_gem_environments\n resync = []\n environments.each do |name|\n env = environment(name)\n if env.has_gems? \n resync << name\n env.sync\n env.save\n end\n end\n resyn...
[ "0.5700588", "0.57000464", "0.5667662", "0.558769", "0.5553724", "0.55006737", "0.5499875", "0.5497845", "0.5472101", "0.5423413", "0.5419721", "0.5418028", "0.537472", "0.5369072", "0.5360261", "0.5308547", "0.5270156", "0.5191247", "0.51744026", "0.51669115", "0.51506543", ...
0.68890375
0
create a new db if needed and connect to it db file is named procname.db
def connect(processName) @procName = processName @db_name = processName + ".db" # create the new db if it doesn't exist if(!File.exists?(@db_name)) create_db end @db = SQLite3::Database.open(@db_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_setup\n log_debug\n db_file = find_db\n db_tmp = '/tmp/plex_missing_tmp.db'\n @db = ''\n \n # cp to tmp as the db is locked if being used\n `cp \"#{db_file}\" #{db_tmp}`\n \n # not too sure why but i was having a problem where a 0 byte file was cp'd\n # def a local issue i a...
[ "0.73275596", "0.7162998", "0.71568614", "0.70539486", "0.7011821", "0.68559784", "0.68365496", "0.68266004", "0.6735692", "0.67164546", "0.67127913", "0.669797", "0.6668326", "0.66460973", "0.6619451", "0.6619274", "0.6617997", "0.66170704", "0.6579083", "0.65660304", "0.650...
0.7631058
0
POST /raw_foods POST /raw_foods.json
def create @raw_food = current_merchant.raw_foods.new(raw_food_params) respond_to do |format| if @raw_food.save format.html { redirect_to @raw_food, notice: 'Raw food was successfully created.' } format.json { render :show, status: :created, location: @raw_food } else format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @food = @fridge.foods.create(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end", "def raw_food_params\n params.require(:raw_food).permit(:logo, :brand_name, :general_contact_number, :general_email, :website_online_ordering_page, :facebook_page, :instagram_handl...
[ "0.5834344", "0.56350017", "0.5504638", "0.5488984", "0.5409885", "0.5323871", "0.5315756", "0.5282409", "0.5252079", "0.51908445", "0.516067", "0.51442134", "0.51230174", "0.5121342", "0.50928193", "0.5090981", "0.5085941", "0.5080582", "0.5047763", "0.5043355", "0.5017928",...
0.641323
0
DELETE /raw_foods/1 DELETE /raw_foods/1.json
def destroy @raw_food.destroy respond_to do |format| format.html { redirect_to raw_foods_url, notice: 'Raw food was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end", "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { re...
[ "0.6853021", "0.6853021", "0.68415916", "0.67407715", "0.6728383", "0.66623205", "0.66603744", "0.6655749", "0.65936875", "0.6577978", "0.65777415", "0.6572667", "0.65724736", "0.65669763", "0.65552306", "0.6555091", "0.6550582", "0.65429556", "0.653768", "0.6510496", "0.6510...
0.71584624
0
Sets the local path of the s3 downloaded object file
def set_path @file_path = @s3_local_object.body.path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull_from_s3\n FileUtils.mkdir_p File.dirname local_path\n file = open(local_path, \"wb\") {|f| f << open(s3_url(:orig=>true)).read }\n end", "def download_s3_file\n run_callbacks :download_s3_file do\n @s3_local_object = download(@directory, @key)\n end\n end", "def setup_file_p...
[ "0.71206", "0.7113829", "0.69821626", "0.6779674", "0.6777625", "0.65644497", "0.6512893", "0.6484955", "0.6462759", "0.6286961", "0.6222474", "0.62119514", "0.6195475", "0.61765605", "0.61729413", "0.6168541", "0.61659765", "0.6162605", "0.61619717", "0.6139611", "0.611468",...
0.8764995
0
GET /train_locomotives GET /train_locomotives.json
def index @train_locomotives = TrainLocomotive.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_train_locomotive\n @train_locomotive = TrainLocomotive.find(params[:id])\n end", "def index\n @lovs = Lov.all\n end", "def train_locomotive_params\n params.require(:train_locomotive).permit(:operator_id, :locomotive_class_name, :locomotive_class_number, :make_id, :locomotive_type_id, :...
[ "0.6873654", "0.6431473", "0.6411481", "0.6360179", "0.6149085", "0.6086077", "0.6008904", "0.58638084", "0.5842019", "0.57886094", "0.5773354", "0.5773354", "0.5773354", "0.5725371", "0.57190377", "0.57012564", "0.56764406", "0.5670292", "0.564198", "0.5622961", "0.56053895"...
0.7539062
0
POST /train_locomotives POST /train_locomotives.json
def create @train_locomotive = TrainLocomotive.new(train_locomotive_params) respond_to do |format| if @train_locomotive.save format.html { redirect_to @train_locomotive, notice: 'Train locomotive was successfully created.' } format.json { render action: 'show', status: :created, location:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_locomotive_params\n params.require(:train_locomotive).permit(:operator_id, :locomotive_class_name, :locomotive_class_number, :make_id, :locomotive_type_id, :box_number, :owner_id, :price, :decoder_id, :decoder_address, :picture, :delete_image)\n end", "def set_train_locomotive\n @train_loc...
[ "0.73694175", "0.6655743", "0.6409231", "0.6277444", "0.5920519", "0.58733624", "0.5848118", "0.5694255", "0.5684281", "0.56644297", "0.56611776", "0.5643515", "0.56361026", "0.5604862", "0.5596765", "0.5580859", "0.55543876", "0.5537083", "0.5474386", "0.54426485", "0.544048...
0.7266716
1
PATCH/PUT /train_locomotives/1 PATCH/PUT /train_locomotives/1.json
def update respond_to do |format| if @train_locomotive.update(train_locomotive_params) format.html { redirect_to @train_locomotive, notice: 'Train locomotive was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_train_locomotive\n @train_locomotive = TrainLocomotive.find(params[:id])\n end", "def update\n respond_to do |format|\n if @train.update(train_params)\n format.html { redirect_to @train, notice: 'Train was successfully updated.' }\n format.json { head :no_content }\n el...
[ "0.6536184", "0.6357123", "0.618267", "0.60848886", "0.59190786", "0.58316636", "0.578761", "0.5693497", "0.56687945", "0.564483", "0.5623751", "0.5618357", "0.5604889", "0.55923617", "0.55620104", "0.5559002", "0.5546083", "0.55364674", "0.5530723", "0.5515432", "0.54840666"...
0.7199848
0
DELETE /train_locomotives/1 DELETE /train_locomotives/1.json
def destroy @train_locomotive.destroy respond_to do |format| format.html { redirect_to train_locomotives_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @train.destroy\n respond_to do |format|\n format.html { redirect_to trains_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trainmodel.destroy\n respond_to do |format|\n format.html { redirect_to trainmodels_url, notice: 'Trainmodel was successfu...
[ "0.7041086", "0.6773462", "0.67307425", "0.65346986", "0.652068", "0.6480476", "0.64546114", "0.64508146", "0.6449621", "0.64413637", "0.6400375", "0.6396486", "0.63844264", "0.63705254", "0.6368457", "0.63485277", "0.63458973", "0.63179535", "0.6300191", "0.62915015", "0.628...
0.7771623
0
=== list Shows list of Workflows.
def list Log.add_info(request, params.inspect) @tmpl_folder, @tmpl_workflows_folder = TemplatesHelper.get_tmpl_subfolder(TemplatesHelper::TMPL_WORKFLOWS) my_wf_folder = WorkflowsHelper.get_my_wf_folder(@login_user.id) sql = WorkflowsHelper.get_list_sql(@login_user.id, my_wf_folder.id) @workflows ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @workflows = Workflow.all\n end", "def list_workflows\n perform(\"/registries/current/workflows?status=true&versions=true\", :get, content_type: :json)\n end", "def index\n @active_workflow_steps = ActiveWorkflowStep.all\n end", "def index\n @workflow_types = WorkflowType.a...
[ "0.7911187", "0.73713714", "0.70894897", "0.7035903", "0.7029", "0.69790167", "0.69790167", "0.6966519", "0.6957868", "0.65759414", "0.65173435", "0.646704", "0.646704", "0.63368285", "0.62941515", "0.6287932", "0.6248686", "0.62406117", "0.6227208", "0.6188371", "0.61869586"...
0.7583458
1
=== move Moves Workflow to the specified Folder.
def move Log.add_info(request, params.inspect) raise(RequestPostOnlyException) unless request.post? unless params[:tree_node_id].nil? folder_id = params[:tree_node_id] SqlHelper.validate_token([folder_id]) workflow = Workflow.find(params[:id]) workflow.item.update_attribute(:fold...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_folder_ind\n create_process(process: \"MOVE_FOLDER\")\n end", "def move_to_folder=(value)\n @move_to_folder = value\n end", "def move_to_folder\n return @move_to_folder\n end", "def move\n Log.add_info(request, params.inspect)\n\n raise(R...
[ "0.69756305", "0.69457257", "0.6902316", "0.674207", "0.67033726", "0.668712", "0.6659796", "0.6640023", "0.660863", "0.6579934", "0.65643215", "0.654911", "0.64717376", "0.6439497", "0.6395395", "0.6313434", "0.62796766", "0.6197552", "0.6120866", "0.61008525", "0.60747707",...
0.73864174
0
=== check_owner Filter method to check if the current User is owner of the specified Workflow.
def check_owner return if params[:id].blank? or @login_user.nil? begin owner_id = Workflow.find(params[:id]).user_id rescue owner_id = -1 end if !@login_user.admin?(User::AUTH_WORKFLOW) and owner_id != @login_user.id Log.add_check(request, '[check_owner]'+request.to_s) flas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owner? (user)\n user == owner\n end", "def is_owner?(this_user)\n user == this_user\n end", "def is_owner?(user)\n !user.nil? && (self.user_id == user.id)\n end", "def is_owner?(user)\n user.id == self.user_id\n end", "def is_owner\n object == current_user\n end", "def check_o...
[ "0.706881", "0.70162773", "0.6976861", "0.69431376", "0.6885486", "0.68266034", "0.6812583", "0.67592037", "0.67589796", "0.6750887", "0.6750887", "0.6728272", "0.67271197", "0.67206115", "0.6711435", "0.6706952", "0.66907084", "0.6682494", "0.66795677", "0.66601604", "0.6644...
0.8005436
0
Expected output: ['tea', 'water', 'soda water'] psuedo create my method going with are_you_in_here use select method to pull out items in array see how to use value to use includes method perhaps p my result with test arrays first snag .includes only returns true or false not sure how to get that to retrurn the array i...
def are_you_in_here letter, arr arr.select { |arr| arr.include?(letter) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def containLetter(array, letter)\n # Iterate through the array of words\n # Use select to check if that letter is in the word\n selected_array = array.select { |value| value.include?(letter) }\n # Implicity return an array of words that contain that letter with the statement above\nend", "def spec_le...
[ "0.7152421", "0.6728156", "0.66312426", "0.6630551", "0.6612763", "0.6591329", "0.6573575", "0.65725553", "0.6512464", "0.65020436", "0.64821684", "0.6460714", "0.64529634", "0.64365506", "0.639186", "0.63915336", "0.6374461", "0.635798", "0.6351547", "0.63234234", "0.6316446...
0.6759249
1
API method should be derived from the class name. eg: Host => "host.get"
def api_method @_api_method ||= "#{method_from_class_name}.get" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method\n self.class.name.split('::').last || ''\n end", "def class_name method_name\n segments = method_name.split('::')\n return segments[0..-2].join('::') if segments.count > 1\n \"Object\"\nend", "def sanitize_api_class( controller )\n controller.name.split(\"::\").last\n ...
[ "0.6901805", "0.6729382", "0.6533643", "0.64508957", "0.6434392", "0.640022", "0.63625926", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62278336", "0...
0.7395332
0
GET /mt_manufacturings/new GET /mt_manufacturings/new.xml
def new @mt_manufacturing = MtManufacturing.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @mt_manufacturing } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @mt_manufacturing = MtManufacturing.new(params[:mt_manufacturing])\n\n respond_to do |format|\n if @mt_manufacturing.save\n format.html { redirect_to(@mt_manufacturing, :notice => 'Mt manufacturing was successfully created.') }\n format.xml { render :xml => @mt_manufacturing,...
[ "0.7324403", "0.7020698", "0.7000215", "0.6961111", "0.6942203", "0.6931576", "0.69245714", "0.69040763", "0.68989307", "0.68692374", "0.68227935", "0.6812638", "0.6789996", "0.6789502", "0.6781747", "0.6781747", "0.6781747", "0.67767364", "0.6772498", "0.6754028", "0.6742879...
0.7875078
0
POST /mt_manufacturings POST /mt_manufacturings.xml
def create @mt_manufacturing = MtManufacturing.new(params[:mt_manufacturing]) respond_to do |format| if @mt_manufacturing.save format.html { redirect_to(@mt_manufacturing, :notice => 'Mt manufacturing was successfully created.') } format.xml { render :xml => @mt_manufacturing, :status =>...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @mt_manufacturing = MtManufacturing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mt_manufacturing }\n end\n end", "def manufacturing_params\n params.fetch(:manufacturing, {}).permit(:code, :manufacturing_date, :product_id, :q...
[ "0.6243059", "0.5801658", "0.57229203", "0.56237304", "0.5608113", "0.56042343", "0.55512124", "0.54054254", "0.5387497", "0.53700304", "0.53185505", "0.52805436", "0.52801526", "0.52642375", "0.52593", "0.52543503", "0.52483827", "0.5245466", "0.5234892", "0.52237755", "0.51...
0.701045
0
DELETE /mt_manufacturings/1 DELETE /mt_manufacturings/1.xml
def destroy @mt_manufacturing = MtManufacturing.find(params[:id]) @mt_manufacturing.destroy respond_to do |format| format.html { redirect_to(mt_manufacturings_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @manufacturer_line = ManufacturerLine.find(params[:id])\n @manufacturer_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(manufacturer_lines_url) }\n format.xml { head...
[ "0.6890203", "0.6556167", "0.64369136", "0.63576245", "0.6337912", "0.6330838", "0.63070613", "0.6278583", "0.62609607", "0.6232366", "0.6207174", "0.620576", "0.6205208", "0.6204459", "0.619083", "0.61841786", "0.61829627", "0.61820513", "0.6179404", "0.6164728", "0.6160919"...
0.745034
0
Returns a string of all the log output from the import. Or returns nothing if a custom logger was used.
def log @log_output.string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logger_output; end", "def log\n @output || []\n end", "def log\n @log ||= Logging.logger[File.basename($0)]\n end", "def output\n App.settings.log_output\n end", "def error_output\n where = Array.new\n where << 'below' if @logger.prints_errors\n where << 'with increased verbosity...
[ "0.6808813", "0.6136016", "0.59732157", "0.59679055", "0.58576655", "0.5819999", "0.5804947", "0.577453", "0.5722508", "0.5718833", "0.5688028", "0.5626797", "0.56227845", "0.56185174", "0.56185174", "0.56165624", "0.55849195", "0.55806226", "0.5565969", "0.5549522", "0.55282...
0.6786407
1
Add includes options which will be used when querying records. Useful to avoid N+1 type problems. Configured has_manys are automaticaly included and don't need to be specified here.
def includes(options) @includes = options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_includes(&block)\n if include_associations = options.delete(:include)\n base_only_or_except = { :except => options[:except],\n :only => options[:only] }\n\n include_has_options = include_associations.is_a?(Hash)\n associations = include_has...
[ "0.7109436", "0.7109436", "0.6859788", "0.6843337", "0.68427396", "0.68026507", "0.6795185", "0.6787254", "0.67393464", "0.6674961", "0.6658092", "0.66100204", "0.6592239", "0.65871704", "0.6539394", "0.65090835", "0.64750785", "0.64722246", "0.64481205", "0.6440471", "0.6378...
0.7436749
0
Add eager_load options which will be used when querying records.
def eager_load(options) @eager_load = options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eager(*associations)\n opts = @opts[:eager]\n association_opts = eager_options_for_associations(associations)\n opts = opts ? Hash[opts].merge!(association_opts) : association_opts\n clone(:eager=>opts)\n end", "def eager_load_results(opts, eo, &block)\n op...
[ "0.7316349", "0.71250415", "0.7011839", "0.689377", "0.689377", "0.689377", "0.684639", "0.6749361", "0.66854", "0.6651473", "0.6651473", "0.6651473", "0.6651473", "0.66439027", "0.6615689", "0.6588866", "0.6545853", "0.64361507", "0.64246935", "0.63189435", "0.63061595", "...
0.8293553
0
Process a cluster message
def process_message(message) # Extract fields from message begin data = JSON.parse message rescue JSON::ParserError Logger.error log_message("JSON Parse error on cluster message: '" + msg + "'") return end sender = data['sender'] return if sender == no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_stanza(message)\n node = Nokogiri::XML(message[STANZA]).root rescue nil\n return unless node\n log.debug { \"Received cluster stanza: %s -> %s\\n%s\\n\" % [message[FROM], @cluster.id, node] }\n\n recources = @cluster.connected_resources(node[TO])\n if recources.empty?...
[ "0.668477", "0.6542275", "0.60334563", "0.60098904", "0.59353536", "0.5857898", "0.57631296", "0.5696706", "0.5690921", "0.56630033", "0.5610191", "0.5501912", "0.5491493", "0.5482179", "0.5474287", "0.5471767", "0.54225063", "0.54127574", "0.5386338", "0.5381757", "0.5380451...
0.7622374
0
The node_id of the current master
def master_id() @master_id ||= "" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def master_node\n {:nodename => @master_nodename}\n end", "def flume_master_id\n flume_masters.find_index( ClusterChef::NodeUtils.private_ip_of( node ) )\n end", "def neo_node_id\n @internal_node.getId()\n end", "def ext_id id\n \"#{@master_node}|#{id}\"\n end", "def master_nid(nid)...
[ "0.800542", "0.7987816", "0.77484244", "0.7692792", "0.7689161", "0.7587133", "0.7584213", "0.75250876", "0.7519579", "0.7382893", "0.71400213", "0.7113706", "0.70939934", "0.70452034", "0.70216316", "0.70202845", "0.69715834", "0.6863264", "0.6851109", "0.6815256", "0.672765...
0.80219966
0
Sends a cluster message
def send_message(event, payload = nil, destination = nil) Redis.publish('slanger:cluster', {sender: node_id, destination: destination, event: event, payload: payload}.to_json) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_mess(mess)\n\t@client.puts(mess)\t\nend", "def route(stanza, node)\n log.debug { \"Sent cluster stanza: %s -> %s\\n%s\\n\" % [@cluster.id, node, stanza] }\n redis.publish(\"cluster:nodes:#{node}\", {\n from: @cluster.id,\n type: STANZA,\n stanza: stanza.to_s\n ...
[ "0.6175749", "0.60076463", "0.5997445", "0.5972619", "0.59325415", "0.59008354", "0.5856145", "0.5842123", "0.5840385", "0.58380795", "0.58019197", "0.5761676", "0.5759539", "0.5756291", "0.5732476", "0.5677439", "0.5661516", "0.564475", "0.5621653", "0.56207925", "0.5616041"...
0.63335854
0
The last time a "election victory" occured. Upon receiving a new election victory, if the last one is old we forget the old master If he's still around and still the highest key he'll send a fresh election victory anyway.
def master_last_seen_unix_timestamp() @master_last_seen_unix_timestamp ||= 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_message_age\n return unless @mode == :max_age\n\n @history_mutex.synchronize do\n @history.each do |key|\n @history[key].delete_if{|entry| Time.now - entry.time > @max_age}\n end\n end\n end", "def last_checkin; end", "def update_lastlyUsed(chall)\n $game_temp.lbchll_las...
[ "0.5505666", "0.5441476", "0.5419344", "0.54145247", "0.53953594", "0.53839177", "0.5366166", "0.5363971", "0.5363971", "0.5355854", "0.5347706", "0.53130364", "0.5309644", "0.5309316", "0.5307484", "0.53068066", "0.5295403", "0.52938366", "0.5293259", "0.5285846", "0.5284312...
0.5707952
0
Reply to enquiry. Sent by the master if its key is greater than the enquirer's
def send_enquiry_reply(enquirer) send_message(:election_enquiry_reply, nil, enquirer) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_enquiry()\n # Send election enquiry message. The master will reply if its node_id is greater than this node's\n send_message(:election_enquiry)\n # Wait for the master's response for a few seconds\n @master_response_timeout = EM::Timer.new(5) do\n # No response, asume we are the...
[ "0.6780247", "0.61642396", "0.60089475", "0.5975008", "0.5964609", "0.5849009", "0.58025247", "0.574858", "0.574858", "0.5633289", "0.5633289", "0.56029093", "0.55762976", "0.5546961", "0.55153644", "0.55040205", "0.54820776", "0.5471102", "0.5471102", "0.54651105", "0.544822...
0.7220513
0
Method to see whether all of the predictions on a tip are won or not and if they are, this will set the tip to won
def tip_won @tip = Tip.find(params[:tip][:tip_id]) @prediction = [] @tip.predictions.each do |prediction| @prediction.push(prediction.result.betWon) end if @prediction.all? @tip.won = true elsif @prediction.include? false @tip.won = false else @tip.won = nil end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def over?\n won? || tied?\n end", "def predicting?\r\n @predict_state != :none\r\n end", "def someone_won?\n !!winnning_marker\n end", "def mark_winner\n winning_team = teams.reject{|team| team.goals < 10}.sort_by(&:goals).last\n winning_team.is_winner = true unless winning_team...
[ "0.6044951", "0.5992322", "0.59607303", "0.59495956", "0.57922506", "0.57332104", "0.57151306", "0.5704553", "0.5680663", "0.5662677", "0.55470484", "0.5523279", "0.55175656", "0.55175656", "0.54338604", "0.54236966", "0.5413962", "0.54102594", "0.5410117", "0.53982127", "0.5...
0.7335609
0
Test the creation of the find args count only
def test_count_find_articles_for_user_args_with_feed feed = UserFeed.find(5) #New York Times args = VwArticlesForUser.find_articles_for_user_args(true, feed, :feed, 3, nil, nil) assert args[:select] == "DISTINCT id" assert args[:conditions] == ["feed_id = ? AND (article_user_id = ? OR article_user_id IS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(args, mode); end", "def test_find_count\n assert_equal(6, @coll.find().limit(2).count())\n end", "def test_args_check_less\n\t\targs_checker = ArgsChecker::new\n\t\tarr = []\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend", "def test_check_num_args...
[ "0.6233466", "0.6064041", "0.60208136", "0.59895474", "0.5964296", "0.5853693", "0.5852976", "0.5827197", "0.5819177", "0.5819115", "0.581673", "0.5810822", "0.5810556", "0.5779797", "0.577442", "0.57544684", "0.5750544", "0.57358986", "0.57112926", "0.57071894", "0.5704918",...
0.62450075
0
Test counting articles now
def test_count_articles_for_user_with_feed feed = UserFeed.find(6) #NErr the Blog count = VwArticlesForUser.count_articles_for_user(feed, :feed, 3) assert count == 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def how_many?\n return default_article_sync if articles.length == 0\n last_db = articles.last.published\n count = 0\n feed.entries.each do |entry|\n count += 1 if entry.published > last_db\n end\n count > 20 ? 20 : count\n end", "def test_count_find_articles_for_user_args_with_feed\n f...
[ "0.653821", "0.65060407", "0.63467366", "0.6325941", "0.63191587", "0.6227495", "0.6171253", "0.6129673", "0.61212873", "0.6094264", "0.60913837", "0.60743654", "0.6015664", "0.59964204", "0.5993536", "0.5945016", "0.5944026", "0.5926869", "0.5912753", "0.59084845", "0.589109...
0.7160953
0
Test finding the articles
def test_find_articles_for_user_with_feed feed = UserFeed.find(6) #Err the Blog articles = VwArticlesForUser.find_articles_for_user(feed, :feed, 3) assert articles.size == 2 assert !articles.has_next_page assert !articles.has_prev_page assert articles.prev_page.nil? assert articles.next_page...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_articles(*args)\n (1..@how_many).each { |n| Article.create(:name => n, :author_id => 1) }\n results = Article.find(*args)\n if results.size > results.page_size\n page_count, num_on_last_page = how_many.divmod(results.page_size)\n page_count = page_count + 1 if num_on_last_page > 0\n ...
[ "0.6749496", "0.67161655", "0.6697678", "0.6686039", "0.6683691", "0.66740173", "0.66222036", "0.65760094", "0.6539714", "0.6514489", "0.65023726", "0.6470288", "0.6454364", "0.64371675", "0.6431779", "0.639554", "0.6394885", "0.6390838", "0.6366575", "0.63268214", "0.6324389...
0.7091233
0
Purpose: due_date setter Signature: takes date string in "YYYYMMDD" format
def set_due_date(date_string) @due_date = Date.parse(date_string) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_due_date(date)\n @due_date = Date.parse(date)\n end", "def due_date=(date)\n @due_date = date\n end", "def changeDueDate(date)\n @dueDate = Date.parse(date)\n return @dueDate\n end", "def setDueDate(date)\n @dueDate = date\n end", "def due_date\n if @values[:due_date] != ...
[ "0.81394213", "0.78250265", "0.7823772", "0.76514715", "0.73983264", "0.7312813", "0.7236758", "0.7097227", "0.70676446", "0.70676446", "0.6960214", "0.6890273", "0.66367626", "0.6595858", "0.65756327", "0.65756327", "0.65426445", "0.65368193", "0.64763474", "0.64713824", "0....
0.8109237
1
Adding points against and points for to rankings hash
def add_points(team) games_played = Game.where("team_one = #{team.id} or team_two = #{team.id}") @rankings[team.name]["points_for"] = 0 @rankings[team.name]["points_against"] = 0 if !games_played.nil? games_played.each do |game| if !game.winner.nil? && !game.winner_score.nil? if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n @points.inject(0) { |sum, point| sum += point.x + point.y }\n end", "def get_rankings\n #create tmp hash storage for all the rows in the rankings table\n row_holder = Hash.new { |hash, key| hash[key] =\n {'played' => 0, '3_points' => 0, '2_points' => 0, '1_point' => 0,\n ...
[ "0.7090035", "0.668032", "0.64619905", "0.6367482", "0.6328738", "0.63134146", "0.6300063", "0.62820774", "0.62566304", "0.62551385", "0.6237811", "0.6234838", "0.6215865", "0.6177377", "0.6174329", "0.6102681", "0.6089473", "0.60692024", "0.60599667", "0.6032594", "0.601428"...
0.7001565
1
GET /plans/new GET /plans/new.json
def new @plan = Plan.new respond_to do |format| format.html # new.html.erb format.json { render json: @plan } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @plantype = Plantype.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plantype }\n end\n end", "def new\n @test_plan = TestPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_plan ...
[ "0.77204925", "0.763047", "0.75800633", "0.7458137", "0.7445357", "0.74205977", "0.7374848", "0.735784", "0.73191124", "0.7316831", "0.729417", "0.72682375", "0.7251034", "0.7231949", "0.72115386", "0.7203763", "0.7140014", "0.7132095", "0.71313137", "0.7099442", "0.7099442",...
0.8117777
1
Start our ldap connection.
def start case ssl when :tls @connection = LDAP::SSLConn.new(host, port, true) when true @connection = LDAP::SSLConn.new(host, port) else @connection = LDAP::Conn.new(host, port) end @connection.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3) @connection....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_to_ldap\r\n begin\r\n @ldap = Net::LDAP.new(:host => @ldap_host,\r\n :port => @ldap_port,\r\n :auth => { :method => :simple,\r\n :username => @ldap_username,\r\n :password => @ldap_password } )\r\n @logger.info \"Connectin...
[ "0.73750484", "0.7087649", "0.7007367", "0.6981125", "0.67752594", "0.6762021", "0.67023844", "0.6612316", "0.6554134", "0.65285385", "0.63858604", "0.62499756", "0.62245274", "0.621798", "0.6183765", "0.6140735", "0.613158", "0.6121836", "0.60908735", "0.60333157", "0.599834...
0.81234145
0
create logger based on a given configration
def create_logger(conf) name = self.class.to_s @logger = Patriot::Util::Logger::Factory.create_logger(name, conf) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_logger_for(classname)\n # handle case in which log path does not exists\n begin\n logger = Logger.new(@log_path)\n rescue Errno::ENOENT\n FileUtils.mkdir_p File.dirname @log_path\n retry\n end\n\n logger.progname = classname\n logge...
[ "0.7201467", "0.7174189", "0.7153063", "0.7153063", "0.7104416", "0.7085287", "0.69758666", "0.69046694", "0.6855649", "0.67630947", "0.6727744", "0.6727744", "0.6727744", "0.67004013", "0.66836214", "0.6658883", "0.6637589", "0.66343695", "0.6614507", "0.6614507", "0.6574427...
0.7555851
0
Returns the current state the object is in, as a Ruby symbol.
def current_state self.send(self.class.state_column).to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_sym\n return self.state.to_s.gsub(/_state$/, '').to_sym\n end", "def state\n @@states[@state]\n end", "def infer_current_state(obj)\n begin\n obj.to_sym\n rescue\n nil\n end\n end", "def state\n @current_state\n end", "def state\n object.state_code\n...
[ "0.778936", "0.72638017", "0.7260074", "0.7217795", "0.7191846", "0.7173205", "0.7173205", "0.71211797", "0.7112003", "0.69318074", "0.69161254", "0.69120365", "0.69120365", "0.6888226", "0.6789236", "0.6771563", "0.67655486", "0.6736034", "0.6736034", "0.67151237", "0.670748...
0.7734311
1
Returns what the next state for a given event would be, as a Ruby symbol.
def next_state_for_event(event) ns = next_states_for_event(event) ns.empty? ? nil : ns.first.to end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_state(state, event)\n transition = next_state_instruction(state, event)\n ns = transition ? transition[:next] : nil\n (ns.is_a?Symbol) ? ns : ns && ns[:state]\n end", "def getNextState(label = nil)\n\tsym = ''\n\tname = $nextState.to_s\n\twhile name.length < NameLength\n\t\tname = '0' ...
[ "0.765051", "0.7568404", "0.7270385", "0.72466797", "0.72374386", "0.71847266", "0.6862314", "0.68410224", "0.68410224", "0.67528284", "0.67362434", "0.6606392", "0.65116817", "0.64542085", "0.64346105", "0.6432778", "0.6376666", "0.6345473", "0.63103014", "0.6292266", "0.629...
0.77427125
0
Wraps ActiveRecord::Base.find to conveniently find all records in a given state. Options: +number+ This is just :first or :all from ActiveRecord +find+ +state+ The state to find +args+ The rest of the args are passed down to ActiveRecord +find+
def find_in_state(number, state, *args) with_state_scope state do find(number, *args) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(*args)\n select(*args)\n\n=begin\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n case args.first\n when :all then find_every options\n when :first then find_initial options\n else find_from_ids args, options\n end...
[ "0.69839525", "0.64989495", "0.6392795", "0.63673633", "0.63639873", "0.6340224", "0.63326794", "0.6332438", "0.6316403", "0.623563", "0.61677784", "0.6044358", "0.6009866", "0.59865075", "0.59576285", "0.59454346", "0.59383976", "0.59116054", "0.58815", "0.5869502", "0.58695...
0.81210935
0
Wraps ActiveRecord::Base.count to conveniently count all records in a given state. Options: +state+ The state to find +args+ The rest of the args are passed down to ActiveRecord +find+
def count_in_state(state, *args) with_state_scope state do count(*args) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(options = {})\n calculate('COUNT(*)', options).to_i\n end", "def count **args\n\t\tquery( **( { projection: 'COUNT(*)' }.merge args )).execute(reduce: true){|x| x[:\"COUNT(*)\"]}\n end", "def count(opts={})\n all(opts).size\n end", "def count(*args)\n # Ignore first arg if...
[ "0.7143123", "0.7084454", "0.7006995", "0.6997248", "0.6854008", "0.6771326", "0.6687586", "0.66181296", "0.6571682", "0.65249074", "0.6493478", "0.6474774", "0.6473509", "0.64730525", "0.6429741", "0.6408593", "0.64036316", "0.6393429", "0.6387125", "0.63504285", "0.6336637"...
0.82572156
0
Wraps ActiveRecord::Base.calculate to conveniently calculate all records in a given state. Options: +state+ The state to find +args+ The rest of the args are passed down to ActiveRecord +calculate+
def calculate_in_state(state, *args) with_state_scope state do calculate(*args) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate calculation, *args, &block\n\t\toptions = args.extract_options!.dup\n\t\tscope_options = extract_scope_options_from options\n\t\tsource = source_with_applied_scopes(scope_options)\n\t\tsource = block.call(source, data_source.scopes) if block_given?\n\t\tsource.send *([calculation] + args + [options])...
[ "0.62893724", "0.61536515", "0.59827906", "0.58819133", "0.5778155", "0.56244314", "0.55733603", "0.550482", "0.52351105", "0.5217666", "0.5212539", "0.52098787", "0.51863086", "0.51831865", "0.5165161", "0.5144857", "0.5126815", "0.5121101", "0.51094466", "0.51025283", "0.50...
0.8006063
0
Function that create channel with rest_api and check if channel exsists first
def create_channel(channel) puts "running create_channel, channel = #{channel.inspect}" key_check = RestClient.get "#{$base_url}/channels/#{channel["key"]}" #space should be escaped :) if key_check.nil? || key_check['key'].nil? #params = { 'key' => channel["key"], 'name' => channel["name"], 'description' =>...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_channel\n if channel.nil?\n begin\n transaction do\n channel = Channel.new\n channel.save!\n self.channel_id = channel.id\n self.save!\n end\n rescue ActiveRecord::RecordInvalid\n false\n end\n else\n false\n end\n e...
[ "0.7200751", "0.71752787", "0.71222967", "0.6728761", "0.66624796", "0.66301906", "0.6560772", "0.6477684", "0.6455959", "0.6449972", "0.64413565", "0.64413565", "0.63831985", "0.6381928", "0.6373809", "0.6362438", "0.6326484", "0.6276095", "0.6210122", "0.62037414", "0.62003...
0.82708055
0
DELETE /suppliers/remove DELETE /suppliers/remove.xml
def remove @reorder_url = reorder_suppliers_url @ids = selected_ids(:supplier_ids) respond_to do |format| if(Supplier.remove(@ids)) flash[:notice] = "Suppliers removed (#{@ids.size})." format.html { redirect_to suppliers_url } format.xml { head :ok } format.js { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @supplier = Supplier.find(params[:id])\n @supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to(suppliers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @supplier = Supplier.find(params[:id])\n \n # Erase supplier id for products fro...
[ "0.70255274", "0.6807066", "0.6622152", "0.66165084", "0.6560411", "0.6507958", "0.6507929", "0.6418024", "0.6394611", "0.6339065", "0.63216144", "0.63144445", "0.6306959", "0.6299604", "0.6285878", "0.6268688", "0.624745", "0.6244051", "0.623926", "0.6235318", "0.62293833", ...
0.68095964
1
"The value of avgLoad(s_i), in case of plugbased prediction, is calculated as the average of all load values reported by the given plug with timestamps in s_i."
def get_plug_avgLoad(s_i, h_id = house_id, hh_id = household_id, p_id = plug_id) query = "SELECT load FROM AveragePlugLoads WHERE house_id = %d " \ "AND household_id = %d "\ "AND plug_id = %d "\ "AND slice_index = %d" % [h_id, hh_id, p_id, s_i] results = execute_query(query) if results.cou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_house_avgLoad(s_i)\n query = \"SELECT load FROM AveragePlugLoads WHERE house_id = %d \" \\\n \"AND slice_index = %d\" % [house_id, s_i]\n\n results = execute_query(query)\n loads = results.map{|row| row[\"load\"]}\n puts \"EXECUTED: #{query}, GOT #{loads}\" if DEBUG\n sum(loads)\n...
[ "0.7070309", "0.6514944", "0.5715062", "0.5703592", "0.56761414", "0.56139916", "0.55925155", "0.55877936", "0.5546139", "0.5539602", "0.5539602", "0.5480567", "0.54735357", "0.54427886", "0.54272914", "0.5405264", "0.5363349", "0.5356967", "0.5348985", "0.53477824", "0.53259...
0.7381988
0
"In case of a housebased prediction the avgLoad(s_i) is calculated as a sum of average values for each plug within the house."
def calculate_house_avgLoad(s_i) query = "SELECT load FROM AveragePlugLoads WHERE house_id = %d " \ "AND slice_index = %d" % [house_id, s_i] results = execute_query(query) loads = results.map{|row| row["load"]} puts "EXECUTED: #{query}, GOT #{loads}" if DEBUG sum(loads) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_plug_avgLoad(s_i, h_id = house_id, hh_id = household_id, p_id = plug_id)\n query = \"SELECT load FROM AveragePlugLoads WHERE house_id = %d \" \\\n \"AND household_id = %d \"\\\n \"AND plug_id = %d \"\\\n \"AND slice_index = %d\" % [h_id, hh_id, p_id, s_i]\n results = execute_query(quer...
[ "0.70620567", "0.67588174", "0.64534056", "0.6196577", "0.6170093", "0.6051528", "0.5949087", "0.5929447", "0.5897647", "0.58920723", "0.5872867", "0.5865916", "0.5852233", "0.5850626", "0.58442944", "0.5807122", "0.57988685", "0.57956445", "0.57865053", "0.5776777", "0.57497...
0.7835278
0
return linked post types
def oz_post_types(sep = ', ') TYPES.dup.keys.map { |type| post_type_link(type + 's', type) }.join(sep) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oz_post_types(sep = ', ')\r\n TYPES.dup.keys.map { |type| post_type_link(type + 's', type) }.join(sep)\r\n end", "def get_link_types\n Occi::Log.debug(\"Getting link types ...\")\n collection = @model.get Occi::Core::Link.kind\n collection.kinds.collect { |kind| kind.term }\n ...
[ "0.7156962", "0.7088653", "0.68233806", "0.67045814", "0.65610915", "0.64026326", "0.6255818", "0.6213766", "0.61743385", "0.61743385", "0.6111263", "0.6068886", "0.6057794", "0.60248953", "0.6008169", "0.5977859", "0.59611046", "0.59472966", "0.59381604", "0.59350204", "0.59...
0.71292436
1
builds a link to a list of posts for a type
def post_type_link(text, type = nil) type = text if type.nil? link_to text, :controller => 'tumble', :action => 'list_by_post_type', :type => type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_type_link(text, type = nil)\r\n type = text if type.nil?\r\n link_to text, :controller => 'post', :action => 'list_by_type',\r\n :type => type\r\n end", "def url_for_list(type); end", "def link_for(type)\n if link = self.links.find { |link| link.type == type }\n ...
[ "0.78964734", "0.6718187", "0.6492731", "0.62836146", "0.61639243", "0.588572", "0.5879869", "0.5848769", "0.5816558", "0.5801572", "0.57999563", "0.5773242", "0.5702805", "0.57008135", "0.56912184", "0.56751776", "0.5673303", "0.5637062", "0.5597933", "0.5595053", "0.5589458...
0.7851966
1
add a + or in front of tags if we're looking at a tag's listing
def add_tag_link(tag) cur_tag = params[:tag] if cur_tag and !cur_tag.split.select { |x| x =~ /^#{tag}$/ }.empty? link = cur_tag.split if link.size == 1 link_to('-', { :controller => 'tumble', :action => 'list' }, :class => 'remove-tag') else link = link.reject { |x| x =~ /^#{ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_tag_link(tag)\r\n cur_tag = params[:tag]\r\n if cur_tag and !cur_tag.split.select { |x| x =~ /^#{tag}$/ }.empty?\r\n link = cur_tag.split\r\n if link.size == 1\r\n link_to('-', '/', :class => 'remove-tag')\r\n else\r\n link = link.reject { |x| x =~ /^#{tag}$/ } * '+'\r\n ...
[ "0.6413991", "0.629976", "0.629976", "0.6215002", "0.6023971", "0.60063547", "0.60063547", "0.5989124", "0.59389716", "0.5931349", "0.5931349", "0.59080946", "0.59080946", "0.5887412", "0.58698356", "0.5790172", "0.5770041", "0.5764147", "0.5727113", "0.5710332", "0.56976235"...
0.66517746
0
Freeze nested_attributes_module when freezing model class.
def freeze @nested_attributes_module.freeze if @nested_attributes_module super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deep_freeze!\n replace deep_thaw.deep_freeze\n end", "def freeze\n @attributes.freeze; self\n end", "def freeze\n @attributes.freeze; self\n end", "def freeze\n @attributes.freeze\n self\n end", "def freeze\n freeze!\n attributes.freeze\n super\n end",...
[ "0.71698904", "0.7078661", "0.7078661", "0.69842154", "0.692393", "0.6695365", "0.6554488", "0.64775944", "0.6406256", "0.63707834", "0.6354136", "0.6287913", "0.6227343", "0.614261", "0.6055234", "0.60322404", "0.6015884", "0.60072005", "0.60026133", "0.6002393", "0.59924805...
0.8264114
0
Allow nested attributes to be set for the given associations. Options: :destroy :: Allow destruction of nested records. :fields :: If provided, should be an Array or proc. If it is an array, restricts the fields allowed to be modified through the association_attributes= method to the specific fields given. If it is a p...
def nested_attributes(*associations, &block) include(@nested_attributes_module ||= Module.new) unless @nested_attributes_module opts = associations.last.is_a?(Hash) ? associations.pop : {} reflections = associations.map{|a| association_reflection(a) || raise(Error, "no association named #{...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accepts_nested_attributes_for(*args)\n options = args.extract_options!.dup\n options[:autosave] = true if options[:autosave].nil?\n\n options[:reject_if] = REJECT_ALL_BLANK_PROC if options[:reject_if] == :all_blank\n args.each do |name|\n meth = \"#{name}_attribut...
[ "0.66340685", "0.6249431", "0.61148727", "0.6038243", "0.6037746", "0.60309494", "0.59992594", "0.5982055", "0.5842697", "0.58088535", "0.5784925", "0.5766009", "0.56795037", "0.56550705", "0.56430876", "0.5637941", "0.5517001", "0.55024666", "0.5501969", "0.54762983", "0.545...
0.7377025
0
Add a nested attribute setter method to a module included in the class.
def def_nested_attribute_method(reflection) @nested_attributes_module.class_eval do define_method("#{reflection[:name]}_attributes=") do |v| set_nested_attributes(reflection[:name], v) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end", "def struct_writer(method)\n ...
[ "0.622819", "0.6096109", "0.60876536", "0.6043854", "0.6002986", "0.6002986", "0.59794307", "0.5798184", "0.5788058", "0.5777639", "0.5699977", "0.56934685", "0.56852794", "0.5669649", "0.56505597", "0.5646062", "0.56087625", "0.5593785", "0.55887556", "0.5585697", "0.5552459...
0.6476925
0
Check that the keys related to the association are not modified inside the block. Does not use an ensure block, so callers should be careful.
def nested_attributes_check_key_modifications(meta, obj) reflection = meta[:reflection] keys = reflection.associated_object_keys.map{|x| obj.get_column_value(x)} yield unless keys == reflection.associated_object_keys.map{|x| obj.get_column_value(x)} raise(Error, "Modi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_not_contain!(*keys, **options, &block)\n before_validation do\n JSONAPIonify::Continuation.new(**options).check(self) do\n keys += self.keys.select(&block) if block_given?\n invalid_keys = self.keys.map(&:to_sym) & keys.map(&:to_sym)\n i...
[ "0.58898985", "0.5704086", "0.5695653", "0.5616347", "0.55527675", "0.55387884", "0.55334777", "0.55042857", "0.54869545", "0.5468377", "0.54384565", "0.5421087", "0.54160994", "0.5405678", "0.5369046", "0.5341875", "0.5341875", "0.5341875", "0.5341875", "0.5332967", "0.53165...
0.73244625
0
Take an array or hash of attribute hashes and set each one individually. If a hash is provided it, sort it by key and then use the values. If there is a limit on the nested attributes for this association, make sure the length of the attributes_list is not greater than the limit.
def nested_attributes_list_setter(meta, attributes_list) attributes_list = attributes_list.sort_by(&:to_s).map{|k,v| v} if attributes_list.is_a?(Hash) if (limit = meta[:limit]) && attributes_list.length > limit raise(Error, "number of nested attributes (#{attributes_list.length}) exceeds...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_attributes_on_list(sorted_list, attribute_list, options={})\n \n unless attribute_list.blank?\n 0.upto(sorted_list.length - 1) {|idx|\n if sorted_list[idx]\n if (attr = attribute_list[idx].delete_if{|x, y| x.to_s == 'number'}).any?\n sorted_lis...
[ "0.6355446", "0.6297687", "0.623617", "0.61620045", "0.60875994", "0.6040318", "0.60176504", "0.59778804", "0.5956897", "0.5947333", "0.594544", "0.59200746", "0.59190184", "0.5916739", "0.59060603", "0.5904806", "0.5894702", "0.58890367", "0.5873946", "0.5846756", "0.5835919...
0.7359234
0
Modify the associated object based on the contents of the attributes hash: If a :transform block was given to nested_attributes, use it to modify the attribute hash. If a block was given to nested_attributes, call it with the attributes and return immediately if the block returns true. If a primary key exists in the at...
def nested_attributes_setter(meta, attributes) if a = meta[:transform] attributes = a.call(self, attributes) end return if (b = meta[:reject_if]) && b.call(attributes) modified! reflection = meta[:reflection] klass = reflection.associated_class ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nested_attributes_update_attributes(meta, obj, attributes)\n nested_attributes_check_key_modifications(meta, obj) do\n nested_attributes_set_attributes(meta, obj, attributes)\n end\n end", "def assign_to_or_destroy_nested_attributes_record(association_name, id, attributes,...
[ "0.6240173", "0.59159535", "0.57222104", "0.5692711", "0.5418203", "0.5380863", "0.53000736", "0.5299417", "0.5286306", "0.5257881", "0.52307266", "0.52283514", "0.5124065", "0.5121437", "0.50969493", "0.5055096", "0.50542754", "0.50444853", "0.5017012", "0.5012849", "0.50127...
0.74003685
0
Update the given object with the attributes, validating it when the parent object is validated and saving it when the parent is saved. Returns the object updated.
def nested_attributes_update(meta, obj, attributes) nested_attributes_update_attributes(meta, obj, attributes) delay_validate_associated_object(meta[:reflection], obj) # Don't need to validate the object twice if :validate association option is not false # and don't want to valid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_attributes(params = {})\n super validate_attributes(params)\n end", "def update\n @parent = Parent.find(params[:id])\n\n respond_to do |format|\n if @parent.update_attributes(params[:parent])\n format.html { redirect_to parents_url, notice: 'Parent was successfully updated.' ...
[ "0.6521088", "0.647589", "0.6450124", "0.6450124", "0.6450124", "0.6450124", "0.6450124", "0.6357503", "0.6339492", "0.6300395", "0.6243063", "0.6239758", "0.62191135", "0.6045024", "0.60401714", "0.60230273", "0.60063726", "0.5993975", "0.5990598", "0.5988608", "0.5970228", ...
0.70474374
0
call processing for the given events list and release locks
def process( events, process_stat, settings = { :keep_processed => true} ) successfull = [] unsuccessfull = [] process_stat.start( events.length ) events.each do |event| begin if yield event # should be commented to keep processed records @conn.exec(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process!\n events.each(&:process!)\n end", "def process_events\n until @dead\n event = next_event\n notify_listeners(event)\n event.dispatch\n end\n rescue Exception => ex\n Logger.error \"Error while running event: #{Logger.format_error(ex)}\"\n end", "def...
[ "0.6489524", "0.6303103", "0.61641574", "0.6073796", "0.5972219", "0.59443325", "0.59201324", "0.58429927", "0.5834331", "0.5813353", "0.5778142", "0.5761723", "0.57330734", "0.5663585", "0.5633827", "0.562309", "0.5611884", "0.55648714", "0.5477105", "0.54553384", "0.5454675...
0.6582892
0
ex. arr=[1, 3, 5] and Y=2 should count 2
def greater_than(arr, y) count = 0 arr.each { |i| count +=1 if i > y} count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_elements(arr)\n count = 0\n\n arr.each do |x|\n if arr.include?(x+1)\n count += 1\n end\n end\n \n count\nend", "def cnts a\n r = []\n found = false\n a.each do |x|\n r.each do |y|\n if y[0] === x\n y[1] += 1\n found = true\n break...
[ "0.69431204", "0.6666747", "0.6640746", "0.6620456", "0.660547", "0.6603589", "0.6593531", "0.6537413", "0.6530336", "0.649244", "0.64908916", "0.64778155", "0.6476009", "0.64711833", "0.6465165", "0.6452966", "0.644211", "0.64341027", "0.6419104", "0.6412472", "0.6399966", ...
0.6749362
1