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 |
|---|---|---|---|---|---|---|
DELETE /medios/1 DELETE /medios/1.xml | def destroy
@medio = Medio.find(params[:id])
@medio.destroy
respond_to do |format|
format.html { redirect_to(medios_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @media = Media.find(params[:id])\n @media.destroy\n\n respond_to do |format|\n format.html { redirect_to(medias_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @media_path = MediaPath.find(params[:id])\n @media_path.destroy\n\n respond_to do |format|\n... | [
"0.7174499",
"0.69915",
"0.6802434",
"0.6747216",
"0.67451054",
"0.6705609",
"0.66445285",
"0.6599979",
"0.6590596",
"0.65742546",
"0.6552022",
"0.65395105",
"0.65306634",
"0.65110093",
"0.65045446",
"0.6504202",
"0.6471218",
"0.6467759",
"0.64550865",
"0.6432545",
"0.6420218... | 0.72611636 | 0 |
GET /mrvs GET /mrvs.json | def index
@mrvs = Mrv.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @vdms = Vdm.all\n\n render json: @vdms\n end",
"def show\n render json: @vdm\n end",
"def index\n @nvs_mig_statuses = NvsMigStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nvs_mig_statuses }\n end\n end",
"def index... | [
"0.67215484",
"0.6169951",
"0.61000377",
"0.6072159",
"0.6063038",
"0.59794366",
"0.59678733",
"0.59669685",
"0.5959277",
"0.5884774",
"0.57827985",
"0.57717305",
"0.5760343",
"0.5759719",
"0.5751793",
"0.57012916",
"0.56939965",
"0.56845754",
"0.56821704",
"0.56692433",
"0.5... | 0.7374491 | 0 |
POST /mrvs POST /mrvs.json | def create
@mrv = Mrv.new(mrv_params)
respond_to do |format|
if @mrv.save
format.html { redirect_to @mrv, notice: 'Mrv was successfully created.' }
format.json { render :show, status: :created, location: @mrv }
else
format.html { render :new }
format.json { render js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @ivmr = Ivmr.new(ivmr_params)\n\n respond_to do |format|\n if @ivmr.save\n format.html { redirect_to @ivmr, notice: 'Ivmr was successfully created.' }\n format.json { render :show, status: :created, location: @ivmr }\n else\n format.html { render :new }\n fo... | [
"0.5943023",
"0.5795398",
"0.57636374",
"0.5620357",
"0.54488385",
"0.541512",
"0.5382888",
"0.53810996",
"0.5358649",
"0.53274775",
"0.5286301",
"0.5262029",
"0.5258995",
"0.5235176",
"0.5223858",
"0.52226317",
"0.522083",
"0.5207565",
"0.51978457",
"0.5185768",
"0.51730245"... | 0.6301226 | 0 |
DELETE /mrvs/1 DELETE /mrvs/1.json | def destroy
@mrv.destroy
respond_to do |format|
format.html { redirect_to mrvs_url, notice: 'Mrv was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete(vmname)\n uri = @uri + \"/#{vmname}?api-version=#{api_version}\"\n uri\n end",
"def destroy\n @nvs_mig_status = NvsM... | [
"0.69256777",
"0.69221145",
"0.67772174",
"0.6759893",
"0.6721225",
"0.6693724",
"0.66442835",
"0.66274095",
"0.6585599",
"0.6573744",
"0.6564632",
"0.65583014",
"0.6554817",
"0.65507877",
"0.65427524",
"0.6542192",
"0.65342635",
"0.65249634",
"0.65133387",
"0.65131456",
"0.6... | 0.70368123 | 0 |
Returns true if `f` looks like a sqlite file | def looks_a_sqlite_file?(f)
return false unless Path.like?(f)
path = Path(f)
path.parent.directory? and ['db', 'sqlite', 'sqlite3'].include?(path.ext)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file?(f)\n File.file? f\n end",
"def file?() end",
"def sqlite?\n env_db == :sqlite3\nend",
"def uses_sqlite3?\n any? { |m| m.respond_to?(:uses_sqlite3?) && m.uses_sqlite3? }\n end",
"def open?(filename); end",
"def sqlite_adapter?\n @adapter && (@adapter.downcase == '... | [
"0.67073894",
"0.6347387",
"0.6291569",
"0.62331843",
"0.6049642",
"0.6039398",
"0.5981187",
"0.591567",
"0.5909579",
"0.5905028",
"0.5850049",
"0.58441013",
"0.5838948",
"0.58100677",
"0.5787242",
"0.57846457",
"0.5754974",
"0.5748477",
"0.57471097",
"0.5729115",
"0.57246757... | 0.87651443 | 0 |
retrieve the list of tags with weight (i.e. count), this is useful for creating tag clouds | def tags_with_weight
tags_index_collection.master.find.to_a.map{ |r| [r["_id"], r["value"]] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags_with_weight\n index_tags_now! if need_to_index_tags and @do_tags_index\n tags_index_collection.find.sort(_id: 1).to_a.map{ |r| [r[\"_id\"], r[\"matches\"]] }\n end",
"def tags_with_weight_for(context, conditions={})\n aggregation_database_collection_for(context).find({value: {\"$gt\"... | [
"0.7548483",
"0.7389459",
"0.6853659",
"0.6853659",
"0.6853659",
"0.67390007",
"0.6674119",
"0.6599801",
"0.6450078",
"0.6314934",
"0.63123673",
"0.63123673",
"0.63123673",
"0.6273708",
"0.6273409",
"0.6236733",
"0.6229018",
"0.6144785",
"0.6144785",
"0.6072249",
"0.60603255"... | 0.7415611 | 1 |
Tests than an exception is raised if the party is created with an array of a single character. | def test_exception_raised_if_array_of_one_element
assert_raises ArgumentError do
Party.new([Character.new])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_party_can_be_created_with_characters_array\n party = Party.new([Character.new(BLANK_RACE), Character.new(BLANK_RACE), Character.new(BLANK_RACE)])\n assert_equal(3, party.length, \"Should be able to create a party from a characters array\")\n end",
"def test_exception_raised_when_invalid_object\n ... | [
"0.7407613",
"0.73687273",
"0.6998872",
"0.67997897",
"0.67316103",
"0.65051013",
"0.6446705",
"0.6425667",
"0.63844067",
"0.6245082",
"0.61558294",
"0.5916145",
"0.5660833",
"0.56014556",
"0.55797267",
"0.54077435",
"0.5391829",
"0.53839344",
"0.5298753",
"0.52371776",
"0.52... | 0.76410794 | 0 |
Tests that a party can be created from a characters array | def test_party_can_be_created_with_characters_array
party = Party.new([Character.new(BLANK_RACE), Character.new(BLANK_RACE), Character.new(BLANK_RACE)])
assert_equal(3, party.length, "Should be able to create a party from a characters array")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_exception_raised_when_invalid_object\n assert_raises ArgumentError do\n Party.new(\"Hello\") # Not a Characters array\n end\n\n # Not all array elements are characters\n assert_raises ArgumentError do\n Party.new([Character.new, Character.new, \"hello\"])\n end\n end",
"... | [
"0.6738987",
"0.6606277",
"0.6542336",
"0.6271586",
"0.61213046",
"0.5993081",
"0.5905081",
"0.58952814",
"0.5869491",
"0.58087784",
"0.5781694",
"0.5760248",
"0.5717097",
"0.5635354",
"0.56120783",
"0.5603077",
"0.55252874",
"0.5404228",
"0.5388545",
"0.5356701",
"0.535",
... | 0.7959013 | 0 |
Test that an exception is raised if a party is created with a character that belongs to another party. | def test_exception_if_character_already_in_party
character = Character.new(BLANK_RACE)
Party.new([character, Character.new(BLANK_RACE)])
assert_raises CharacterAlreadyInParty do
Party.new([Character.new(BLANK_RACE), character, Character.new(BLANK_RACE)])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_exception_if_repeated_character\n character = Character.new(BLANK_RACE)\n\n assert_raises CharacterAlreadyInParty do\n Party.new([Character.new(BLANK_RACE), character, character, Character.new(BLANK_RACE)])\n end\n end",
"def test_exception_if_character_already_in_party_when_added\n ch... | [
"0.81991625",
"0.81803143",
"0.77192575",
"0.7469864",
"0.72061706",
"0.7184206",
"0.69660467",
"0.67555064",
"0.67168754",
"0.66793364",
"0.65814877",
"0.64071965",
"0.6304768",
"0.62493795",
"0.6160848",
"0.57454616",
"0.57304436",
"0.57274264",
"0.5713617",
"0.57107437",
"... | 0.84725094 | 0 |
Tests that an exception is raised if a party is created with a characters array which size exceeds the party's max allowed size. | def test_exception_raised_when_creating_a_too_big_party
assert_raises ArgumentError do
characters = []
(Party::MAX_SIZE + 1).times { characters << Character.new }
Party.new(characters)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_exception_if_party_full\n characters = []\n (Party::MAX_SIZE).times { characters << Character.new(BLANK_RACE) }\n party = Party.new(characters)\n\n assert_raises PartyFull do\n party << Character.new(BLANK_RACE)\n end\n end",
"def test_party_can_be_created_with_characters_array\n ... | [
"0.7523359",
"0.6815769",
"0.6706855",
"0.64379203",
"0.6169742",
"0.5977158",
"0.59218335",
"0.5850751",
"0.5771363",
"0.5718216",
"0.57058173",
"0.56804174",
"0.5655678",
"0.56545126",
"0.56175977",
"0.55902916",
"0.55874276",
"0.5568971",
"0.5537095",
"0.55127656",
"0.5511... | 0.82274586 | 0 |
Tests that the array returned by the characters property of the party is a clone or copy and not the internal array and that no characters can be added directly to the party. | def test_array_copy_is_returned
party = Party.new([Character.new(BLANK_RACE), Character.new(BLANK_RACE)])
length = party.length
characters = party.characters
assert_equal(length, characters.length, "The returned array length should be the same size as the party size")
characters << Character.new(B... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_exception_when_add_to_dispersed_party\n character1 = Character.new(BLANK_RACE)\n character2 = Character.new(BLANK_RACE)\n\n party = Party.new([character1, character2])\n party.remove(character1)\n\n assert_raises PartyHasDispersed do\n party << character1\n end\n end",
"def test_... | [
"0.5983695",
"0.59746516",
"0.5930834",
"0.5841346",
"0.5779275",
"0.5621619",
"0.5563491",
"0.55600166",
"0.54715085",
"0.54315066",
"0.5381196",
"0.53350127",
"0.5313163",
"0.5313163",
"0.5313163",
"0.5313163",
"0.5313163",
"0.5313163",
"0.5313163",
"0.5313163",
"0.5313163"... | 0.75234777 | 0 |
Tests that an exception is raised when a non character object is added to a party. | def test_exception_if_invalid_object_added
party = Party.new([Character.new(BLANK_RACE), Character.new(BLANK_RACE)])
assert_raises ArgumentError do
party << "Hello"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_exception_if_character_already_in_party_when_added\n character = Character.new(BLANK_RACE)\n Party.new([character, Character.new(BLANK_RACE)])\n party2 = Party.new([Character.new(BLANK_RACE), Character.new(BLANK_RACE)])\n\n assert_raises CharacterAlreadyInParty do\n party2 << character\n ... | [
"0.7929477",
"0.7840276",
"0.7656697",
"0.744062",
"0.73531467",
"0.71366894",
"0.70369476",
"0.66804475",
"0.6459119",
"0.62447673",
"0.6218025",
"0.5921871",
"0.5881221",
"0.5838243",
"0.58157706",
"0.5753606",
"0.57319725",
"0.57244545",
"0.57002",
"0.5676003",
"0.56611353... | 0.8021182 | 0 |
Tests than an exception is raised if an attempt is made to add a character that is already in a party to another party. | def test_exception_if_character_already_in_party_when_added
character = Character.new(BLANK_RACE)
Party.new([character, Character.new(BLANK_RACE)])
party2 = Party.new([Character.new(BLANK_RACE), Character.new(BLANK_RACE)])
assert_raises CharacterAlreadyInParty do
party2 << character
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_exception_if_repeated_character\n character = Character.new(BLANK_RACE)\n\n assert_raises CharacterAlreadyInParty do\n Party.new([Character.new(BLANK_RACE), character, character, Character.new(BLANK_RACE)])\n end\n end",
"def test_exception_if_character_already_in_party\n character = C... | [
"0.7486418",
"0.73928905",
"0.73223025",
"0.65333766",
"0.6368729",
"0.63469523",
"0.62812984",
"0.6138128",
"0.5954298",
"0.57937634",
"0.57626086",
"0.5730417",
"0.5698973",
"0.5698353",
"0.5675233",
"0.565775",
"0.56360567",
"0.5511253",
"0.54997957",
"0.54866195",
"0.5474... | 0.7685955 | 0 |
Tests that relations are created between the characters and theirs parties when parties are created or characters are added to the parties later. | def test_relationships_created
characters = [Character.new(BLANK_RACE), Character.new(BLANK_RACE), Character.new(BLANK_RACE)]
party = Party.new(characters)
characters.each do |chara|
assert_equal(party, chara.party, "Characters should be related with their party")
end
character = Character.n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_relationships_broken\n character1 = Character.new(BLANK_RACE)\n character2 = Character.new(BLANK_RACE)\n character3 = Character.new(BLANK_RACE)\n character4 = Character.new(BLANK_RACE)\n party = Party.new([character1, character2, character3, character4])\n\n party.remove(character1)\n ... | [
"0.73730487",
"0.6593066",
"0.6576801",
"0.64108396",
"0.6355198",
"0.6260072",
"0.6247362",
"0.6135577",
"0.61239094",
"0.60764444",
"0.60567164",
"0.5963445",
"0.5957186",
"0.59313166",
"0.57748413",
"0.57734567",
"0.5766527",
"0.56888235",
"0.5684422",
"0.56772655",
"0.560... | 0.822276 | 0 |
Tests that relationships are broken when a character is removed from a party or when it leaves the party | def test_relationships_broken
character1 = Character.new(BLANK_RACE)
character2 = Character.new(BLANK_RACE)
character3 = Character.new(BLANK_RACE)
character4 = Character.new(BLANK_RACE)
party = Party.new([character1, character2, character3, character4])
party.remove(character1)
assert_nil(c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_party_disperses_if_all_removed\n character1 = Character.new(BLANK_RACE)\n character2 = Character.new(BLANK_RACE)\n\n party = Party.new([character1, character2])\n party.remove(character1)\n\n assert_equal(true, party.dispersed?, \"Party should have been dispersed\")\n assert_nil(characte... | [
"0.76269835",
"0.6841924",
"0.67447615",
"0.66699064",
"0.6445679",
"0.61447173",
"0.6129134",
"0.60970557",
"0.6004353",
"0.5781901",
"0.56060976",
"0.55379516",
"0.5451502",
"0.5435479",
"0.5430833",
"0.5385418",
"0.53261036",
"0.5312121",
"0.5311485",
"0.52743083",
"0.5266... | 0.87794924 | 0 |
Tests that the remove method doesn't raise an exception if a character that is not member of the party is removed and that the remove! (bang) method does | def test_remove_without_and_with_exception
party = Party.new([Character.new(BLANK_RACE), Character.new(BLANK_RACE)])
character = Character.new(BLANK_RACE)
party.remove(character)
assert_raises CharacterNotFound do
party.remove!(character)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_party_disperses_if_all_removed\n character1 = Character.new(BLANK_RACE)\n character2 = Character.new(BLANK_RACE)\n\n party = Party.new([character1, character2])\n party.remove(character1)\n\n assert_equal(true, party.dispersed?, \"Party should have been dispersed\")\n assert_nil(characte... | [
"0.7416932",
"0.70849746",
"0.69449705",
"0.64033234",
"0.6371987",
"0.6346133",
"0.6128582",
"0.59595597",
"0.5847463",
"0.5838507",
"0.5798711",
"0.5788836",
"0.57791793",
"0.57421166",
"0.57326657",
"0.5658708",
"0.5624399",
"0.55888546",
"0.55702853",
"0.5505326",
"0.5495... | 0.76069033 | 0 |
Tests that the the party leader is set when the party is created. | def test_leader_when_creating
character = Character.new(BLANK_RACE)
party = Party.new([character, Character.new(BLANK_RACE), Character.new(BLANK_RACE)])
assert_equal(character, party.leader, "The first character in the array should be appointed party leader")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_leader(user)\n participant = Participant.new(school_id: self.id, user_id: user.id)\n participant.role_id = 1\n participant.accepted = 2\n participant.prereq = true\n participant.save\n end",
"def commandnewgame_partysetup\r\n # Set up initial party\r\n $game_party.setup_starting_... | [
"0.6635107",
"0.6502011",
"0.6132963",
"0.6122508",
"0.6117061",
"0.60724455",
"0.60112137",
"0.598079",
"0.59272754",
"0.58700496",
"0.5865949",
"0.5855633",
"0.58536065",
"0.58502007",
"0.5824598",
"0.5824598",
"0.5824598",
"0.5824598",
"0.5824598",
"0.57754713",
"0.5706941... | 0.66588223 | 0 |
Tests that a new party leader is appointed if the current party leader is removed from party and that the party leader is unchanged when another character is removed. | def test_leader_set_on_remove
character1 = Character.new(BLANK_RACE)
character2 = Character.new(BLANK_RACE)
character3 = Character.new(BLANK_RACE)
party = Party.new([character1, character2, character3])
party.remove(character1)
assert_equal(character2, party.leader, "`character2` should have be... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_party_disperses_if_all_removed\n character1 = Character.new(BLANK_RACE)\n character2 = Character.new(BLANK_RACE)\n\n party = Party.new([character1, character2])\n party.remove(character1)\n\n assert_equal(true, party.dispersed?, \"Party should have been dispersed\")\n assert_nil(characte... | [
"0.7663573",
"0.6538337",
"0.6201212",
"0.6192222",
"0.60492116",
"0.6029395",
"0.59997743",
"0.59142315",
"0.57159483",
"0.5711131",
"0.57009184",
"0.5689359",
"0.5651256",
"0.56313556",
"0.5607475",
"0.5607475",
"0.56054354",
"0.5590049",
"0.55609757",
"0.55207455",
"0.5504... | 0.78719574 | 0 |
Tests that an exception is raised when an attempt is made to add a character to a dispersed party. | def test_exception_when_add_to_dispersed_party
character1 = Character.new(BLANK_RACE)
character2 = Character.new(BLANK_RACE)
party = Party.new([character1, character2])
party.remove(character1)
assert_raises PartyHasDispersed do
party << character1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_exception_if_character_already_in_party_when_added\n character = Character.new(BLANK_RACE)\n Party.new([character, Character.new(BLANK_RACE)])\n party2 = Party.new([Character.new(BLANK_RACE), Character.new(BLANK_RACE)])\n\n assert_raises CharacterAlreadyInParty do\n party2 << character\n ... | [
"0.7478991",
"0.74553466",
"0.7386286",
"0.73378956",
"0.6922135",
"0.6733695",
"0.6312587",
"0.6206651",
"0.607106",
"0.60321087",
"0.60012203",
"0.5986382",
"0.5946889",
"0.5888899",
"0.5872504",
"0.5869676",
"0.5859437",
"0.58540595",
"0.5690784",
"0.5675278",
"0.5639108",... | 0.8012686 | 0 |
Recursively merge hash1 with hash2. | def recursive_hash_merge(hash1, hash2)
hash1.merge(hash2) {|k,o,n| (o.is_a?(Hash)) ? recursive_hash_merge(o,n) : n}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deep_merge_hashes(master_hash, other_hash); end",
"def deep_merge(*other_hashes, &blk); end",
"def _deep_merge(hash, other_hash); end",
"def _deep_merge(hash1, hash2)\n hash1.merge(hash2) do |key, oldval, newval|\n if oldval.instance_of?(Hash) && newval.instance_of?(Hash)\n _de... | [
"0.7924568",
"0.7641346",
"0.7596485",
"0.7589134",
"0.7573661",
"0.7573661",
"0.75696117",
"0.75696117",
"0.75696117",
"0.75307196",
"0.7504846",
"0.74236625",
"0.74217874",
"0.7331102",
"0.72837913",
"0.72341365",
"0.7219828",
"0.72084594",
"0.7159273",
"0.708908",
"0.70883... | 0.82217044 | 0 |
Sets the property's army type. Also modifies the graphic on the map. If arg "army" = 0, then the method will treat the property as unowned. | def army=(army)
# Get the tile ID
tile = $game_map.data[@x, @y, 0]
# Find which army owned this property before (0 = unowned)
prev_army = 0
if !@army.is_a?(Integer)
prev_army = @army.id
# Remove this property from army
@army.owned_props.delete(self)
else
prev_army = @army... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def army=(army)\n # Get the tile ID\n tile = $game_map.data[@x, @y, 0]\n # If army lost, then turn HQ into city\n result = false\n if army.is_a?(Army)\n if (@army.is_a?(Integer) and @army != army.id) or @army != army\n result = true\n end\n else\n if (@army.is_a?(Integer) an... | [
"0.6264895",
"0.5898873",
"0.57259256",
"0.56064004",
"0.55215085",
"0.5513656",
"0.5439414",
"0.5439414",
"0.5438686",
"0.5298166",
"0.5298074",
"0.5275321",
"0.5237839",
"0.5227345",
"0.5186662",
"0.5186662",
"0.5179198",
"0.5136887",
"0.511462",
"0.5103895",
"0.5091008",
... | 0.6682583 | 0 |
create_moab_dir Creates MOAB preservation directory structure and saves metadata there | def create_moab_dirs()
target_path = manifest_path(self.object.id, self.version)
if File.directory?(target_path)
err_string = "The Moab directory #{target_path} for "\
"#{self.object.id} version #{self.version} already exists"
Rails.logger.error(err_string)
raise DRI::Exce... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_moab_dirs\n target_path = manifest_path(object.alternate_id, version)\n if File.directory?(target_path)\n err_string = \"The Moab directory #{target_path} for \"\\\n \"#{object.alternate_id} version #{version} already exists\"\n Rails.logger.error(err_string)\n ra... | [
"0.8004756",
"0.6364292",
"0.6311007",
"0.62174386",
"0.6210226",
"0.61639106",
"0.6156288",
"0.61438537",
"0.6127662",
"0.6041013",
"0.6041013",
"0.601341",
"0.6012258",
"0.60068834",
"0.5958146",
"0.59409577",
"0.59401417",
"0.59331405",
"0.5930573",
"0.5924735",
"0.5917556... | 0.78756124 | 1 |
moabify_datastream Takes two paramenters name (datastream and file name) datastream (the value for that key from the datastreams hash | def moabify_datastream(name, datastream)
data = datastream.content
return if data.nil?
begin
File.write(File.join(metadata_path(self.object.id, self.version), "#{name.to_s}.xml"), data)
rescue StandardError => e
Rails.logger.error "unable to write datastream: #{e}"
false... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moabify_datastream(name, datastream)\n data = datastream.to_xml\n return if data.nil?\n\n begin\n File.write(File.join(metadata_path(object.alternate_id, version), \"#{name}.xml\"), data)\n rescue StandardError => e\n Rails.logger.error \"unable to write datastream: #{e}\"\n ... | [
"0.7044384",
"0.57960075",
"0.5513374",
"0.5252808",
"0.51522046",
"0.51018256",
"0.49865815",
"0.49345154",
"0.49343434",
"0.49067384",
"0.4894568",
"0.48890862",
"0.48637977",
"0.4861272",
"0.48599586",
"0.48309788",
"0.48281267",
"0.48210528",
"0.4809337",
"0.4764042",
"0.... | 0.7040117 | 1 |
update_manifests changes: hash with keys :added, :modified and :deleted. Each is an array of filenames (excluding directory paths) | def update_manifests(changes)
current_manifest_path = manifest_path(object.id, self.version)
previous_manifest_path = manifest_path(object.id, self.version.to_i-1)
last_version_inventory = Moab::FileInventory.new(type: 'version', version_id: self.version.to_i-1, digital_object_id: @object.id)
l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_manifests(changes)\n previous_version_id, previous_manifest_path = find_previous_manifest_path(version)\n @version_inventory = file_inventory_from_path(previous_version_id, previous_manifest_path)\n @version_inventory.version_id = version\n\n perform_changes(changes)\n\n signatu... | [
"0.68539345",
"0.64677083",
"0.6252806",
"0.621391",
"0.61391664",
"0.61349237",
"0.6093256",
"0.5905759",
"0.585047",
"0.5822006",
"0.5795297",
"0.57926947",
"0.57561415",
"0.56887704",
"0.567876",
"0.56365806",
"0.56234217",
"0.5609898",
"0.5600256",
"0.55856484",
"0.555611... | 0.7587562 | 0 |
This function deletes a transaction based on an ID that is passed in | def delete()
sql = "DELETE FROM transactions
WHERE id = $1"
values = [@id]
SqlRunner.run(sql, values)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_by_id(id)\n delete_payment_token_by_id(id)\n end",
"def destroy\n Transaction.find(params[:id]).try(:destroy)\n\n head :no_content\n end",
"def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy!\n redirect_to transactions_url\n end",
"... | [
"0.7103155",
"0.70229465",
"0.69054455",
"0.6788495",
"0.67366064",
"0.6658788",
"0.65974337",
"0.6576521",
"0.656646",
"0.654493",
"0.654493",
"0.654493",
"0.654493",
"0.654493",
"0.654493",
"0.654493",
"0.6527481",
"0.6527481",
"0.6527481",
"0.6527481",
"0.6527481",
"0.65... | 0.7143208 | 0 |
Function to add money to user's account | def add_money
# get current user's money
@user = current_user
@money = @user.money
# get refill limit
@allowed = @user.money_refill
# if limit has not been reached, add money to account
if @allowed > 0
@user.money = @money + 1000
@user.money_refill = @allowed - 1
@user.save
gflash :success =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_balance\n self.user.balance += self.price\n self.user.save\n end",
"def add_credit\n#\t\tcurrent_user.update(balance: current_user.balance + params[:amount])\n\tend",
"def add_money\n @total += fee\n end",
"def console_add_money(amount)\n credits.create!(amount: amount, note: \"Admin... | [
"0.7833187",
"0.7789063",
"0.76869535",
"0.7658642",
"0.7443759",
"0.74414206",
"0.74122554",
"0.7298077",
"0.72572666",
"0.7107844",
"0.710065",
"0.70850235",
"0.7027285",
"0.7012833",
"0.6987176",
"0.6977277",
"0.69437814",
"0.6933099",
"0.68834484",
"0.68834484",
"0.688280... | 0.82401925 | 0 |
Function that handles the reset code and resetting the password | def reset
# find user using the reset code specified
@user = User.find_by_reset_code(params[:reset_code]) unless params[:reset_code].nil?
if request.post?
# update user's password
if @user.update_attributes(:password => params[:user][:password], :password_confirmation => params[:user][:password_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_password_reset\n self.make_password_reset_code\n end",
"def password_reset_request\n end",
"def send_reset_password_instructions; end",
"def set_password_reset\n\t\tself.code = SecureRandom.urlsafe_base64\n\t\tself.expires_at = 4.hours.from_now\n\t\tself.save!\n\tend",
"def reset_password\n ... | [
"0.7903035",
"0.75090593",
"0.7470896",
"0.7426081",
"0.7423748",
"0.74229676",
"0.7418752",
"0.7418752",
"0.7362728",
"0.73607385",
"0.73314255",
"0.7323876",
"0.7321581",
"0.73093456",
"0.7183678",
"0.717641",
"0.71432304",
"0.71202904",
"0.71075064",
"0.7080304",
"0.707092... | 0.772257 | 1 |
Show sent messages function is for the show sent message box | def show_sent_message
# find message with specified ID
@message = Message.find(params[:id])
@unread_messages = Message.find(:all, :conditions => {:receiver_id => current_user.id, :unread => true})
# check if reciever is current user, security
if current_user.id == @message.sender.id
render :ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_box\n\t\t@@message_box \n\tend",
"def show\n @sent = false\n end",
"def show\n @messages = @dialog.messages\n end",
"def pbDisplayMessage(msg)\n self.visible = false\n @scene.pbDisplayMessage(msg)\n @scene.clearMessageWindow\n self.visible = true\n end",
"def show\n rend... | [
"0.69030833",
"0.684577",
"0.67712426",
"0.6713514",
"0.64382213",
"0.64035934",
"0.6394832",
"0.6372553",
"0.6360943",
"0.6263689",
"0.62581706",
"0.6250942",
"0.6224093",
"0.6224093",
"0.62006617",
"0.61945534",
"0.61798257",
"0.6175341",
"0.6154548",
"0.61148673",
"0.61148... | 0.6969152 | 0 |
Rate function for handling user ratings | def rate
# retrieve user with specified ID and rate him/her
@user = User.find(params[:id])
@user.rate(params[:stars], current_user, params[:dimension])
# automatically display the new rating
render :update do |page|
page.replace_html @user.wrapper_dom_id(params), ratings_for(@user, params.merge(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rate \n @user = User.find_from_param(params[:id])\n if @user.rateable_by?(current_user)\n @user.rate(params[:rate].to_i, current_user)\n render :layout => false, :text => \"#{@user.rating_count} votes\"\n else\n render :nothing => true, :status => :bad_request\n end\n end",
"de... | [
"0.82063544",
"0.76764804",
"0.764642",
"0.75708854",
"0.7537263",
"0.7480225",
"0.7432815",
"0.7419861",
"0.7389865",
"0.737811",
"0.73620605",
"0.7304862",
"0.7252176",
"0.7214491",
"0.7201608",
"0.71757233",
"0.71454006",
"0.71094555",
"0.70849824",
"0.70510286",
"0.703668... | 0.76842743 | 1 |
Function for the small profile page used for facebox | def small_profile
# determine which user's profile page
@user = User.find_by_login(params[:username])
# get all comments for this user
@comments = @user.user_comments
# get all user_items by this user
@user_items = current_user.user_items
respond_to do |format|
format.html
format.js { render_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile\n\t\t# determine which user's profile page\n\t\t@user = User.find_by_login(params[:username])\n\t\t# retrieve all bids by this user\n\t @bids = Bid.find_all_by_bidder_id(@user.id, :group => 'item_id')\n\t\t# get all comments for this user\n\t @comments = @user.user_comments\n\t\t# get all user_items ... | [
"0.6654205",
"0.6650277",
"0.6619161",
"0.6619161",
"0.6619161",
"0.6619161",
"0.6619161",
"0.6619161",
"0.652575",
"0.6463449",
"0.64499605",
"0.64312005",
"0.64312005",
"0.64214605",
"0.62381005",
"0.62016183",
"0.6138008",
"0.60625887",
"0.6032973",
"0.5983929",
"0.5976154... | 0.7694024 | 0 |
Function to handle unfollowing a user | def unfollow_user
# determine who is following who
@follower = current_user
@following = User.find_by_login(params[:username])
@user = @following
# if follower was self, unknown
if @follower.id == @following.id
gflash :error => "Unknown request!"
redirect_back_or_default('/')
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unfollow_user\n user = User.find(params[:user_id])\n current_user.unfollow(user)\n render_success_message(\"You are not anymore following #{user.full_name(false)}\")\n end",
"def unfollow_user\n\t\tauthenticate_current_user\n\t\t# destroy the current user from that user's followers\n\t\tUse... | [
"0.83286566",
"0.82554615",
"0.8086185",
"0.80708826",
"0.80681026",
"0.79715407",
"0.79620343",
"0.7944957",
"0.79354495",
"0.7934333",
"0.7934333",
"0.7934333",
"0.783666",
"0.7820797",
"0.7808256",
"0.7806585",
"0.77996516",
"0.769446",
"0.76942",
"0.7690536",
"0.7678674",... | 0.82698846 | 1 |
Function to handle showing user items | def show_user_items
# gather user items of current user
@user_items = UserItem.paginate :per_page => 8, :page => params[:page], :conditions => { :user_id => current_user.id }, :order => 'created_at DESC'
# gather sold items of current user
@sold = Transaction.find_all_by_seller_id(current_user.id)
# gather... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_posted_items_page\n \t@user_items = current_user.posted_items\n end",
"def show\n @user=User.find(params[:id])\n @items = @user.items\n end",
"def my_items\n if current_user && current_user.seller\n @items = current_user.items\n @view_my_items = true \n render :index\n el... | [
"0.7265297",
"0.72176874",
"0.7072554",
"0.70580083",
"0.70020586",
"0.6991849",
"0.69118625",
"0.6835276",
"0.6801571",
"0.6787826",
"0.67769605",
"0.6739403",
"0.673472",
"0.66925067",
"0.668475",
"0.6651205",
"0.66254205",
"0.6579294",
"0.6497665",
"0.6490559",
"0.6480782"... | 0.756322 | 0 |
Function to handle showing posted items | def show_posted_items_page
@user_items = current_user.posted_items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n success_post_show\n end",
"def show\n @persian_focus = !params[:persian_focus].blank? && params[:persian_focus] == 'true' ? true : false\n @return_url = session[:admin_items_index_url]\n begin\n @items = load_items(@item)\n rescue StandardError => error\n flash[:error] = erro... | [
"0.66360587",
"0.6490505",
"0.6403799",
"0.63184386",
"0.63042533",
"0.6261152",
"0.62579334",
"0.6252969",
"0.6154932",
"0.6090684",
"0.6075176",
"0.6001163",
"0.5993696",
"0.59714246",
"0.59618735",
"0.5960436",
"0.59539324",
"0.5942328",
"0.5923034",
"0.5918218",
"0.589046... | 0.7649205 | 0 |
create snapshots and copy to another region if isCopy = true | def create_snapshots(isCopy)
ec2 = AWS::EC2.new.client
#get all volumes tagged as "backup"
volumes = ec2.describe_volumes(:filters => [:name => 'tag-key', :values => ['backup']])
snapshots = []
#loop thru and create snapshots for all these volumes
if volumes
volumes.data[:volume_se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_snapshots! snaps\n # account_snapshots = account.snapshots\n # backed_up_snapshots = self.snapshots\n # backed_up_snapshot_descriptions = backed_up_snapshots.collect { |bus| bus.description }\n if snaps.count > 0\n VfSnapshots.verbose \"\\n#{snaps.count} to copy, here we go.\"\n... | [
"0.6965523",
"0.6617558",
"0.61368215",
"0.61368215",
"0.6025318",
"0.6009947",
"0.5877879",
"0.58674335",
"0.5746848",
"0.57311237",
"0.57011545",
"0.56692815",
"0.56437784",
"0.5636151",
"0.55813867",
"0.55405945",
"0.5522296",
"0.55010813",
"0.54726976",
"0.5464392",
"0.54... | 0.7168938 | 0 |
copy/backup snapshot from one region to another | def copy_snapshot(source_snapshot_id, source_region, target_region, name, description)
ec2 = AWS::EC2.new(:region => target_region).client
snap = ec2.copy_snapshot(:source_region => source_region, :source_snapshot_id => source_snapshot_id,
:description => description)
if snap
#add expiry tag if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_snapshots! snaps\n # account_snapshots = account.snapshots\n # backed_up_snapshots = self.snapshots\n # backed_up_snapshot_descriptions = backed_up_snapshots.collect { |bus| bus.description }\n if snaps.count > 0\n VfSnapshots.verbose \"\\n#{snaps.count} to copy, here we go.\"\n... | [
"0.6974551",
"0.66541874",
"0.624383",
"0.6171364",
"0.6131355",
"0.6131355",
"0.5955851",
"0.59421",
"0.59317726",
"0.58657473",
"0.58226126",
"0.582141",
"0.5686937",
"0.5666691",
"0.5655866",
"0.55988145",
"0.55703706",
"0.5564917",
"0.55645746",
"0.5560366",
"0.5546784",
... | 0.72004247 | 0 |
delete snapshots with expiring tags that are in the past | def delete_expired_snapshots(region = AWSCONFIG[:default_region])
#find snapshots with tags of expiring and less than today's date
ec2 = AWS::EC2.new(:region => region).client
snapshots = ec2.describe_snapshots(:owner_ids => ["self"], :filters => [:name => 'tag-key', :values => ['expiring']])
deleted_sn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_expired_images(region = AWSCONFIG[:default_region])\n #find images with tags of expiring and less than today's date\n ec2 = AWS::EC2.new(:region => region).client\n images = ec2.describe_images(:owners => [\"self\"], :filters => [:name => 'tag-key', :values => ['expiring']])\n deleted_images... | [
"0.7262879",
"0.7119713",
"0.6581906",
"0.6530367",
"0.6220259",
"0.6160454",
"0.6120206",
"0.6067194",
"0.60574204",
"0.6030806",
"0.60060847",
"0.5985922",
"0.59572726",
"0.593842",
"0.5925732",
"0.5895215",
"0.58922124",
"0.5881593",
"0.5829203",
"0.58054245",
"0.5793166",... | 0.81004626 | 0 |
delete images with expiring tags that are in the past | def delete_expired_images(region = AWSCONFIG[:default_region])
#find images with tags of expiring and less than today's date
ec2 = AWS::EC2.new(:region => region).client
images = ec2.describe_images(:owners => ["self"], :filters => [:name => 'tag-key', :values => ['expiring']])
deleted_images = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_image tags\n all_images_by_tags( tags ).each { | image | image.deregister } \n end",
"def expire_cache_tags(picture)\n picture.tags.each do |tag|\n expire_page :controller => '/tags', :action => :show, :id => tag\n delete_cache_pagination_tag(tag)\n end\n\n ... | [
"0.7413314",
"0.6761173",
"0.6661456",
"0.655591",
"0.6384367",
"0.63795143",
"0.6311345",
"0.63083506",
"0.6232599",
"0.62183434",
"0.6204235",
"0.6184059",
"0.61572766",
"0.6093049",
"0.60603243",
"0.60364616",
"0.5990404",
"0.5986645",
"0.5955615",
"0.59444773",
"0.5943973... | 0.7844004 | 0 |
gets value of a tag key from the object. object has to expose [:tag_set] | def get_tagvalue(object, tagkey)
value = ""
if object[:tag_set]
object[:tag_set].each do |tag|
if tag[:key] == tagkey
value = tag[:value]
break
end
end
end
value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(tag)\n @orig[tag]\n end",
"def get_tag_value tag_key_name\n tag = self.tags.joins(:tag_key).where('tagging_tag_keys.name = ?', tag_key_name).includes(:tag_value).first\n tag.try(:tag_value).try(:value)\n end",
"def get_tag_value(key)\n get_tag(key).try(:tag_value).try(:value)\n end",
"... | [
"0.7002377",
"0.69240963",
"0.6911165",
"0.6594302",
"0.6576276",
"0.6553937",
"0.6553669",
"0.6540342",
"0.6436181",
"0.64024967",
"0.63686883",
"0.63469076",
"0.6341244",
"0.6205973",
"0.62013465",
"0.61696905",
"0.61622345",
"0.61413026",
"0.6097777",
"0.6077266",
"0.60436... | 0.86654425 | 0 |
This method retrieve all the meeting participations linked with the current meeting | def get_meeting_participaton(user_to_search)
meeting_participations.find_by(user_id: user_to_search.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_participants\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n\n if user != nil and meeting != nil\n users = meeting.participants\n send_json(users)\n else\n send_error 401\n end\n end",
"def show\n @users_meetings = UsersMeeting.w... | [
"0.6711432",
"0.65526503",
"0.6369053",
"0.62959206",
"0.6265685",
"0.6245922",
"0.6245149",
"0.6232837",
"0.6191733",
"0.6188702",
"0.6178017",
"0.6178017",
"0.6178017",
"0.6178017",
"0.6178017",
"0.6178017",
"0.61727726",
"0.6157711",
"0.6157711",
"0.61481696",
"0.611839",
... | 0.6600681 | 1 |
Build an array type. Shortcut for Arrayof. | def Array(type)
Strict(::Array).of(type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_array(base_type, element_count, size = 0)\n if base_type.respond_to?(:name)\n base_type = base_type.name\n end\n return build(\"#{base_type}[#{element_count}]\", size)\n end",
"def array_of(type)\n new_class = Class.new(TypedArray)\n ... | [
"0.74484366",
"0.7261544",
"0.70356536",
"0.6622866",
"0.6517525",
"0.64021873",
"0.6357656",
"0.63074946",
"0.6296633",
"0.62685454",
"0.6267412",
"0.62639",
"0.62586594",
"0.6248222",
"0.62474144",
"0.624606",
"0.6141454",
"0.61385727",
"0.6045627",
"0.60241073",
"0.6010002... | 0.7341135 | 1 |
Build a constructor type If no constructor block given it uses .new method | def Constructor(klass, cons = nil, &block) # rubocop:disable Metrics/PerceivedComplexity:
if klass.is_a?(Type)
if cons || block
klass.constructor(cons || block)
else
klass
end
else
Nominal(klass).constructor(cons || block || klass.method(:n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(*arguments, &block)\n build_class(*arguments, &block).new(*arguments, &block)\n end",
"def build_new(*args)\n self.class.new(*args)\n end",
"def constructor(new_fn = nil, **options, &block)\n next_fn = Function[new_fn || block]\n\n if next_fn.wrapper?\n self.cla... | [
"0.67385465",
"0.6722118",
"0.6688481",
"0.657146",
"0.65713227",
"0.6541511",
"0.65381694",
"0.65283185",
"0.65283185",
"0.65283185",
"0.65283185",
"0.65283185",
"0.65283185",
"0.65283185",
"0.65283185",
"0.65283185",
"0.645564",
"0.640231",
"0.6397353",
"0.63194895",
"0.627... | 0.7204924 | 0 |
Build a nominal type | def Nominal(klass)
if klass <= ::Array
Array.new(klass)
elsif klass <= ::Hash
Hash.new(klass)
else
Nominal.new(klass)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(attrs = {})\n attrs[:type] ? attrs[:type].constantize.new(attrs) : new(attrs)\n end",
"def __type; @type == TYPE_BUILDING ? \"Building\" : \"Unit\"; end",
"def build_singleton0(type_name); end",
"def raw_type\n JavaType.new(@package, @name)\n end",
"def nonregular_type; end",
"d... | [
"0.61291337",
"0.6021723",
"0.59243643",
"0.58890146",
"0.5785332",
"0.57678014",
"0.57657516",
"0.57653403",
"0.5755484",
"0.5720417",
"0.5713637",
"0.5713637",
"0.5713637",
"0.5713637",
"0.5713637",
"0.5713637",
"0.5713637",
"0.5713637",
"0.5713637",
"0.5713637",
"0.5713637... | 0.6223959 | 0 |
Builds a constrained nominal type accepting any value that responds to given methods | def Interface(*methods)
methods.reduce(Types["nominal.any"]) do |type, method|
type.constrained(respond_to: method)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(attrs = {})\n attrs[:type] ? attrs[:type].constantize.new(attrs) : new(attrs)\n end",
"def NamedValueClass(attrs={},&block)\n klass_name, superclass = attrs.first\n attrs.delete(klass_name)\n lhs_constrain = attrs.delete(:constrain)\n target = (self.class == Object ? Kernel : self)\n t... | [
"0.5540919",
"0.51850605",
"0.51844347",
"0.5163118",
"0.50318396",
"0.5008448",
"0.49721768",
"0.49387562",
"0.48594242",
"0.47944903",
"0.4792459",
"0.47922233",
"0.4782015",
"0.47745216",
"0.47744417",
"0.4760585",
"0.47475338",
"0.47404945",
"0.47004613",
"0.4677196",
"0.... | 0.53324157 | 1 |
GET /emailusuarios/1 GET /emailusuarios/1.json | def show
@emailusuario = Emailusuario.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @emailusuario }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\tif params.has_key?(:email)\n\t\t\t@user = User.where(\"email = ?\", params[:email]).first\n\t\t\trender json: @user.to_json\n\t\telse\n\t\t\thead :no_content \n\t\tend\n\tend",
"def index\n @emails = @user.emails\n\n respond_to do |format|\n format.html # index.html.erb\n format.js... | [
"0.69048274",
"0.6889161",
"0.6889161",
"0.6827392",
"0.68202674",
"0.67519695",
"0.6690976",
"0.6672937",
"0.6664404",
"0.6664404",
"0.6585463",
"0.652329",
"0.65078676",
"0.65000707",
"0.65000707",
"0.6487208",
"0.6487208",
"0.6487208",
"0.63997185",
"0.6389748",
"0.6373675... | 0.70307 | 0 |
GET /emailusuarios/new GET /emailusuarios/new.json | def new
@emailusuario = Emailusuario.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @emailusuario }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @email = @user.emails.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end",
"def new\n @emailu = Emailu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @emailu }\n e... | [
"0.763275",
"0.7618136",
"0.74190426",
"0.74190426",
"0.74190426",
"0.74190426",
"0.72243625",
"0.7221056",
"0.718143",
"0.71312827",
"0.71230626",
"0.7051233",
"0.70409566",
"0.7039783",
"0.7017507",
"0.7008731",
"0.69487375",
"0.6912807",
"0.6876123",
"0.6873877",
"0.682655... | 0.79259163 | 0 |
DELETE /emailusuarios/1 DELETE /emailusuarios/1.json | def destroy
@emailusuario = Emailusuario.find(params[:id])
@emailusuario.destroy
respond_to do |format|
format.html { redirect_to verPerfil_path(:id => current_user.id) }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @usuarios_email.destroy\n respond_to do |format|\n format.html { redirect_to usuarios_emails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @emailu = Emailu.find(params[:id])\n @emailu.destroy\n\n respond_to do |format|\n format.html { redire... | [
"0.76001555",
"0.7204982",
"0.7061376",
"0.70324063",
"0.69565165",
"0.69565165",
"0.693179",
"0.6919994",
"0.69093096",
"0.68701077",
"0.68688154",
"0.68419904",
"0.6834844",
"0.6834224",
"0.67929643",
"0.6776158",
"0.6772046",
"0.67635125",
"0.6754922",
"0.67295194",
"0.672... | 0.7218971 | 1 |
Public: .add_point Adds one point to the player's score; resets the value. Parameters: | def add_point
@score += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AddPoints(score)\n\tscore = score + 100\nend",
"def add_point(player)\n end",
"def gain_a_point\n\n self.score += 1\n\n end",
"def add!(point)\r\n @x += point.x\r\n @y += point.y\r\n end",
"def gain_point\n @score += 1\n end",
"def gain_points\n @score += 1\n end",
"def add poi... | [
"0.75121725",
"0.7347253",
"0.73453945",
"0.7338992",
"0.73025",
"0.71196485",
"0.7113181",
"0.71089214",
"0.709263",
"0.7078312",
"0.7067452",
"0.6980805",
"0.6944307",
"0.69393814",
"0.69221",
"0.6901628",
"0.6836989",
"0.6727537",
"0.6719772",
"0.6693581",
"0.66290873",
... | 0.8335917 | 0 |
Check for any exceptional situations in stats, sound alarm if any | def report
if data[:ping].nil?
@fails += 1
if @fails >= @alert_after
alarm "Miner #{@num} did not respond to status query"
end
else
@fails = 0
if self[:mhs] < @min_speed*0.95 and upminutes > 5
alarm "Miner #{@num} performance is #{self[:mhs]}, shou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raiseSpeciesStats\n # cancels if opposing trainer or double wild battle\n return if @battle.opponent || @battle.pbParty(1).length > 1\n data = EliteBattle.get(:nextBattleData)\n # cancels if no stat raise queued\n return if data.nil? || !data.is_a?(Hash) || !data.has_key?(:STAT_RAISE) || !data[:... | [
"0.60543543",
"0.5989997",
"0.5983705",
"0.58606714",
"0.5833639",
"0.58254963",
"0.57732636",
"0.57377976",
"0.5717598",
"0.571378",
"0.56764203",
"0.56727666",
"0.56501377",
"0.558181",
"0.55743563",
"0.5548014",
"0.5546507",
"0.55051106",
"0.55049986",
"0.5482508",
"0.5459... | 0.63142115 | 0 |
Destroy all user notes. | def destroy_notes
notes = Note.where('username = ? OR username IS ?', current_user.name, nil)
notes.each do |note|
if note.is_public == true
note.update(username: nil)
note.update(is_anon: true)
else
note.destroy
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n NotesUser.where(:note_id => @note.id).each do |nt| # destroy sharing links of this note\n nt.destroy\n end\n\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n ... | [
"0.72836834",
"0.7183198",
"0.7147336",
"0.69423455",
"0.6941542",
"0.679568",
"0.679568",
"0.66708106",
"0.66189384",
"0.6615966",
"0.6563785",
"0.6551096",
"0.6548654",
"0.6537955",
"0.6527807",
"0.6510547",
"0.6509813",
"0.6497059",
"0.646546",
"0.64251393",
"0.6413466",
... | 0.81075084 | 0 |
Get links to FilesTube search result pages in form of an Array | def links
links = []
result = self.perform
links = result.ft_links
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_links_array(doc)\n links = doc.css(\".search-content .teaser-item__title a\")\n recipe_links = []\n links.each do |element|\n recipe_links << \"https://www.bbcgoodfood.com\" + element.attribute('href').value\n end\n return recipe_links\n end",
"def get_urls(search_results)\n ... | [
"0.66989595",
"0.65784794",
"0.657299",
"0.65106165",
"0.64909756",
"0.6414086",
"0.640663",
"0.63850087",
"0.634271",
"0.63290083",
"0.63033086",
"0.62841535",
"0.62720543",
"0.6265145",
"0.62569916",
"0.6233015",
"0.62152123",
"0.61999834",
"0.6179332",
"0.609061",
"0.60828... | 0.6985508 | 0 |
Question 1 Write ruby code to return the longest entry in the list supplied (words) Assume each entry in the list implements a length method that returns a Fixnum. | def longest_entry(words)
return words.max_by(&:length)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def longest_string(list_of_words)\n index = 0\n counter = 1\n if list_of_words == []\n return nil\n end\n until counter == list_of_words.length\n if list_of_words[index].length > list_of_words[counter].length\n counter += 1\n else\n index = counter\n counter += 1\n end\n end\n ret... | [
"0.8627863",
"0.8591821",
"0.85311365",
"0.8520884",
"0.8519867",
"0.8519867",
"0.8510866",
"0.8505687",
"0.8503795",
"0.84783196",
"0.8427994",
"0.84273565",
"0.83982986",
"0.8390049",
"0.83710325",
"0.8368429",
"0.8326175",
"0.8303335",
"0.8281345",
"0.8267005",
"0.8242931"... | 0.893865 | 0 |
Question 4 Write ruby code that returns true if every entry in a list of numbers are even (test the three given number arrays) | def every_even(numbers)
return numbers.all? {|a| a % 2 == 0}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def three_even?(list)\n (list.size-2).times do |n| #changed list.each to list.size-2 to grab three numbers in the code \n if list[n]%2==0 && list[n+1]%2==0 && list[n+1]%2==0 #this checks if the three number next to each other are even\n return true\n end \n end \n return false #if... | [
"0.79750884",
"0.7854646",
"0.78216547",
"0.77141947",
"0.7704399",
"0.76533383",
"0.7648398",
"0.7646561",
"0.747836",
"0.74533796",
"0.73390317",
"0.73095554",
"0.7250742",
"0.72156763",
"0.716274",
"0.71586156",
"0.7074021",
"0.70025694",
"0.70002717",
"0.699098",
"0.69908... | 0.79128623 | 1 |
Kicks off a job to generate logs asynchronously == Parameters +log_type+ Type of log to generate +query+ Query string to use for log generation +num_logs+ Number of log entries to query for (check MIN/MAX range for specifics) == Returns +String+ String containing the Job ID == Raises +Exception+ Raises an exception if ... | def generate_logs(log_type:, query: "", num_logs: MIN_LOG_REQUEST)
raise "Invalid log_type - must be one of #{PaloAlto::Models::LogEntry::SUPPORTED_TYPES}" unless PaloAlto::Models::LogEntry::SUPPORTED_TYPES.include?(log_type)
raise "num_logs must be within range (#{MIN_LOG_REQUEST}..#{MAX_LOG_REQUEST})"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log(type='Log', text)\n puts \"[#{type}] #{text}\"\n submit_log(LOG_HOST, LOG_PORT, type, text)\nend",
"def perform()\n query = Query.find(BSON::ObjectId.from_string(query_id))\n result = query.executions.find(execution_id).results.find(result_id);\n\n url = URI.parse result.result_url\n reques... | [
"0.52193403",
"0.5178804",
"0.5047556",
"0.49283773",
"0.49142385",
"0.4889873",
"0.4871",
"0.48692334",
"0.48656586",
"0.48615575",
"0.48466185",
"0.48464966",
"0.48163015",
"0.48160866",
"0.47666818",
"0.47634658",
"0.47549215",
"0.47449362",
"0.4734999",
"0.47322252",
"0.4... | 0.69248456 | 0 |
Gets the status of a log job based on the Job ID == Parameters +job_id+ ID of the job that is generating the logs == Returns +Boolean+ True if job is complete, false if job is still processing == Raises +Exception+ Raises an exception if the request is unsuccessful | def log_job_complete?(job_id:)
status = false
xml_data = get_log_xml(job_id: job_id)
response_code = get_log_xml_response_code(xml_data: xml_data)
if response_code == "success"
job_status = get_log_job_status(xml_data: xml_data)
status = true if job_statu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(job_id:)\n login_result = login\n return login_result unless login_result.success?\n\n result = SdrClient::BackgroundJobResults.show(url: Settings.sdr_api.url, job_id: job_id)\n if result[:status] != 'complete'\n nil\n elsif result[:output][:errors].present?\n error = result[:ou... | [
"0.747723",
"0.7088395",
"0.69926053",
"0.6944189",
"0.68286586",
"0.6644695",
"0.6605806",
"0.6600522",
"0.6391044",
"0.6352198",
"0.63448936",
"0.6312065",
"0.63086766",
"0.62769127",
"0.6273533",
"0.62163943",
"0.617927",
"0.6176888",
"0.6135979",
"0.6107269",
"0.61064035"... | 0.8217832 | 0 |
Gets a set of logs based on the Job ID == Parameters +job_id+ ID of the job that generated the logs == Returns +Array+ Array of Strings that are the log messages == Raises +Exception+ Raises an exception if the request is unsuccessful | def get_logs(job_id:)
logs = []
xml_data = get_log_xml(job_id: job_id)
response_code = get_log_xml_response_code(xml_data: xml_data)
if response_code == "success"
job_status = get_log_job_status(xml_data: xml_data)
if job_status == "FIN"
xm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_log(organization, jobid)\n uri = server_uri(\"/organizations/#{organization}/jobs/#{jobid}/log\")\n res_data = api_get(uri)\n @logger.debug res_data\n\n return res_data\n end",
"def read(id)\n rows = @pgsql.exec('SELECT log FROM job WHERE id = $1', [id])\n raise WTS... | [
"0.735506",
"0.64628196",
"0.63283557",
"0.62863934",
"0.6080202",
"0.60552466",
"0.6021681",
"0.59697884",
"0.59286404",
"0.5839142",
"0.5807169",
"0.5789843",
"0.5789273",
"0.5776758",
"0.57603157",
"0.5752934",
"0.5682287",
"0.56757843",
"0.56323224",
"0.5622525",
"0.56081... | 0.8345414 | 0 |
Retrieves the XML file for a given Job ID and returns the data in XML format == Parameters +job_id+ ID of the job to retrieve data for == Returns +Nokogiri::XML::Document+ XML data structure containing the response data from the job request == Raises +Exception+ Raises an exception if the request is unsuccessful | def get_log_xml(job_id:)
options = {}
options[:url] = self.endpoint
options[:method] = :post
options[:payload] = { :type => "log",
:action => :get,
:'job-id' => job_id,
:key => self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_get(organization, jobid)\n uri = server_uri(\"/organizations/#{organization}/jobs/#{jobid}\")\n res_data = api_get(uri)\n @logger.debug res_data\n\n return res_data\n end",
"def retrieve_job(job_id)\n raise Spear::ParametersRequired.new('JobID') if job_id.blank?\n\... | [
"0.6736675",
"0.6684246",
"0.6678474",
"0.6519897",
"0.6519065",
"0.6511884",
"0.6489954",
"0.6330807",
"0.6304025",
"0.61182094",
"0.59903294",
"0.5945753",
"0.5878269",
"0.58722943",
"0.582519",
"0.57515275",
"0.5717743",
"0.5712156",
"0.5711256",
"0.57075346",
"0.5704547",... | 0.7233596 | 0 |
Retrieves the response code from an XML data object == Parameters +xml_data+ Nokogiri::XML::Document object containing the XML data to parse == Returns +String+ String containing the response code returned in the XML data == Raises +Exception+ Raises an exception if the input data is not a valid Nokogiri::XML::Document | def get_log_xml_response_code(xml_data:)
raise "xml_data must be a valid Nokogiri::XML::Document type" unless xml_data.is_a?(Nokogiri::XML::Document)
xml_data.xpath('//response/@status').to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_response(xml_data)\n doc = REXML::Document.new(xml_data)\n r = 0\n x = ''\n s = ''\n doc.root.each_element('//Result') { |elt| r = elt.text} \n doc.root.each_element('//XMLout') { |elt| x = pretty_xml(elt.text)} \n doc.root.each_element('//CapabilitiesOut') { |elt| x = pretty_xml... | [
"0.65638644",
"0.6172554",
"0.58599967",
"0.5598907",
"0.559298",
"0.55057645",
"0.54788655",
"0.54653376",
"0.5457068",
"0.5442655",
"0.5411062",
"0.5411062",
"0.5410382",
"0.5393666",
"0.53756857",
"0.53568715",
"0.5348596",
"0.53159964",
"0.53010195",
"0.52890944",
"0.5278... | 0.7929867 | 0 |
Retrieves the job status from an XML data object == Parameters +xml_data+ Nokogiri::XML::Document object containing the XML data to parse == Returns +String+ String containing the job status returned in the XML data == Raises +Exception+ Raises an exception if the input data is not a valid Nokogiri::XML::Document | def get_log_job_status(xml_data:)
raise "xml_data must be a valid Nokogiri::XML::Document type" unless xml_data.is_a?(Nokogiri::XML::Document)
xml_data.xpath('//response/result/job/status')[0].content.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_job_status(job_id)\n raise ArgumentError, \"job_id is required\" unless job_id.present?\n\n request_body = ''\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n\n xml.instruct!\n xml.Envelope do\n xml.Body do\n xml.GetJobStatus do\n xml.JOB_ID job_id... | [
"0.6700465",
"0.625077",
"0.614672",
"0.6108549",
"0.6069027",
"0.57208526",
"0.5667751",
"0.56652105",
"0.5649994",
"0.56199",
"0.5590046",
"0.55425197",
"0.55225724",
"0.54658073",
"0.5437159",
"0.53503495",
"0.5322075",
"0.5284184",
"0.52402985",
"0.5231274",
"0.5174149",
... | 0.85493606 | 0 |
Mainly used in the presentation layer as a frontline check if we should even proceed with all the nittygritty details of rendering. This basically returns false when there's only 1 page for the given collection, otherwise returns true. | def render?
pages.to_a.size > 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginated?\n @pages and @pages.length > 1\n end",
"def is_countable?(collection)\n collection.total_pages\n rescue ::StandardError\n false\n end",
"def paginated?\n page_count > 1\n end",
"def first_page?\n page == 1\n end",
"def is_on_last_page(collection)\n collecti... | [
"0.7465835",
"0.73543614",
"0.7120491",
"0.70872116",
"0.7036648",
"0.7036648",
"0.6978535",
"0.697405",
"0.6968278",
"0.6949092",
"0.68940294",
"0.68759537",
"0.6875426",
"0.67750597",
"0.67605",
"0.67605",
"0.67409855",
"0.6720371",
"0.6720371",
"0.6720371",
"0.6720371",
... | 0.8054853 | 0 |
UNIT TEST FOR METHOD sg? gold != 1 > 's' gold == 1 > '' test if gold != 1, sg is set to 's' | def test_sg_not_one
p = Prospector.new(0, 0, 0)
assert p.sg?(4), 's'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sg_one\n p = Prospector.new(0, 0, 0)\n assert p.sg?(1), ''\n end",
"def test_s_not_one\n p = Prospector.new(0, 0, 0)\n assert p.s?(4), 's'\n end",
"def test_gold_without_silver_singular\n seed = 10\n id = 1\n prng = Random.new(seed)\n pros = Prospector.new id, prng\n max_s... | [
"0.70692766",
"0.66702724",
"0.6646853",
"0.6645528",
"0.65807676",
"0.6455215",
"0.6444141",
"0.6433282",
"0.6365133",
"0.6334325",
"0.6291143",
"0.6263069",
"0.6225256",
"0.6172979",
"0.61354035",
"0.6120698",
"0.6097926",
"0.60503775",
"0.60451174",
"0.6016093",
"0.599767"... | 0.7223638 | 0 |
test if gold == 1, sg is set to '' | def test_sg_one
p = Prospector.new(0, 0, 0)
assert p.sg?(1), ''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_and_set_gold\n @gold = 0 if @gold.negative?\n end",
"def test_sg_not_one\n\n p = Prospector.new(0, 0, 0)\n assert p.sg?(4), 's'\n end",
"def set_gold(gold)\n @gold = gold\n check_and_set_gold\n end",
"def show_item_gold?(targets) #don't show item/gold gained during ... | [
"0.67055696",
"0.64260846",
"0.621699",
"0.60967106",
"0.6058751",
"0.60507786",
"0.5994199",
"0.59543455",
"0.5920171",
"0.5882376",
"0.58592397",
"0.5823919",
"0.58072966",
"0.57225126",
"0.5704985",
"0.5696926",
"0.5681908",
"0.56715643",
"0.56430376",
"0.56404185",
"0.563... | 0.6492936 | 1 |
UNIT TEST FOR METHOD s? silver != 1 > 's' silver == 1 > 's' test if silver != 1, s is set to 's' | def test_s_not_one
p = Prospector.new(0, 0, 0)
assert p.s?(4), 's'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_s_one\n p = Prospector.new(0, 0, 0)\n assert p.s?(1), ''\n end",
"def test_mine_sutter_creek\r\n\t@test_prospector.current_location = 'Sutter Creek'\r\n\t@test_prospector.mine\r\n\tassert_operator 2, :>=, @test_prospector.current_gold\r\n\tassert_equal 0, @test_prospector.current_silver\r\n\tasse... | [
"0.68567103",
"0.66151404",
"0.6440706",
"0.63884056",
"0.63639605",
"0.6288692",
"0.6277629",
"0.6248881",
"0.62168723",
"0.62145233",
"0.61868787",
"0.6147603",
"0.61366636",
"0.6105575",
"0.6101497",
"0.607804",
"0.6048355",
"0.5996724",
"0.5992863",
"0.59681886",
"0.59677... | 0.70838314 | 0 |
test if silver == 1, s is set to '' | def test_s_one
p = Prospector.new(0, 0, 0)
assert p.s?(1), ''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stone? = unit == 'stone'",
"def test_s_not_one\n p = Prospector.new(0, 0, 0)\n assert p.s?(4), 's'\n end",
"def sb(s)\r\n (s == '(none)' || s == '') ? '' : s\r\n end",
"def test_sg_not_one\n\n p = Prospector.new(0, 0, 0)\n assert p.sg?(4), 's'\n end",
"def test_gold_without_silver_sin... | [
"0.6166031",
"0.6129121",
"0.59459025",
"0.5892276",
"0.58648586",
"0.58549416",
"0.57499516",
"0.56628287",
"0.56531924",
"0.5635926",
"0.5602873",
"0.55681723",
"0.5545478",
"0.5539963",
"0.5514847",
"0.5514651",
"0.5473019",
"0.5471622",
"0.5445505",
"0.5417422",
"0.540489... | 0.6242357 | 0 |
test to ensure string output for move is correct | def test_move_str
mock_loc = Minitest::Mock.new "mock_loc"
def mock_loc.name;"previous location";end
mock_loc2 = Minitest::Mock.new "mock_loc2"
def mock_loc2.name;"next location";end
map = Map.new
map.nodes = [mock_loc, mock_loc2]
dummy_rng = Minitest::Mock.new("dummy_rng")
def mock_loc.choose_neighbor(a);... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_moved(string); end",
"def test_moving_string\n pros = Prospector.new(0,0,0)\n assert pros.moving_string(0,0).eql? 'Heading from Enumerable Canyon to Enumerable Canyon.'\n end",
"def valid_move?(input)\n input.to_i.between?(1, 9) && !taken?(input)\n # binding.pry\n # input.to_i.betwe... | [
"0.66747814",
"0.63882524",
"0.63770396",
"0.629918",
"0.626845",
"0.62425464",
"0.61847854",
"0.6169102",
"0.6140609",
"0.6107098",
"0.60960007",
"0.609231",
"0.6091033",
"0.60422194",
"0.6013415",
"0.5977471",
"0.5941218",
"0.5910491",
"0.590971",
"0.58996826",
"0.58839583"... | 0.6792638 | 0 |
UNIT TEST FOR METHOD reset Equivalence class: Integer > 0 test if reset sets silver and gold found to 0 | def test_reset
p = Prospector.new(0,0,0)
p.silver_found = 5
p.gold_found = 5
p.reset
assert_equal 0, p.silver_found
assert_equal 0, p.gold_found
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset()\n @result = false\n @tests = 0\n end",
"def check_and_set_gold\n @gold = 0 if @gold.negative?\n end",
"def reset\n @gold_coins = 0\n @health_points = 10\n @lives = 5\n end",
"def reset\r\n @spend = 0\r\n end",
"def reset\n ... | [
"0.70043087",
"0.6967118",
"0.6960679",
"0.65408367",
"0.6477646",
"0.638644",
"0.6314966",
"0.6306624",
"0.6292102",
"0.6283243",
"0.6253542",
"0.623403",
"0.62300915",
"0.6198324",
"0.6177982",
"0.6177982",
"0.6177982",
"0.6177982",
"0.61598474",
"0.61522734",
"0.6147036",
... | 0.77825063 | 0 |
UNIT TEST FOR METHOD cashout equivalence class: total_gold, total silver > total test if cash out properly converts gold and silver to a string cash amount | def test_cash_out
p = Prospector.new(0,0,0)
p.total_gold = 1
p.total_silver = 1
assert '21.98', p.cash_out
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_convert_cash_g\n seed = 10\n prng = Random.new seed\n id = 1\n pros = Prospector.new id, prng\n\n gold = 2\n silver = 0\n actual = pros.convert_metals_to_cash gold, silver\n expected = 41.34\n assert_equal expected, actual\n end",
"def test_convert_cash_g_s\n seed = 10\n ... | [
"0.7587553",
"0.75374186",
"0.68916076",
"0.6849067",
"0.6771186",
"0.67474526",
"0.6670478",
"0.6633679",
"0.6595161",
"0.65855646",
"0.6476038",
"0.6461791",
"0.6374701",
"0.6346568",
"0.6304078",
"0.62943053",
"0.62856793",
"0.6282704",
"0.62547517",
"0.6232601",
"0.621544... | 0.7824802 | 0 |
UNIT TEST FOR METHOD prospect Equivalence class: num_days > num_days + 1 test to see if, regardless of gold_found and silver_found results prospect increments num_days by 1 | def test_prospect
mock_rng = Minitest::Mock.new("mock_rng")
def mock_rng.rand;1;end
mock_loc = Minitest::Mock.new("mock_loc")
def mock_loc.max_gold;0;end
def mock_loc.max_silver;0;end
p = Prospector.new(0,mock_loc,0)
p.prospect(mock_rng)
assert 1, p.num_days
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_increment_count_days\n seed = 10\n prng = Random.new seed\n id = 1\n pros = Prospector.new id, prng\n pros.increment_count_days\n assert_equal 1, pros.count_days\n end",
"def test_end_search_0_turns\n \tpro = Prospector.new(1)\n \tpro.loop_prospector(0)\n \tassert pro.total_rubies ... | [
"0.6526474",
"0.6399639",
"0.61691594",
"0.6151464",
"0.6108135",
"0.61056465",
"0.6064059",
"0.5927948",
"0.59188783",
"0.59009194",
"0.5886696",
"0.5876255",
"0.58513594",
"0.58505857",
"0.58493686",
"0.58453137",
"0.5839356",
"0.58347666",
"0.58160996",
"0.581166",
"0.5790... | 0.65640163 | 0 |
Call transition_to! on the StateMachine An exception wil be raised if new_state cannot be transitioned to by state machine | def transition_state_machine!(new_state, emit_params = {})
state_machine.transition_to!(new_state, emit_object(new_state, emit_params))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transition_state_machine(new_state, emit_params = {})\n state_machine.transition_state(new_state, emit_object(new_state, emit_params))\n end",
"def transition_to(path, current_state=self.current_state)\n path = path.to_s\n state = current_state || self\n exit_states = []\n\n # Fin... | [
"0.77615386",
"0.7352745",
"0.73347867",
"0.7170988",
"0.710794",
"0.7066182",
"0.68157357",
"0.68105364",
"0.6764152",
"0.67356914",
"0.65898955",
"0.65898955",
"0.6571505",
"0.65609664",
"0.6544876",
"0.6544876",
"0.652268",
"0.6445146",
"0.6402687",
"0.6396206",
"0.6390514... | 0.79036486 | 0 |
DELETE /stakeholders/1 DELETE /stakeholders/1.json | def destroy
@stakeholder.destroy
respond_to do |format|
format.html { redirect_to stakeholders_url, notice: 'User deleted.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @stakeholder = Stakeholder.find(params[:id])\n @stakeholder.destroy\n\n respond_to do |format|\n format.html { redirect_to stakeholders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stakeholder.destroy\n respond_to do |format|\n format.html... | [
"0.7742042",
"0.7505973",
"0.71063006",
"0.7089263",
"0.68522227",
"0.67560744",
"0.6744876",
"0.6626516",
"0.6601574",
"0.65521973",
"0.6528161",
"0.64986247",
"0.64909434",
"0.6478431",
"0.64730746",
"0.646737",
"0.6462893",
"0.64620185",
"0.64551157",
"0.64452434",
"0.6431... | 0.75437635 | 1 |
component refs are augmented with :component_template key which points to associated component template or nil opts can have keys :raise_if_missing_dependencies :module_local_params :donot_set_component_templates :set_namespace :force_compute_template_id | def set_matching_component_template_info?(aug_cmp_refs, opts = {})
MatchingTemplates.set_matching_component_template_info?(self, aug_cmp_refs, opts)
aug_cmp_refs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def component_templates\n @component_templates ||= extract_component_templates\n end",
"def component_template(component)\n component.id_handle(id: component[:ancestor_id]).create_object\n end",
"def create_or_update_from_parsed_common_module(opts = {})\n update_module_refs\n\n ... | [
"0.59428596",
"0.57468575",
"0.57107514",
"0.5692835",
"0.55006164",
"0.53122395",
"0.53062344",
"0.52871716",
"0.508325",
"0.508325",
"0.508325",
"0.508325",
"0.508325",
"0.508325",
"0.508325",
"0.5075582",
"0.50070447",
"0.49609637",
"0.4958927",
"0.49486938",
"0.49222553",... | 0.6027958 | 0 |
select_every_even takes in an array returns a list of evenindexed items from the input | def select_every_even arr
ans = []
arr.each_with_index do |item, i|
if i%2 == 0
ans.push item
end
end
ans
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_every_even(arr)\n arr.select.with_index { |_, i| i.even? }\nend",
"def select_every_even(arr)\n arr.select.with_index { |e, i| e if i.even? }\nend",
"def select_every_even(arr)\n # 3\n arr.select.each_with_index { |el,idx| if idx % 2 === 0 then true end}\n end",
"def select_every_even(a... | [
"0.85774046",
"0.85493785",
"0.8425266",
"0.842263",
"0.8387712",
"0.8320192",
"0.8210167",
"0.806746",
"0.7995051",
"0.79757094",
"0.7864532",
"0.77776694",
"0.7763646",
"0.77579546",
"0.7755534",
"0.77382797",
"0.7714565",
"0.7697367",
"0.7697367",
"0.7683374",
"0.7639367",... | 0.8749304 | 0 |
select_every_odd takes in an array returns a list of oddindexed items | def select_every_odd arr
ans = []
arr.each_with_index do |item, i|
if i%2 == 1
ans.push item
end
end
ans
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_every_odd(arr)\n arr.select.with_index { |_, i| i.odd? }\nend",
"def select_every_odd(arr)\n arr.select.with_index { |e, i| e if i.odd? }\nend",
"def select_every_odd(arr)\n arr.select.each_with_index { |el,idx| if idx % 2 === 1 then true end}\nend",
"def select_every_odd(arr)\n arr.each_inde... | [
"0.8592591",
"0.85721403",
"0.8499086",
"0.84826547",
"0.8446771",
"0.84275156",
"0.80751437",
"0.80283374",
"0.7973934",
"0.79455423",
"0.7924457",
"0.7851747",
"0.7847228",
"0.7801546",
"0.7782138",
"0.7732595",
"0.7662053",
"0.7637106",
"0.7628529",
"0.76258975",
"0.761093... | 0.8684752 | 0 |
select_every_n takes in an array returns a list of items at an index evenly divisible by n defaults to an n value of 1 | def select_every_n arr, n=1
ans = []
arr.each_with_index do |item, i|
ans.push item if i%n == 0
end
ans
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_every_n(arr, n=1)\n arr.each_index.select {|index| index%n==0}.map{|index| index=arr[index]}\nend",
"def select_every_n(arr,n = 1)\n arr.select.each_with_index { |el,idx| if idx % n === 0 then true end}\n end",
"def select_every_n(arr, val=1)\n arr.select.with_index { |e, i| e if ( i % val ==... | [
"0.85315907",
"0.84727263",
"0.8238499",
"0.8222088",
"0.81671405",
"0.7203711",
"0.7103498",
"0.704103",
"0.69476",
"0.6931961",
"0.679882",
"0.6789713",
"0.6701144",
"0.66764396",
"0.6654521",
"0.6639058",
"0.66217244",
"0.6604718",
"0.6591262",
"0.6580863",
"0.6579208",
... | 0.8746667 | 0 |
DEPRECATED: Please use find_by_host_and_bookingsync_id_key instead. | def find_by_host_and_synced_id(host, synced_id)
warn("DEPRECATED: find_by_host_and_synced_id is deprecated, use #find_by_host_and_bookingsync_id_key instead. It will be removed with the release of version 5 of this gem. Called from #{Gem.location_of_caller.join(":")}")
find_by_host_and_bookingsync_id_key(ho... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_by_key(key)\n find_by_id(key) # backlog method looks exactly the same except for the parameter type\n end",
"def dns_find(key)\n \n end",
"def find_by_alias(alias_to_find)\n SERVERS.fetch(\"#{alias_to_find}\")\nend",
"def search_for(host, options = T.unsafe(nil)); end",
"def f... | [
"0.47524887",
"0.4710648",
"0.46618736",
"0.46493363",
"0.45666736",
"0.45205954",
"0.45129517",
"0.44870144",
"0.4458604",
"0.44459784",
"0.4437337",
"0.44331113",
"0.44132233",
"0.4402983",
"0.43841952",
"0.43676823",
"0.43621454",
"0.43565726",
"0.43453237",
"0.43439218",
... | 0.79212296 | 0 |
Gets the malwareIdentifier property value. The unique identifier. This is malware identifier | def malware_identifier
return @malware_identifier
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def malware_identifier=(value)\n @malware_identifier = value\n end",
"def identifier\n @info.identifier\n end",
"def identifier\n @info.identifier\n end",
"def identifier\n @identifiers[0]\n end",
"def hardware_identifier\n return @hardware_i... | [
"0.78197503",
"0.6436964",
"0.6436964",
"0.6371708",
"0.6278547",
"0.6204082",
"0.6042496",
"0.5897826",
"0.58292866",
"0.58175737",
"0.5814986",
"0.57033014",
"0.56955826",
"0.5683186",
"0.56511235",
"0.56488055",
"0.5631719",
"0.5618083",
"0.5599039",
"0.55647284",
"0.55415... | 0.89474475 | 0 |
Sets the malwareIdentifier property value. The unique identifier. This is malware identifier | def malware_identifier=(value)
@malware_identifier = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def malware_identifier\n return @malware_identifier\n end",
"def set_identifier\n self.identifier = self.name.downcase.gsub(/[^a-zA-Z0-9]+/, '-').chomp('-')\n end",
"def identifier=(value)\n setId(value)\n end",
"def hardware_identifier=(value)\n @hardware... | [
"0.7443344",
"0.6397429",
"0.63077724",
"0.62721276",
"0.62281007",
"0.61989725",
"0.6184901",
"0.61533844",
"0.61533844",
"0.60772943",
"0.60427177",
"0.60294",
"0.6028174",
"0.5922231",
"0.58956534",
"0.58452535",
"0.58165985",
"0.5780446",
"0.5780446",
"0.5692913",
"0.5626... | 0.894945 | 0 |
Store the block so we can reuse the questions | def stock_questions(&block)
@stock_questions = block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def persist_block(blk)\n raise \"Not implemented\"\n end",
"def save_block(block)\n db.transaction do\n db[:l] = block.hash\n db[block.hash] = block\n db.commit\n end\n block\n end",
"def record_block\n @block = true\n end",
"def set_block\n @request = JS... | [
"0.6604249",
"0.6555346",
"0.6539111",
"0.6339934",
"0.6314129",
"0.62934154",
"0.62414336",
"0.6136204",
"0.60997105",
"0.6087274",
"0.60487866",
"0.60487866",
"0.60487866",
"0.60487866",
"0.60487866",
"0.6045706",
"0.6017383",
"0.60158914",
"0.5958948",
"0.5866941",
"0.5857... | 0.67462 | 0 |
GET /remoteobjects/1 GET /remoteobjects/1.json | def show
@remoteobject = Remoteobject.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @remoteobject }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @remoteobject = Remoteobject.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @remoteobject }\n end\n end",
"def show\n # base url of the remote data\n # append the 'id' to this to generate the remote url\n baseUrl = 'ht... | [
"0.6371974",
"0.62682444",
"0.6240078",
"0.6186337",
"0.5944239",
"0.5930735",
"0.5904998",
"0.5868757",
"0.5851769",
"0.5778498",
"0.5764048",
"0.5739525",
"0.5687679",
"0.5685561",
"0.5667282",
"0.56496054",
"0.5634875",
"0.5622183",
"0.56128544",
"0.55894125",
"0.556608",
... | 0.7525957 | 0 |
GET /remoteobjects/new GET /remoteobjects/new.json | def new
@remoteobject = Remoteobject.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @remoteobject }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @remoteobject = Remoteobject.new(params[:remoteobject])\n \n respond_to do |format|\n if @remoteobject.save\n format.html { redirect_to @remoteobject, notice: 'Remoteobject was successfully created.' }\n format.json { render json: @remoteobject, status: :created, lo... | [
"0.7214915",
"0.6824332",
"0.6388614",
"0.6321679",
"0.629229",
"0.6201797",
"0.6182941",
"0.6181598",
"0.60209435",
"0.60026264",
"0.5998819",
"0.5966537",
"0.59613",
"0.5951257",
"0.5944363",
"0.5943306",
"0.59284914",
"0.5921109",
"0.5907767",
"0.58898807",
"0.58898807",
... | 0.8032659 | 0 |
POST /remoteobjects POST /remoteobjects.json | def create
@remoteobject = Remoteobject.new(params[:remoteobject])
respond_to do |format|
if @remoteobject.save
format.html { redirect_to @remoteobject, notice: 'Remoteobject was successfully created.' }
format.json { render json: @remoteobject, status: :created, location: @re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @remoteobject = Remoteobject.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @remoteobject }\n end\n end",
"def destroy\n @remoteobject = Remoteobject.find(params[:id])\n @remoteobject.destroy\n \n respond_to do ... | [
"0.6004211",
"0.57841676",
"0.57535076",
"0.5707952",
"0.56922704",
"0.56302994",
"0.55703163",
"0.5541054",
"0.5479412",
"0.545802",
"0.5436793",
"0.54183537",
"0.54035264",
"0.53266764",
"0.532071",
"0.5313245",
"0.52998024",
"0.5290061",
"0.5265947",
"0.52582586",
"0.51782... | 0.7033345 | 0 |
PUT /remoteobjects/1 PUT /remoteobjects/1.json | def update
@remoteobject = Remoteobject.find(params[:id])
respond_to do |format|
if @remoteobject.update_attributes(params[:remoteobject])
format.html { redirect_to @remoteobject, notice: 'Remoteobject was successfully updated.' }
format.json { head :no_content }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_from_api(remote_obj)\n raise NotImplementedError\n end",
"def put url, object = nil\n request url, HTTP::Put, object\n end",
"def perform_put_with_objects(path, options, klass)\n perform_request_with_objects(:put, path, options, klass)\n end",
"def update_remote\n # TODO... | [
"0.6951254",
"0.6305622",
"0.6278565",
"0.6231302",
"0.62048775",
"0.6191285",
"0.6184585",
"0.6158937",
"0.6125546",
"0.6096149",
"0.6078941",
"0.6026043",
"0.5840621",
"0.57633984",
"0.57479733",
"0.57408476",
"0.57126737",
"0.5708616",
"0.5693383",
"0.5674546",
"0.56467867... | 0.7060956 | 0 |
DELETE /remoteobjects/1 DELETE /remoteobjects/1.json | def destroy
@remoteobject = Remoteobject.find(params[:id])
@remoteobject.destroy
respond_to do |format|
format.html { redirect_to remoteobjects_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.delete do |req|\n req.url resource_uri\n end\n if res.success?\n data = JSON.parse(res.body)\n reload\n else\n nil\n end\n end",
"def delete(object); end",
"d... | [
"0.69243973",
"0.6788481",
"0.678598",
"0.6785104",
"0.6746692",
"0.67187506",
"0.6668021",
"0.6653064",
"0.6619561",
"0.6599248",
"0.65905344",
"0.65467256",
"0.65346336",
"0.6509434",
"0.6502775",
"0.6474605",
"0.6458006",
"0.64533293",
"0.6446283",
"0.6434713",
"0.64135873... | 0.7774438 | 0 |
produces a simple spiral out from the center of a circle in a gradually increasing arc until it reaches the specified maximum. Mill the tightest spiral possible allowing space for the milling a channel of the specified width while retaining a wall between channels of the specified thickness. | def mill_spiral(
mill,
cent_x,
cent_y,
inner_diam,
outer_diam,
channel_width,
wall_thick,
depth = nil)
# - - - - - - - - - - - - - - - - - - -
cut_inc = mill.cut_increment
degree_inc = 1.0
min_radius = inner_diam / 2.0
max_radius = outer_diam / 2.0
delta_ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GenSilkArc(x, y, width, height, startangle, deltaangle)\n thickness = GetDim('silkwidth')\n PcbElementArc(x, y, width, height, startangle, deltaangle, thickness)\nend",
"def drawSpiral(x0, y0, z0, x1, y1, z1, coils, chord = 10, digMode = 'd')\n # ('0'=no rotation, '1'=360 degrees, '180/360'=180 degrees)... | [
"0.57350075",
"0.5696481",
"0.56206036",
"0.5427894",
"0.53690726",
"0.524879",
"0.5213844",
"0.514134",
"0.50798875",
"0.5049424",
"0.5033862",
"0.50270313",
"0.49873936",
"0.49848163",
"0.49601918",
"0.49478972",
"0.49471208",
"0.4932622",
"0.49313894",
"0.4926649",
"0.4926... | 0.6440148 | 0 |
Returns an array with all the themes names | def get_themes
themes_dir = File.join(File.dirname(__FILE__), '/public/themes')
themes = []
Dir.entries(themes_dir).sort.each do |dir|
themes.push dir if ((dir != 'fonts') and (dir[0] != '.'))
end
themes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def theme_elements\n theme.split('-')\n end",
"def all_themes\n Dir.chdir(wasko_directory) do |path|\n Dir[\"*.color\"].map do |filename|\n filename.gsub(/\\.color$/, \"\")\n end\n end\n end",
"def index\n @theme_names = ThemeName.all\n end",
"d... | [
"0.7403872",
"0.72100794",
"0.71441936",
"0.7120636",
"0.6536954",
"0.65142393",
"0.6237705",
"0.61874676",
"0.613368",
"0.60869265",
"0.60865533",
"0.6058636",
"0.60160375",
"0.5994937",
"0.5984162",
"0.59825003",
"0.59194034",
"0.58829564",
"0.5872692",
"0.5851065",
"0.5851... | 0.7589161 | 0 |
(Internal) Return the production preloads for the bundles | def bundle_preloads_prod
bundles = @context.registers[:site].config['javascript_bundles']
baseurl = @context.registers[:site].config['baseurl']
# Select the ones wishing to be preloaded
bundles = bundles.select do |_name, bundle|
bundle['preload'] == true
end
bundles.map do... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bundles\n @cached_all_bundles ||= (client_bundles + framework_bundles)\n end",
"def framework_bundles\n @cached_framework_bundles ||= framework_names.map { |x| bundle_for(x) }\n end",
"def bundles\n return @bundles\n end",
"def default_bundles_for_build\n bu... | [
"0.71964365",
"0.6510189",
"0.6457764",
"0.6345236",
"0.6317316",
"0.6202839",
"0.5992263",
"0.5992263",
"0.59921277",
"0.5976041",
"0.59047765",
"0.5901547",
"0.5785567",
"0.5759575",
"0.5663078",
"0.5610778",
"0.5587174",
"0.5581573",
"0.5581015",
"0.5580212",
"0.5524557",
... | 0.842318 | 0 |
Returns path to this node's nodes/NAME.json file, used as node.json by chefsolo. | def local_node_json_pathname
return Pathname.new("nodes") + "#{self.name}.json"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_for(node)\n JSON.parse(File.read(\"#{@repository_path}/nodes/#{node}.json\"))\n end",
"def nodes_path\n verify_path NODES_PATH\n File.join @tar_contents_path, NODES_PATH\n end",
"def path\n File.join(RH_CONFIG[\"location\"], self.parent.pid.gsub(/:/,\"_\"), \"data\", se... | [
"0.6782955",
"0.6494514",
"0.6449915",
"0.6374703",
"0.6367194",
"0.61724687",
"0.61318743",
"0.61271715",
"0.6125443",
"0.6090554",
"0.6080406",
"0.6076812",
"0.60564125",
"0.60084987",
"0.6000862",
"0.59957635",
"0.59945345",
"0.5975349",
"0.59556794",
"0.5925541",
"0.59218... | 0.82822573 | 0 |
Installs Chef and its dependencies on a node if needed. | def install
unless self.has_executable?("chef-solo")
case self.pocketknife.can_install
when nil
# Prompt for installation
print "? #{self.name}: Chef not found. Install it and its dependencies? (Y/n) "
STDOUT.flush
answer = STDIN.gets.chomp
case an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_chef\n self.say(\"Installing chef...\")\n self.execute(\"gem install --no-rdoc --no-ri chef\", true)\n self.say(\"Installed chef\", false)\n end",
"def install_dependencies\n recipe_eval do\n run_context.include_recipe 'chef-sugar::default'\n run_context.include_r... | [
"0.7650057",
"0.7589447",
"0.72230244",
"0.7177207",
"0.7173308",
"0.7115138",
"0.6842534",
"0.6830552",
"0.6800983",
"0.6663625",
"0.6632841",
"0.65878546",
"0.6548866",
"0.6476983",
"0.64434665",
"0.6428759",
"0.6426858",
"0.63942176",
"0.6369493",
"0.6340347",
"0.6317556",... | 0.8122324 | 0 |
Installs Chef on the remote node. | def install_chef
self.say("Installing chef...")
self.execute("gem install --no-rdoc --no-ri chef", true)
self.say("Installed chef", false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install\n unless self.has_executable?(\"chef-solo\")\n case self.pocketknife.can_install\n when nil\n # Prompt for installation\n print \"? #{self.name}: Chef not found. Install it and its dependencies? (Y/n) \"\n STDOUT.flush\n answer = STDIN.gets.chomp\n... | [
"0.76349545",
"0.74105823",
"0.72594064",
"0.70426124",
"0.6970439",
"0.6863429",
"0.68149966",
"0.68111306",
"0.67401916",
"0.6676657",
"0.66530347",
"0.6607821",
"0.6580018",
"0.65545577",
"0.65303624",
"0.6510413",
"0.6422632",
"0.6415363",
"0.64153415",
"0.6396053",
"0.63... | 0.78508687 | 0 |
Installs Rubygems on the remote node. | def install_rubygems
self.say("Installing rubygems...")
self.execute(<<-HERE, true)
cd /root &&
rm -rf rubygems-1.3.7 rubygems-1.3.7.tgz &&
wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz &&
tar zxf rubygems-1.3.7.tgz &&
cd rubygems-1.3.7 &&
ruby setup.rb --no-format-executable ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install\n install_gems(dependencies)\n end",
"def install_deps!(node)\n node.vm.provision \"shell\", inline: \"cp -f /vagrant/hosts /etc/hosts\"\n deps = [\n 'java-1.8.0-openjdk',\n 'ed',\n\n # * purely for convenience\n 'the_silver_searcher',\n 'vim',\n 'zip'\n ]\n node.vm.provisio... | [
"0.6972259",
"0.6937411",
"0.65880096",
"0.6498346",
"0.64143586",
"0.6412688",
"0.6407212",
"0.6394362",
"0.6351798",
"0.6347162",
"0.63335496",
"0.6303907",
"0.629804",
"0.62913156",
"0.62690055",
"0.6264409",
"0.6185687",
"0.61821836",
"0.6167804",
"0.6155014",
"0.61438566... | 0.73575205 | 0 |
Installs Ruby on the remote node. | def install_ruby
command = \
case self.platform[:distributor].downcase
when /ubuntu/, /debian/, /gnu\/linux/
"DEBIAN_FRONTEND=noninteractive apt-get --yes install ruby ruby-dev libopenssl-ruby irb build-essential wget ssl-cert"
when /centos/, /red hat/, /scientific linux/
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install\n unless self.has_executable?(\"chef-solo\")\n case self.pocketknife.can_install\n when nil\n # Prompt for installation\n print \"? #{self.name}: Chef not found. Install it and its dependencies? (Y/n) \"\n STDOUT.flush\n answer = STDIN.gets.chomp\n... | [
"0.67287177",
"0.6631299",
"0.6620959",
"0.6558568",
"0.65455025",
"0.6544452",
"0.65179807",
"0.64683956",
"0.64440453",
"0.6424788",
"0.640585",
"0.63860154",
"0.6377121",
"0.6346826",
"0.6322652",
"0.63196117",
"0.62970656",
"0.62756383",
"0.6242639",
"0.6242639",
"0.62301... | 0.76058525 | 0 |
Applies the configuration to the node. Installs Chef, Ruby and Rubygems if needed. | def apply
self.install
self.say("Applying configuration...", true)
command = "chef-solo -j #{NODE_JSON.shellescape}"
command << " -o #{self.pocketknife.runlist}" if self.pocketknife.runlist
command << " -l debug" if self.pocketknife.verbosity == true
self.execute(command, true)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install\n unless self.has_executable?(\"chef-solo\")\n case self.pocketknife.can_install\n when nil\n # Prompt for installation\n print \"? #{self.name}: Chef not found. Install it and its dependencies? (Y/n) \"\n STDOUT.flush\n answer = STDIN.gets.chomp\n... | [
"0.71332854",
"0.6996744",
"0.6777046",
"0.6769945",
"0.66800964",
"0.6645763",
"0.6540294",
"0.653531",
"0.65108883",
"0.647785",
"0.64633906",
"0.64119285",
"0.64004165",
"0.6397041",
"0.63960606",
"0.6378683",
"0.6353557",
"0.63424706",
"0.6328684",
"0.63106906",
"0.630745... | 0.76490116 | 0 |
Cleanup only known channels. We do not extract files from channels we do not know about, therefore removing files from such channels could be a very bad idea. | def cleanup
data_provider = Workflow::Invocation.lookup_data_provider(self.class.data_provider_name)
channels = data_provider.data_provider_channels.all(:order => 'name')
channels.each do |channel|
dir = source_dir_for_channel(channel)
# XXX ugly hack to get cleanup functional for initial releas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(channels)\n\treturn if not channels.is_a? Array #meh\n\tcurChannels = readCurrentChannels()\n\tcurChannels.reject! { |e| channels.include? e.downcase }\n\twriteChannels(curChannels)\nend",
"def part_all()\n @channels.clear()\n end",
"def cleanup\n @channel.close if @channel\n\n nil\n ... | [
"0.6822262",
"0.6543388",
"0.65041363",
"0.63322175",
"0.63313985",
"0.6212569",
"0.61994267",
"0.61491865",
"0.6144193",
"0.6002554",
"0.60004807",
"0.59869456",
"0.594332",
"0.58727765",
"0.58727765",
"0.58559656",
"0.58471966",
"0.5844544",
"0.58279794",
"0.5773631",
"0.57... | 0.7517584 | 0 |
Decrementa el nivel del jugador en l niveles. | def decrementLevels(l)
@level -= l
if(@level <= 0)
@level = 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrement\n @value -= 1\n end",
"def decrement(node)\n change_by node, -1\n end",
"def decrement\n @counter = @counter - 1\n end",
"def decrease(counter)\r\n counter - 1\r\nend",
"def level_down\r\r\n return if @level.zero?\r\r\n @level -= 1\r\r\n level_update\r\r\n end",
"... | [
"0.6531668",
"0.63026255",
"0.6254322",
"0.62223077",
"0.616627",
"0.61499345",
"0.61455256",
"0.60783195",
"0.6075856",
"0.6075856",
"0.6075856",
"0.6075856",
"0.6075856",
"0.6059598",
"0.6030309",
"0.5887199",
"0.58188313",
"0.5810526",
"0.5774552",
"0.5770336",
"0.57576174... | 0.68478775 | 0 |
Devuelve el nivel de combate del monstruo a combatir. | def getOponentLevel(m)
m.getCombatLevel
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turno_nivel_normal\n if tem_naipe_da_rodada_ou_trunfo?\n if pontos_da_mesa > 0\n return joga_a_menor_carta_suficiente_para_ganhar_a_rodada\n end\n end\n joga_menor_carta\n end",
"def turno_nivel_facil\n if tem_naipe_da_rodada_ou_trunfo?\n return joga_maior_carta\n else\n... | [
"0.6248364",
"0.6150482",
"0.61176586",
"0.60454124",
"0.60087186",
"0.5957406",
"0.59430367",
"0.5777648",
"0.57640725",
"0.56818616",
"0.56721175",
"0.566784",
"0.5665531",
"0.5661809",
"0.565123",
"0.5618965",
"0.5618747",
"0.5618747",
"0.5616553",
"0.5578333",
"0.55649143... | 0.62028503 | 1 |
Method to display the product name along with the per unit price | def product_name_with_unit_price
price = unit_price
price = product.price if price.nil?
"#{product.name} ($#{price})"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unitprice_label(unitprice)\n \"#{sprintf(\"%g\", unitprice.unit)} #{unitprice.product.unitdesc} - #{to_users_currency(unitprice.currency, unitprice.price)} #{current_user.currency}\"\n end",
"def getProdbyName(name)\n prod = @@products.find { |p| p.name == name }\n if prod.nil?\n ... | [
"0.754503",
"0.7272208",
"0.70105857",
"0.69991523",
"0.6986754",
"0.69624996",
"0.6943147",
"0.6892553",
"0.6865511",
"0.6832491",
"0.6815136",
"0.6782119",
"0.67240274",
"0.6706575",
"0.6601571",
"0.6595019",
"0.65900654",
"0.65818995",
"0.65590715",
"0.6551517",
"0.6544976... | 0.8493117 | 0 |
Generate excel file based on category and tags | def generateExcelFromArray(questions_array, category, tags,file_num)
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet
sheet1.row(0).concat %w{QuestionNo TestName Category Tags Directions QuestionText QuestionImage AnswerText AnswerImage Correct Option Option Option Option}
row_num = 1
question... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_categories_sheet\r\n @book.worksheet(WBF[:category_sheet])\r\n end",
"def index\n @categories = user_categories.page(params[:page])\n respond_to do |format|\n format.html\n format.xls {\n send_data(ExportXls.export_excel,\n :type => \"text/excel;charset=utf-8; header=pr... | [
"0.6367288",
"0.6038678",
"0.6029188",
"0.58421385",
"0.58399373",
"0.5785572",
"0.57554674",
"0.5710203",
"0.56022584",
"0.55692947",
"0.54901",
"0.54775447",
"0.54663163",
"0.5388238",
"0.53794974",
"0.53780895",
"0.53663003",
"0.53660846",
"0.5351928",
"0.5347855",
"0.5319... | 0.6491887 | 0 |
Build a new instance of Question class and populate data from the row. | def getQuestionFromRow(row)
question = Question.new
if row[0].class == Spreadsheet::Formula
question.question_no = row[0].value.to_i
else
question.question_no = row[0].to_i
end
question.test_name = row[1]
question.category = row[2]
question.tags = getSortedArrayFromString(row[3])
question.dire... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_object_from_row(row)\n if row\n data = Hash[columns.zip(row)]\n new(data)\n end\n end",
"def initialize(row)\n @row = row\n end",
"def initialize(row)\n @row = row\n end",
"def row(row)\n Row.new(@data, row)\n end",
"def reify_from_row(row)\n #... | [
"0.6597893",
"0.63887393",
"0.63377595",
"0.62624705",
"0.6245636",
"0.6051286",
"0.6033093",
"0.60166883",
"0.59853214",
"0.59850085",
"0.59500915",
"0.59200555",
"0.5805934",
"0.5794061",
"0.5701481",
"0.5689857",
"0.5667265",
"0.56624985",
"0.5650282",
"0.5612148",
"0.5588... | 0.7881591 | 0 |
PUT /sections/1 PUT /sections/1.json | def update
@section = Section.find(params[:id])
respond_to do |format|
if @section.update_attributes(params[:section])
format.html { redirect_to @section, notice: 'Section was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render ac... | [
"0.68453336",
"0.68411994",
"0.68296593",
"0.68250585",
"0.6751193",
"0.6744648",
"0.6724289",
"0.66593486",
"0.662534",
"0.6578779",
"0.6540702",
"0.6540702",
"0.6540702",
"0.6540702",
"0.6540702",
"0.6540702",
"0.65346265",
"0.65325975",
"0.6531278",
"0.6510368",
"0.6462979... | 0.6851484 | 0 |
Tells the technician the overview of the protocol if they need to use the Seelig spectrophotometer | def spec_intro
show do
title "Spectrophotometer Measurements"
note "This protocol will instruct you on how to take measurements on the Seelig Lab Spectrophotometer."
note "ODs are a quick and easy way to measure the growth rate of your culture."
note "GFP measurements help... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def go_to_lab\n show do\n warning \"Go to Seelig Lab in order to use the spectrophotometer.\"\n \n end\n end",
"def use_spectrophotometer\n show do\n title \"Prepare Spectrophotometer\"\n \n note \"On the Spectrophotometer laptop, if the program isn't open, cl... | [
"0.6415318",
"0.5775487",
"0.54303986",
"0.54213667",
"0.5414483",
"0.53417325",
"0.5303522",
"0.53005326",
"0.5287373",
"0.5281746",
"0.52755743",
"0.52614677",
"0.52604055",
"0.52512515",
"0.52453136",
"0.5222079",
"0.521569",
"0.52118045",
"0.52071714",
"0.5198523",
"0.517... | 0.6311097 | 1 |
Instructs the technician to transfer cultures to plate | def transfer_culture op, coordinate_matrix, cult_vol, op_collection
input_plate = "#{op.input(INPUT).item.object_type.name} #{op.input(INPUT).item.id}"
output_plate = "#{op_collection} #{Item.find(op_collection.id).id}"
show {
title "Transfer Culture Aliquots to Plate for Reader"
chec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dilution_transfer(input_plate, diluted_plate, transfer_vol)\n show {\n title \"Tranferring and Diluting Cultures for Plate Reader\"\n separator\n check \"From plate <b>#{input_plate}</b> transfer <b>#{transfer_vol}µl</b> of culture to the plate labeled => <b>#{diluted_pl... | [
"0.5355519",
"0.53532374",
"0.53028524",
"0.5282254",
"0.51938593",
"0.51804066",
"0.5179352",
"0.5178636",
"0.5146897",
"0.51311517",
"0.50901145",
"0.5054665",
"0.50540113",
"0.50540113",
"0.49578598",
"0.49368286",
"0.49313688",
"0.49216312",
"0.49208698",
"0.48976606",
"0... | 0.5540597 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.