query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
POST /sales POST /sales.json | def create
@sale = Sale.new(params[:sale])
respond_to do |format|
if @sale.save
format.html { redirect_to @sale, notice: 'Sale was successfully created.' }
format.json { render json: @sale, status: :created, location: @sale }
else
format.html { render action: "new" }
format.json { render json: @sale.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @sale = Sale.new(sale_params)\n\n if @sale.save\n render json: @sale, status: :created, location: @sale\n else\n render json: @sale.errors, status: :unprocessable_entity\n end\n end",
"def create\n instance = Sale.new(sale_params)\n\n if instance.save\n render j... | [
"0.7400088",
"0.69771683",
"0.6967173",
"0.69038314",
"0.6879542",
"0.68598634",
"0.685645",
"0.685645",
"0.68392515",
"0.67538804",
"0.6709609",
"0.6706264",
"0.66834867",
"0.6682449",
"0.6600478",
"0.6559194",
"0.6547773",
"0.65413195",
"0.64976615",
"0.6464397",
"0.6454362... | 0.69187945 | 4 |
PUT /sales/1 PUT /sales/1.json | def update
@sale = Sale.find(params[:id])
respond_to do |format|
if @sale.update_attributes(params[:sale])
format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @sale.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @sale = Sale.find(params[:id])\n\n if @sale.update(sale_params)\n head :no_content\n else\n render json: @sale.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @sale.update(sale_params)\n render json: { msg: @sale }, status: :ok\n else\n ren... | [
"0.710073",
"0.679656",
"0.6687523",
"0.6686468",
"0.6568697",
"0.6568136",
"0.6443833",
"0.6422258",
"0.6422258",
"0.6416851",
"0.6416851",
"0.6416851",
"0.6416851",
"0.6416851",
"0.6416851",
"0.6416851",
"0.64066106",
"0.63825256",
"0.6308864",
"0.62938577",
"0.62653553",
... | 0.65577644 | 6 |
DELETE /sales/1 DELETE /sales/1.json | def destroy
@sale = Sale.find(params[:id])
@sale.destroy
respond_to do |format|
format.html { redirect_to sales_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale = Sale.find(params[:id])\n @sale.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_url }\n f... | [
"0.75238115",
"0.7519581",
"0.7519581",
"0.72468376",
"0.7210167",
"0.71714795",
"0.71714795",
"0.71714795",
"0.71714795",
"0.71714795",
"0.71714795",
"0.71714795",
"0.71714795",
"0.71714795",
"0.7148764",
"0.713443",
"0.7107516",
"0.70768994",
"0.7074153",
"0.7073332",
"0.70... | 0.75418174 | 0 |
Yields all the permutations of self into block. | def permute(&block)
case size
when 0 then yield []
when 1 then yield self
when 2
yield self
yield self.reverse
else
0.upto(size-1) do |i|
a = dup
c = a.slice!(i)
a.permute do |p|
yield p.dup.unshift(c)
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_permutations\n perms = permutations\n perms = perms.shuffle.take(1) if @single_perm || ENV['FAST_TESTS']\n\n perms.each do |p|\n yield(p)\n WebMock.reset!\n end\n end",
"def permutation(length = size, &block)\n return enum_for(:permutation, length) if not block_g... | [
"0.69165623",
"0.6744315",
"0.63351053",
"0.62013185",
"0.61836386",
"0.61515087",
"0.6100307",
"0.6084606",
"0.6048573",
"0.59515905",
"0.5943673",
"0.5883916",
"0.58373123",
"0.58193165",
"0.58012384",
"0.5791618",
"0.57832944",
"0.5714496",
"0.5706052",
"0.57050174",
"0.56... | 0.7230013 | 0 |
attr_accessor :links, :pages, :domain, :options, :db_name, :directory, :objects, :skipped_pages, :loaded_objects | def initialize project = "", opt = {}
self.project = project.should_not! :be_nil
self.options = opt.to_openobject
# DB
self.db_name = project
self.connection = Mongo::Connection.new # nil, nil, :logger => Logger.new(STDOUT)
self.connection.drop_database db_name if options.clear?
self.db = connection.db db_name
# File Storage
options.base_directory.should_not_be! :blank
self.base_directory = "#{options.base_directory}/#{project}"
FileUtils.rm_rf base_directory if options.clear?
FileUtils.mkdir_p base_directory unless File.exist? base_directory
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def external_link_inventory # make this an object attribute for every page object, along with base url, and other helpful state info\n []\n end",
"def initialize\n @locked = true\n @diary_pages = []\n end",
"def links\n\t\t\tlinks = {}\n\t\t\tself.page_files(true).each do |p|\n\t\t\t\tpage = Page.ne... | [
"0.63977045",
"0.62263614",
"0.61306745",
"0.6061598",
"0.59901965",
"0.5912823",
"0.58887774",
"0.5873444",
"0.58466464",
"0.5803929",
"0.5789032",
"0.57721436",
"0.57709146",
"0.57697177",
"0.5742288",
"0.5739109",
"0.57319045",
"0.5710805",
"0.57075256",
"0.56653357",
"0.5... | 0.0 | -1 |
def say(words = 'hello') puts words + "." end say() say('hi') say('how are you') say("I'm fine") | def some_method(number)
number = 7 # this is implicitly returned by the method
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def say(words = 'hello') #a default parameter that is used whenever our method is called without any arguments.\n puts words + '.'\n end",
"def say(words='hello')\n\tputs words + '.'\nend",
"def say(words = \"hello\")\n puts words + '.'\nend",
"def say(words='hello')\n puts words + '.'\nend",
"def say(... | [
"0.8641947",
"0.86302",
"0.8496572",
"0.84908676",
"0.84908676",
"0.84780675",
"0.84422636",
"0.8439144",
"0.83615667",
"0.8063444",
"0.80595255",
"0.80428886",
"0.7957286",
"0.79528934",
"0.7894815",
"0.78889555",
"0.7769465",
"0.7768284",
"0.7707548",
"0.77074206",
"0.76579... | 0.0 | -1 |
GET /tagging_select_tos GET /tagging_select_tos.json | def index
@tagging_select_tos = TaggingSelectTo.all
if @tagging_select_tos.empty?
TaggingSelectTo.create(name: 'Sajjad-Murtaza-Testing-Taggable')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @tagging_select_to = TaggingSelectTo.new(tagging_select_to_params)\n\n respond_to do |format|\n if @tagging_select_to.save\n format.html { redirect_to tagging_select_tos_path }\n format.json { render :show, status: :created, location: @tagging_select_to }\n else\n ... | [
"0.6625833",
"0.6104351",
"0.58236516",
"0.5726449",
"0.5707796",
"0.5703381",
"0.5579196",
"0.5537875",
"0.55160606",
"0.54729",
"0.5452605",
"0.5436956",
"0.5436956",
"0.54151636",
"0.54143935",
"0.5405076",
"0.5376123",
"0.53718185",
"0.5320589",
"0.52716565",
"0.526671",
... | 0.67894167 | 0 |
GET /tagging_select_tos/1 GET /tagging_select_tos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tagging_select_tos = TaggingSelectTo.all\n if @tagging_select_tos.empty?\n TaggingSelectTo.create(name: 'Sajjad-Murtaza-Testing-Taggable')\n end\n end",
"def create\n @tagging_select_to = TaggingSelectTo.new(tagging_select_to_params)\n\n respond_to do |format|\n if @tagging... | [
"0.6744151",
"0.6728961",
"0.6216666",
"0.58082235",
"0.5748116",
"0.56713325",
"0.5637615",
"0.5585872",
"0.5487587",
"0.5448449",
"0.540906",
"0.53765637",
"0.53365964",
"0.5290892",
"0.52786607",
"0.5270235",
"0.5267067",
"0.52473235",
"0.522067",
"0.5196898",
"0.5195033",... | 0.0 | -1 |
POST /tagging_select_tos POST /tagging_select_tos.json | def create
@tagging_select_to = TaggingSelectTo.new(tagging_select_to_params)
respond_to do |format|
if @tagging_select_to.save
format.html { redirect_to tagging_select_tos_path }
format.json { render :show, status: :created, location: @tagging_select_to }
else
format.html { render :new }
format.json { render json: @tagging_select_to.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tagging_select_tos = TaggingSelectTo.all\n if @tagging_select_tos.empty?\n TaggingSelectTo.create(name: 'Sajjad-Murtaza-Testing-Taggable')\n end\n end",
"def tagging_select_to_params\n params.require(:tagging_select_to).permit(:name)\n end",
"def set_tagging_select_to\n ... | [
"0.70922923",
"0.649447",
"0.6199583",
"0.5868507",
"0.55591655",
"0.54892397",
"0.53707653",
"0.52069837",
"0.51950353",
"0.5185502",
"0.5159103",
"0.5159103",
"0.51436543",
"0.5136004",
"0.50788724",
"0.5058716",
"0.50396377",
"0.50187314",
"0.49941844",
"0.49847722",
"0.49... | 0.73850346 | 0 |
PATCH/PUT /tagging_select_tos/1 PATCH/PUT /tagging_select_tos/1.json | def update
respond_to do |format|
if @tagging_select_to.update(tagging_select_to_params)
format.html { redirect_to @tagging_select_to, notice: 'Tagging select to was successfully updated.' }
format.json { render :show, status: :ok, location: @tagging_select_to }
else
format.html { render :edit }
format.json { render json: @tagging_select_to.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def create\n @tagging_select_to = TaggingSelectTo.new(tagging_select_to_params)\n\n respond_to do |format|\n if @tagging_select_to.save\n format.html { redirect_to tagging_select_tos_path }\n... | [
"0.5837907",
"0.5675519",
"0.5596343",
"0.55959094",
"0.549714",
"0.5481679",
"0.54743373",
"0.54601854",
"0.5432531",
"0.5416601",
"0.53992194",
"0.5393969",
"0.53887045",
"0.5381043",
"0.53787017",
"0.5370408",
"0.53614634",
"0.53505164",
"0.53388655",
"0.533556",
"0.532215... | 0.67469025 | 0 |
DELETE /tagging_select_tos/1 DELETE /tagging_select_tos/1.json | def destroy
@tagging_select_to.destroy
respond_to do |format|
format.html { redirect_to tagging_select_tos_url, notice: 'Tagging select to was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @tagging.destroy\n respond_to do |format|\n format.html { redirect_to taggings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tagging = Tagging.fi... | [
"0.68601376",
"0.65920043",
"0.6550066",
"0.6502049",
"0.6449415",
"0.64215285",
"0.6378379",
"0.63627017",
"0.636218",
"0.63561",
"0.6351577",
"0.6345666",
"0.63378906",
"0.63337964",
"0.63175327",
"0.6313219",
"0.6311535",
"0.6311226",
"0.6299295",
"0.6288399",
"0.6286303",... | 0.75845844 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_tagging_select_to
@tagging_select_to = TaggingSelectTo.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def tagging_select_to_params
params.require(:tagging_select_to).permit(:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
returns a new array where every even number is replaced with it's greatest factor. A greatest factor is the largest number that divides another with no remainder. For example the greatest factor of 16 is 8. (For the purpose of this problem we won't say the greatest factor of 16 is 16, because that would be too easy, ha) def greatest_factor_array(arr) new_arr = [] arr.each do |ele| if ele.even? new_arr << ele / 2 else new_arr << ele end end new_arr end | def greatest_factor_array(arr)
new_arr = arr.map do |ele|
if ele % 2 == 0
greatest_factor(ele)
else
ele
end
end
new_arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greatest_factor_array(arr)\n\tlargest = []\n \tarr.each do |num|\n if num % 2 == 0\n largest << (num/2)\n else\n largest << num\n end\n end\n return largest\nend",
"def greatest_factor_array(arr)\n factors = []\n\n arr.each_with_index do |num, idx|\n if num % 2 == 0... | [
"0.8836459",
"0.87917525",
"0.8729955",
"0.8707655",
"0.8694197",
"0.84164226",
"0.83076316",
"0.8300444",
"0.7347033",
"0.7161948",
"0.70328724",
"0.6909982",
"0.66231513",
"0.65164655",
"0.65054137",
"0.65020794",
"0.6449267",
"0.6411552",
"0.6376486",
"0.6335429",
"0.62911... | 0.84255236 | 5 |
def greatest_factor(num) i = num 1 while i > 0 return i if num % i == 0 i = 1 end i end | def greatest_factor(num)
(2...num).reverse_each { |i| return i if num % i == 0}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greatest_factor(num)\n\n return num / 2\n\nend",
"def largest_prime_factor(num)\n (1..num).reverse_each do |factor|\n if num % factor == 0 && prime?(factor)\n return factor\n end\n end\nend",
"def largest_prime_factor(num)\n i = num - 1\n\n while i > 1 \n if is_prime?(i) && num % i == 0\... | [
"0.85741186",
"0.84822124",
"0.84734887",
"0.8472704",
"0.8405489",
"0.8399634",
"0.83548445",
"0.8351933",
"0.8349145",
"0.8347489",
"0.83375645",
"0.8337106",
"0.83363426",
"0.83282256",
"0.8323962",
"0.82846737",
"0.82792395",
"0.8270532",
"0.822819",
"0.8191237",
"0.81531... | 0.93649787 | 0 |
From the Wikipedia article. | def play_rules_orig
<<~'HOWTOPLAY'
The word to guess is represented by a row of dashes,
representing each letter of the word.
In most variants, proper nouns, such as names, places, and brands,
are not allowed.
Slang words, sometimes referred to as informal or shortened words,
are also not allowed.
If the guessing player suggests a letter which occurs in the word,
the other player writes it in all its correct positions.
If the suggested letter does not occur in the word,
the other player draws one element of a hanged man stick figure
as a tally mark.
The player guessing the word may, at any time, attempt to guess
the whole word.
If the word is correct, the game is over and the guesser wins.
Otherwise, the other player may choose to penalize the guesser by
adding an element to the diagram.
On the other hand, if the other player makes enough incorrect guesses
to allow his opponent to complete the diagram, the game is also over,
this time with the guesser losing.
However, the guesser can also win by guessing all the letters that
appear in the word, thereby completing the word, before the diagram
is completed.
HOWTOPLAY
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def schubert; end",
"def who_we_are\r\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def formation; end",
"def schumann; end",
"def probers; end",
"def verdi; end",
"def terpene; end",
"def berlioz; end",
"def suivre; end",
"def... | [
"0.70568717",
"0.6638157",
"0.6624238",
"0.65795666",
"0.65795666",
"0.65795666",
"0.65795666",
"0.6546433",
"0.6523202",
"0.6513668",
"0.6462409",
"0.6373735",
"0.6276951",
"0.6211681",
"0.6208222",
"0.6204818",
"0.6204818",
"0.6204818",
"0.6204757",
"0.6194655",
"0.6185891"... | 0.0 | -1 |
This is called by update_datum | def fetch_datum(company_number)
company_page = fetch_registry_page(company_number)
{:company_page => company_page}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_data; end",
"def updated_data\n\tend",
"def update() end",
"def update ; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def set_datum\n @datum = Datum.find(1)\n ... | [
"0.75853646",
"0.71466297",
"0.69835305",
"0.6687196",
"0.65621424",
"0.65621424",
"0.65621424",
"0.65621424",
"0.65621424",
"0.65621424",
"0.65621424",
"0.65621424",
"0.64661646",
"0.64647764",
"0.6369933",
"0.636669",
"0.63366765",
"0.62973106",
"0.62973106",
"0.626755",
"0... | 0.0 | -1 |
This overrides default save_entity (defined in RegisterMethods) and adds the inferred jurisdiction_code, unless it is overridden in entity_info | def save_entity(entity_info)
return if entity_info.blank?
default_options = {:jurisdiction_code => inferred_jurisdiction_code}
super(default_options.merge(entity_info))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n if @entity\n before_save\n @entity.save\n end\n self\n end",
"def _save\n raise NotImplementedError, 'override #_save in a subclass'\n end",
"def save\n raise NotImplementedError\n end",
"def save\n self.metadata[:type] = :metagenome if !metadata[:tax... | [
"0.55526155",
"0.5528686",
"0.5524536",
"0.55146414",
"0.54882145",
"0.54624605",
"0.54255515",
"0.5425525",
"0.53551114",
"0.52607256",
"0.52552086",
"0.52481186",
"0.52364814",
"0.5210222",
"0.51979923",
"0.51948625",
"0.5172679",
"0.5154451",
"0.5128875",
"0.5122893",
"0.5... | 0.8446863 | 0 |
EOL: this method was previously also checking: || include_eager_select?(options, joined_tables) | def references_eager_loaded_tables?(options)
joined_tables = joined_tables(options)
include_eager_order?(options, nil, joined_tables) || include_eager_conditions?(options, nil, joined_tables)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include_eager_conditions?(options)\n # look in both sets of conditions\n conditions = [scope(:find, :conditions), options[:conditions]].inject([]) do |all, cond|\n case cond\n when nil then all\n when Array then all << cond.first\n else all << cond\n end\n e... | [
"0.69874036",
"0.6904944",
"0.67060846",
"0.6422002",
"0.63992643",
"0.6140148",
"0.61125284",
"0.61125284",
"0.60921144",
"0.59842724",
"0.5962169",
"0.5929013",
"0.5911884",
"0.58883256",
"0.5885971",
"0.5875612",
"0.582514",
"0.5817943",
"0.5805094",
"0.5783552",
"0.576795... | 0.80248296 | 0 |
these methods load other templates and render them in the same context in which current document is rendered | def get_partial(partial_name)
tpl = @engine.templates.get_partial(partial_name)
tpl.render(self, @context_vars)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_content\n do_include(@template)\n end",
"def render_template(options={})\n # puts \"ActionController#render_template(start), options = #{options}\"\n #`var d = new Date(); console.log(\"time= \" + d.getSeconds() + \":\" + d.getMilliseconds());`\n #Timer.time_stamp(\"render_template (b... | [
"0.69908416",
"0.6917662",
"0.67717123",
"0.6731284",
"0.6692956",
"0.6686512",
"0.6598087",
"0.65941477",
"0.6592466",
"0.6592466",
"0.6558711",
"0.6551879",
"0.65018123",
"0.64419883",
"0.64108515",
"0.6382845",
"0.6351124",
"0.633918",
"0.6338802",
"0.63102716",
"0.6304993... | 0.0 | -1 |
these methods behave the same in all contexts they are context independet | def is_context?(context_name)
@type == context_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def con... | [
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047"... | 0.0 | -1 |
this is special kind of method that is used in layout template. it gets correct partial for the layout depending on context. | def get_content_for_layout()
get_partial(@type)
# if @type == "home"
# get_partial('home')
# elsif @type == "page"
# get_partial('page')
# elsif @type == "article"
# get_partial('article')
# elsif @type == "category"
# get_partial('category')
# end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_partial(context, options, &block); end",
"def render_with_layout_and_partials(format)\n # looking for system mail.\n template = MailEngine::MailTemplate.where(:path => \"#{controller_path}/#{action_name}\", :format => format, :locale => I18n.locale, :partial => false, :for_marketing => false... | [
"0.706628",
"0.6885645",
"0.67656595",
"0.67634654",
"0.6710283",
"0.6710283",
"0.6710283",
"0.6710283",
"0.66359925",
"0.66131175",
"0.6587355",
"0.6571997",
"0.65533507",
"0.6532503",
"0.63788545",
"0.6357265",
"0.6286693",
"0.6264173",
"0.62509847",
"0.62193024",
"0.621558... | 0.7323358 | 0 |
result of calling these depends on context in which they are used, it depends on request that is made | def get_article()
@engine.content_loader.articles[@request.name]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prepare_context; end",
"def call(request); end",
"def apply_request(request_env); end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end"... | [
"0.66573787",
"0.6616938",
"0.6570738",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6468401",
"0.6443072",
"0.64282733",
"0.63554573",
"0.63554573",
"0.6352966",
"0.6352966",... | 0.0 | -1 |
Sneakers workergroup supports callable objects. | def call
case activejob_workers_strategy
when :only then activejob_workers
when :exclude then sneakers_workers
when :include then sneakers_workers + activejob_workers
else
raise "Unknown activejob_workers_strategy '#{activejob_workers_strategy}'"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def worker_pool; end",
"def worker_pool; end",
"def runnable_methods; end",
"def runnable_methods; end",
"def runnables; end",
"def worker_factory(&block)\n end",
"def work_pool; end",
"def call(object); end",
"def supports_parallel=(_arg0); end",
"def workers(count); end",
"def be_callabl... | [
"0.5717419",
"0.5717419",
"0.55718195",
"0.55718195",
"0.55365074",
"0.54011554",
"0.537022",
"0.53240883",
"0.5183029",
"0.5145301",
"0.51399696",
"0.51261675",
"0.51261675",
"0.5114676",
"0.5103349",
"0.5103349",
"0.5102286",
"0.5086393",
"0.50788176",
"0.50788176",
"0.5078... | 0.5384648 | 6 |
FUNCTION TO CREATE NEW SHEET | def create_new_sheet(title,description, keys, level)
acai = Keyword.find_by_name("ACAI") #default skill keywords required
sheet = Sheet.new
sheet.title = title.split(":").last.humanize
sheet.id_dokuwiki = title
if(level.to_s.match(/[0-3]/))
sheet.level = level
else
sheet.level = 1 #default level
end
sheet.keywords << keys
sheet.description = description
if !sheet.valid?
sheet.keywords << acai
end
sheet.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_workspace_and_options_tabs()\n new_notebook = Wx::Notebook.new(self)\n\n @ws_tab = Wx::Panel.new(new_notebook) # Add workspace tab\n @ws_mvsizer = Wx::BoxSizer.new(Wx::VERTICAL)\n @ws_tab.set_sizer(@ws_mvsizer)\n\n @options_tab = Wx::Panel.... | [
"0.6324326",
"0.62604487",
"0.6200395",
"0.60549337",
"0.5996959",
"0.5940327",
"0.5912834",
"0.58212954",
"0.57971656",
"0.5793669",
"0.5787875",
"0.5787875",
"0.5771627",
"0.5731664",
"0.56987804",
"0.56987804",
"0.56987804",
"0.56957215",
"0.56812",
"0.5626818",
"0.5626818... | 0.0 | -1 |
KEYWORDS return a hash table associating : /regexp/ => [an array of keywords objects] | def return_hash
kt = KeywordTagger.new
hash = kt.get_hash_regex_tags("public/conversion.txt")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keywords\n self.to_s.downcase.split(SPLIT_REGEXP).uniq\n end",
"def keywords\n response = request :keywords\n keywords = Hash.new\n response[\"labels\"].each do |label|\n keywords[label[\"keyword\"]] = label[\"content\"]\n end\n keywords\n end",
"def keywords\n ... | [
"0.70199996",
"0.6949908",
"0.6922844",
"0.6886545",
"0.6787974",
"0.673679",
"0.67182547",
"0.6590022",
"0.6560572",
"0.6557703",
"0.6547681",
"0.64885974",
"0.6481766",
"0.64325744",
"0.6399092",
"0.637511",
"0.63645184",
"0.6358961",
"0.63541293",
"0.6276333",
"0.6272589",... | 0.0 | -1 |
define a keyword to skip the sheet upload" | def keyword_to_skip(keyword_name)
kw = Keyword.find_by_name(keyword_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def should_be_skipped?(word)\n reject?(word) || hashtag?(word) || uri?(word) || mention?(word)\n end",
"def skip_actions; end",
"def skip &block\n annotate block do |c|\n c unless @item_rep.name == :wordcount\n end\nend",
"def skip\n end",
"def skip\n end",
"def skip!\n @skip ... | [
"0.57791114",
"0.567176",
"0.56295663",
"0.56086713",
"0.56086713",
"0.5521256",
"0.54990757",
"0.5498019",
"0.5457367",
"0.54508346",
"0.5446129",
"0.5419818",
"0.5403558",
"0.5350712",
"0.5344656",
"0.5343738",
"0.52921486",
"0.5287246",
"0.5282029",
"0.5282029",
"0.5266414... | 0.5718274 | 1 |
p single_number([1,1,"x",3,3,4,4]) p single_number([1,3,5,2,3,1,5]) | def single_number2(nums)
nums.reduce do |collect, num|
collect ^= num
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def single_number(nums)\n\nend",
"def single_number(nums)\n nums.reduce(&:^)\n #亦可 nums.reduce(:^)\nend",
"def single_number(nums)\n uniques = []\n nums.each do |num|\n uniques.include?(num) ? uniques.delete(num) : uniques << num\n end\n uniques\nend",
"def single_number(nums)\n 2 * nums.uniq.reduc... | [
"0.7285275",
"0.65919673",
"0.6521219",
"0.64225745",
"0.6253436",
"0.6211811",
"0.61699307",
"0.6069327",
"0.6022176",
"0.600738",
"0.60004574",
"0.59475034",
"0.5937772",
"0.5903997",
"0.59025484",
"0.5884195",
"0.58220994",
"0.58032167",
"0.5802783",
"0.5797271",
"0.579272... | 0.55491036 | 46 |
def bitwise_and(num1, num2) puts "num1 = " + num1.to_s(2) puts "num2 = " + num2.to_s(2) puts "base 10 & = " + (num1 & num2).to_s(10) puts "base 2 & = " + (num1 & num2).to_s(2) end | def bitwise_and(num1, num2)
bnum1 = num1.to_s(2)
bnum2 = num2.to_s(2)
band = (num1 & num2).to_s(2)
puts "num1 = " + ( ' ' * bnum2.length ) + num1.to_s(2)
puts "num2 = " + ( ' ' * bnum1.length ) + num2.to_s(2)
puts "b2& = " + ( ' ' * ([bnum1.length, bnum2.length].max ) + band)
# puts "base 10 & = " + (num1 & num2).to_s(10)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitwise_and(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == b[index]\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend",
"def bitwise_xor(num1, num2)\n bnum1 = num1.to_s(2)\n bnum2 = num2.to_s(2)\n band = (num1 | num2).to_... | [
"0.78859276",
"0.7717622",
"0.66721344",
"0.6488093",
"0.6440578",
"0.63982505",
"0.6397612",
"0.6263405",
"0.6255527",
"0.6242118",
"0.62236214",
"0.6220425",
"0.62080175",
"0.61478835",
"0.611702",
"0.6105664",
"0.61038685",
"0.6096713",
"0.60895616",
"0.6038395",
"0.600803... | 0.937498 | 0 |
bitwise_not(num1) 01101010101 01010111011 00111101110 | def bitwise_xor(num1, num2)
bnum1 = num1.to_s(2)
bnum2 = num2.to_s(2)
band = (num1 | num2).to_s(2)
puts "num1 = " + ( ' ' * bnum2.length ) + num1.to_s(2)
puts "num2 = " + ( ' ' * bnum1.length ) + num2.to_s(2)
puts "b|& = " + ( ' ' * ([bnum1.length, bnum2.length].min ) + band)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitnot(b)\n (~b)&1\nend",
"def not\n ~@bits\n end",
"def bitwise_not(a)\n\tresult = ''\n\ta.each_char do |val|\n\t\tif val == '1' \n\t\t\tresult.concat '0'\n\t\telse\n\t\t\tresult.concat '1'\n\t\tend\n\tend\n\treturn result\nend",
"def xor(a,b)\n (a | b) - (a & b)\n end",
"def unsigned_not... | [
"0.7656138",
"0.7366036",
"0.72996163",
"0.65726906",
"0.6459544",
"0.63448286",
"0.6291332",
"0.62876874",
"0.621211",
"0.61929053",
"0.60908175",
"0.60612786",
"0.5994837",
"0.5928881",
"0.5894501",
"0.58674407",
"0.5862595",
"0.5853673",
"0.5853673",
"0.5853223",
"0.583454... | 0.72867185 | 3 |
Creates and initializes a new instance of the Metrics class. | def initialize(client)
@client = client
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(...)\n @metrics = {}\n register(...)\n end",
"def initialize(metrics)\n @metrics = metrics\n end",
"def initialize\n @metrics = { processed: 0, skipped: 0, failed: 0, updated: 0,\n unchanged: 0, start_time: 0, failed_list: [],\n ... | [
"0.78000325",
"0.7760029",
"0.73663616",
"0.70968986",
"0.70968986",
"0.70968986",
"0.68755037",
"0.66867405",
"0.6631004",
"0.6631004",
"0.6501228",
"0.65010643",
"0.64352846",
"0.6345413",
"0.63025486",
"0.6266697",
"0.62650454",
"0.62628955",
"0.61900526",
"0.6134465",
"0.... | 0.0 | -1 |
codecite dq codecite sq | def print_string_message_sq
puts 'Double-quoted strings can include escaped characters such as \n and \\\\'
puts 'as well as interpolated Ruby expressions like #{Time.now}.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query(q=\"\")\n\t\tif @connection != nil\n\t\t\t@data = MonetDBData.new(@connection)\n\t\t\t@data.execute(q)\n\t\tend\n\t\treturn @data\n\tend",
"def query(q=\"\")\n if @connection != nil \n @data = MonetDBData.new(@connection)\n @data.execute(q)\n end\n return @data\n end",... | [
"0.57243073",
"0.57214373",
"0.5711187",
"0.56434405",
"0.5637402",
"0.56352603",
"0.562154",
"0.5586893",
"0.5579014",
"0.55219436",
"0.5497306",
"0.5494304",
"0.54799455",
"0.54527503",
"0.54382294",
"0.5436169",
"0.54321504",
"0.541295",
"0.5396465",
"0.5388015",
"0.537587... | 0.0 | -1 |
codecite sq codecite gdi | def print_string_message_gdi
puts %q{Double-quoted strings can include escaped characters such as \n and \\\\
as well as interpolated Ruby expressions like #{Time.now}.}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grid_image\n s = ''\n s << \" %s %s %s \\n\" % [own(256), own(128), own(64)]\n s << \" %s %s %s \\n\" % [own(32), own(16), own(8)]\n s << \" %s %s %s \\n\" % [own(4), own(2), own(1)]\n s\n end",
"def to_abgr_stream\n pixels.pack(\"V*\")\n end",
"def test055()\n begin\n ... | [
"0.5013841",
"0.49944857",
"0.48619965",
"0.4856925",
"0.48478654",
"0.483111",
"0.48011625",
"0.47925946",
"0.47771898",
"0.47669128",
"0.47601056",
"0.475142",
"0.47498924",
"0.47498924",
"0.474847",
"0.47419417",
"0.470961",
"0.46942613",
"0.46757555",
"0.46641204",
"0.466... | 0.0 | -1 |
codecite gdi codecite hd | def print_string_message_hd
puts <<'EOS'
Double-quoted strings can include escaped characters such as \n and \\
as well as interpolated Ruby expressions like #{Time.now}.
EOS
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fh\n return hex_side_length + 2 * th\n end",
"def cp_d8\n end",
"def test_progressive_dct_based_jpeg_image\n testname = '35w x 35h progressive jpeg image.'\n data = %w(\n FF D8 FF E0 00 10 4A 46 49 46 00 01 02 01 00 96\n 00 96 00 00 FF E1 04 E7 45 78 69 66 00 00 4D 4D\n 00 2A ... | [
"0.5783946",
"0.5724541",
"0.53958356",
"0.5323703",
"0.5311564",
"0.52439237",
"0.51876384",
"0.5156179",
"0.5156179",
"0.5151124",
"0.5150838",
"0.5118829",
"0.5089709",
"0.5073772",
"0.5069505",
"0.5060393",
"0.5059443",
"0.5059357",
"0.5044219",
"0.5018501",
"0.5006215",
... | 0.0 | -1 |
codecite revised_delete_matches codecite lookups | def many_lookups(keys)
h = {}
keys.each{|k| h[k] = rand(100)}
1_000_000.times do
key = keys[rand(keys.size)]
v = h[key]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_matched\n raise NotImplementedError, \"#{self.class} does not support delete_matched\"\n end",
"def delete_matched(matcher, options = nil)\n key = expand_key(matcher)\n\n begin\n @gibson.mdel key\n rescue\n 0\n end\n end",
"def delete_matche... | [
"0.6774322",
"0.66050416",
"0.6576475",
"0.64533734",
"0.62030494",
"0.6066605",
"0.6064087",
"0.5980027",
"0.5934873",
"0.5803076",
"0.5779177",
"0.5756609",
"0.5682677",
"0.56647307",
"0.56103575",
"0.5589637",
"0.55868906",
"0.5581016",
"0.5578092",
"0.5563069",
"0.5536397... | 0.0 | -1 |
Initialise an object of this class | def initialize(p)
super p.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize() end",
"def initialize\n init\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize\n \n end",
"def initialize()\n end",
"def initialize\n end",
"def initialize(*) end",
"def initialize(*) ... | [
"0.81757414",
"0.8128207",
"0.8067372",
"0.8067372",
"0.80479723",
"0.7882572",
"0.7870836",
"0.7818271",
"0.7818271",
"0.7818271",
"0.7818271",
"0.7818271",
"0.7817099",
"0.78005636",
"0.779854",
"0.779854",
"0.779854",
"0.7768438",
"0.7768438",
"0.7768438",
"0.7768438",
"... | 0.0 | -1 |
Return the concatenated path | def +(p)
Tenji::Path.new(super(p))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\n s = ''\n s << '/' if @absolute\n s << @path.join('/')\n s << '/' if @trail\n s << '.' if s.empty?\n s\n end",
"def path_str\n path.join(\"-\")\n end",
"def to_s\n return \"\" if self.empty?\n @path.join(\":\")\n end",
"def path\n \"/\" + @pref... | [
"0.74296117",
"0.7292411",
"0.7278487",
"0.716188",
"0.70760024",
"0.69143766",
"0.68920183",
"0.684579",
"0.682155",
"0.6789956",
"0.6778412",
"0.6757849",
"0.6728688",
"0.6701082",
"0.6676298",
"0.6655346",
"0.66476667",
"0.6633297",
"0.66215134",
"0.6604594",
"0.65826005",... | 0.0 | -1 |
Return the base of a path The 'base' here means the portion of the basename before the extension. | def base()
sub_ext('').basename.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_path\n @base_path ||= Dir.pwd\n end",
"def base_path\n @base_path ||= server_path(File.expand_path(Dir.pwd))\n end",
"def base\n File.basename @filename, extension_with_delimiter\n end",
"def base_path path=nil\n if path\n @base_path = path\n end\n @base_pat... | [
"0.74745333",
"0.742273",
"0.7410979",
"0.7403777",
"0.7384916",
"0.72389424",
"0.72376144",
"0.7234708",
"0.7222469",
"0.72050786",
"0.71746284",
"0.71538174",
"0.71474844",
"0.7137092",
"0.7124422",
"0.7124422",
"0.70651734",
"0.7056925",
"0.7041405",
"0.69552046",
"0.69213... | 0.79545283 | 0 |
Return paths to files that are located within the path | def files()
children.select { |c| c.file? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def files_in_path\n Dir.glob(\"#{@path}/**/*/**\") | Dir.glob(\"#{@path}/**\")\n end",
"def get_file_absolute_paths path\n get_file_names(path).map { |file| File.join(path, file) }\n end",
"def paths\n f = File.open(@path)\n f.grep(FILE_NAME_PATTERN) { $1 }\n en... | [
"0.82268316",
"0.78790146",
"0.7836054",
"0.7814991",
"0.7773205",
"0.76948005",
"0.7514166",
"0.74693745",
"0.7413053",
"0.7412432",
"0.7410526",
"0.73028815",
"0.7286824",
"0.7285109",
"0.72723496",
"0.72565365",
"0.725538",
"0.7242554",
"0.7230413",
"0.72164303",
"0.720616... | 0.0 | -1 |
Return whether this is a path to an image | def image?()
IMAGE_EXTS.include? extname
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image?\n ext = File.extname(@path)\n case ext.downcase\n when '.png', '.jpg', '.jpeg', '.gif'; return true\n else; return false\n end\n end",
"def is_path?\n !!((@file.is_a?(String) || @file.is_a?(Pathname)) && !@file.blank?)\n end",
"def image?(src)\n !File.directo... | [
"0.7915396",
"0.7627567",
"0.7523299",
"0.7521808",
"0.73289144",
"0.7310542",
"0.7299094",
"0.72928894",
"0.7286898",
"0.7286898",
"0.7236265",
"0.7222476",
"0.7149916",
"0.7141606",
"0.7115477",
"0.7093228",
"0.7071559",
"0.70577955",
"0.7042917",
"0.7042819",
"0.70237076",... | 0.71911275 | 12 |
Return the index file that is within this path | def index()
INDEXES.find { |i| (self + i).exist? }&.yield_self { |i| self + i }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_file\n File.join(@directory, @host)\n end",
"def index_path(path)\n path ? path.chomp(File.extname(path)) + '.index' : nil\n end",
"def index_path\n safe_dir / options[:index_name]\n end",
"def open_index_file\n end",
"def open_index_file\n @index = File.open(@... | [
"0.80191094",
"0.7670035",
"0.74189043",
"0.7242241",
"0.7171243",
"0.7085409",
"0.7046452",
"0.70265096",
"0.6979762",
"0.679883",
"0.675183",
"0.6677703",
"0.6581338",
"0.65166694",
"0.6486712",
"0.6464035",
"0.6377175",
"0.6350682",
"0.63445973",
"0.6334734",
"0.6332449",
... | 0.0 | -1 |
Return whether this is a path to an index file | def index?
INDEXES.include? self.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index?\n File.basename(path, '.*') == 'index'\n end",
"def index?\n basename == \"index\"\n end",
"def index?\n basename == \"index\"\n end",
"def directory_index?\n path.include?(@app.config[:index_file]) || path =~ /\\/$/ || eponymous_directory?\n end",
"def indexi... | [
"0.85196257",
"0.8095758",
"0.8095758",
"0.8028921",
"0.80063266",
"0.79343736",
"0.77629954",
"0.7431194",
"0.7342893",
"0.73079026",
"0.7023683",
"0.69463253",
"0.68939525",
"0.67599154",
"0.6754572",
"0.6690822",
"0.6678313",
"0.6670263",
"0.6662022",
"0.6610829",
"0.65754... | 0.69843817 | 11 |
Return the basename of this path | def name()
basename.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basename\n File.basename(path)\n end",
"def basename\n File.basename(@path, '.*')\n end",
"def basename\n @basename ||= File.basename(path)\n end",
"def basename( path )\r\n File.basename( path )\r\n end",
"def basename\n File.basename( fullpath, ext )\n ... | [
"0.8931662",
"0.8930892",
"0.8696967",
"0.8563624",
"0.8524203",
"0.84646547",
"0.8336217",
"0.8336217",
"0.8336217",
"0.8334566",
"0.8332328",
"0.8284411",
"0.8193947",
"0.81410867",
"0.81361055",
"0.8090682",
"0.8075787",
"0.80571336",
"0.8047242",
"0.7970981",
"0.7968894",... | 0.75784487 | 36 |
Return whether this is a path to a page | def page?
PAGE_EXTS.include? extname
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_path?(path); end",
"def path_is?(path)\n @location.path_is?(path)\n end",
"def in_path?\r\n self.aln_path_id.nil? ? false : true\r\n end",
"def points_to? path\n href = @tag.scan(/href=\\\"([^\"]*)\\\"/)[0][0] rescue nil\n return false unless href\n unless href.start_with? '/'... | [
"0.7659068",
"0.7474515",
"0.7307276",
"0.72600466",
"0.7252238",
"0.71985817",
"0.7168751",
"0.7168751",
"0.71575993",
"0.70962524",
"0.7028101",
"0.70043",
"0.6998761",
"0.6980428",
"0.6898934",
"0.67808247",
"0.67758626",
"0.67670053",
"0.6727148",
"0.668895",
"0.6672746",... | 0.6680367 | 20 |
Return paths to directories that are located within the path | def subdirectories()
children.select { |c| c.directory? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_directories_absolute_paths path\n dir_list = Dir[\"#{path}/*/\"]\n \n #Remove unnecessary directories\n dir_list.delete(File.join(path, \".\"))\n dir_list.delete(File.join(path, \"..\"))\n \n dir_list\n end",
"def subdir_paths(path)\n\tfolder_metadata = @client.metad... | [
"0.7960086",
"0.7743149",
"0.77249473",
"0.7532881",
"0.74060684",
"0.71659684",
"0.714252",
"0.70631945",
"0.70460904",
"0.7045724",
"0.7043294",
"0.69965637",
"0.69935155",
"0.6992477",
"0.6915281",
"0.6914906",
"0.6872348",
"0.6838196",
"0.68331164",
"0.67923707",
"0.67644... | 0.0 | -1 |
may lead to loops in blank transition graph...(as may opt and star) | def nothing
return lambda do |pos|
return []
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transitions; end",
"def transition_at; end",
"def transition_at; end",
"def build_assignment_graph(layer)\n\t\th = @via_positions.length\n\t\tfail if (h == 0) || h.odd?\n\t\tfail if @start_node.pads.min < 0 || @start_node.pads.max >= @layer_count\n\t\tfail if @end_node.pads.min < 0 || @end_node.pads.max ... | [
"0.6105018",
"0.5975996",
"0.5975996",
"0.5898765",
"0.5732203",
"0.57321805",
"0.57247144",
"0.56873465",
"0.5593367",
"0.55826366",
"0.55662495",
"0.5543487",
"0.5496651",
"0.54930145",
"0.546061",
"0.5457375",
"0.5449119",
"0.5427467",
"0.5408365",
"0.5395222",
"0.53791296... | 0.0 | -1 |
N.B. this assumes that the NFA will not be modified after creation (breaking this assumption will result in problems) | def alt(*list)
return lambda do |pos|
startstate = { '' => Set.new }
statelist = [startstate]
endstate = { '' => Set.new }
curpos = pos + statelist.size
list.each do |item|
startstate[''] << curpos
statelist += item.call(curpos)
statelist << endstate
curpos = pos + statelist.size
end
endstate[''] << curpos
return statelist
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dfa\n # FILL IN\n\tinput = self\n output = NFA.new\n\toutput.set_start([input.start])\n\trStates = [output.start]\n\tmarked = []\n\t# get Sigma\n\tsigma = []\n\tinput.delta.values.each{|hash|\n\t\thash.keys.each{|sym|\n\t\tsigma << sym\n\t\t}\n\t}\n\tsigma =sigma.uniq\n\tr = rStates[0]\n\ti = 0\n\t\n... | [
"0.6660806",
"0.64166707",
"0.62069744",
"0.608312",
"0.6000144",
"0.58836854",
"0.58663476",
"0.5805256",
"0.5668479",
"0.5551849",
"0.5510701",
"0.5497563",
"0.54340285",
"0.534625",
"0.5335955",
"0.5301236",
"0.528755",
"0.52710116",
"0.52608716",
"0.5255979",
"0.5231693",... | 0.0 | -1 |
used in the composition of star(reg) | def plus(reg)
return lambda do |pos|
statelist = reg.call(pos)
curpos = pos + statelist.size
endstate = { '' => Set.new( [pos, curpos + 1] ) }
statelist << endstate
return statelist
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def star(reg)\n return opt(plus(reg))\nend",
"def star; end",
"def star\n end",
"def *(mat)\n end",
"def _all_gp_reg_pair\n (0..7).each do |reg|\n (0..3).each do |x|\n yield \"r#{reg}\", \"r#{x*2}#{x*2+1}\"\n end\n end\n end",
"def g_(acc,elt)\n elt/acc\nend",
"def do_... | [
"0.7529917",
"0.6907497",
"0.6515655",
"0.6114417",
"0.5879277",
"0.5828981",
"0.5748637",
"0.57189995",
"0.5566581",
"0.5525674",
"0.55143756",
"0.5504979",
"0.5434158",
"0.54329085",
"0.54289484",
"0.5415777",
"0.54147065",
"0.5371988",
"0.5345551",
"0.5345551",
"0.53455114... | 0.5284418 | 25 |
a bit more sparing of states than alt(reg, nothing) | def opt(reg)
return lambda do |pos|
startstate = { '' => Set.new( [pos + 1] ) }
statelist = [startstate]
curpos = pos + statelist.size
statelist += reg.call(curpos)
curpos = pos + statelist.size
startstate[''] << curpos
return statelist
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alt; end",
"def alt!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n\n type = ALT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 364:6: 'alt'\n match( \"alt\" )\n\n \n @... | [
"0.63446397",
"0.5824006",
"0.56562275",
"0.5316395",
"0.5261836",
"0.52585137",
"0.52528393",
"0.5120512",
"0.5072245",
"0.5040999",
"0.50188017",
"0.49687326",
"0.4962686",
"0.49578175",
"0.49424246",
"0.4932312",
"0.4932312",
"0.49138054",
"0.4894773",
"0.4894773",
"0.4894... | 0.0 | -1 |
AFAIK star effectively has to be implemented this way anyway This does end up with effectively a redundant state. However, AFAICT there is no way to change this without changing the way that the regexp is constructed. It will all be cleaned up anyway in conversion to a DFA (or one of the preliminary steps). | def star(reg)
return opt(plus(reg))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def star!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 44 )\n\n type = STAR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 165:8: '*'\n match( 0x2a )\n\n \n @state.type = type\n ... | [
"0.66381747",
"0.658676",
"0.658676",
"0.65733165",
"0.65465087",
"0.65069866",
"0.6434461",
"0.6313024",
"0.627578",
"0.614446",
"0.6119185",
"0.6092252",
"0.6092252",
"0.60854095",
"0.6083728",
"0.60592455",
"0.60592455",
"0.60592455",
"0.60528296",
"0.60528296",
"0.6052829... | 0.64518315 | 6 |
Override ActiveRecord::Core::ClassMethodscached_find_by_statement `.find_by` not use caching | def cached_find_by_statement(key, &block)
ActiveRecord::StatementCache.create(connection, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_by()\n\n end",
"def find_by_sql(sql)\n raise \"not implemented\"\n end",
"def execute_find(raw = false)\n get_records\n cached = AridCache::CacheProxy::Result.new\n\n if !records.is_a?(Enumerable) || (!records.empty? && !records.first.is_a?(::ActiveRecord::Base))\n ... | [
"0.72358453",
"0.6870087",
"0.6779436",
"0.66328907",
"0.65448064",
"0.6391681",
"0.63457483",
"0.62718374",
"0.6224275",
"0.61801624",
"0.61801624",
"0.6170054",
"0.61586505",
"0.6157591",
"0.6153274",
"0.60969555",
"0.60969555",
"0.60943407",
"0.6061849",
"0.60610247",
"0.6... | 0.7276167 | 0 |
test_oi_category_selection Description: This method does the functional testing of the oi_category_selection method from the OI Instruction Controller class | def test_io_category_selection
categories = ['Board Preparation', 'Placement',
'Routing', 'Fabrication Drawing',
'Nomenclature', 'Assembly Drawing',
'Other']
# Try accessing from an account that is not a PCB Designer and
# verify that the user is redirected.
get(:oi_category_selection, {:design_id => @mx234a.id}, pat_dfm_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a Teradyne PCB Designer can access the list.
get(:oi_category_selection, { :design_id => @mx234a.id }, scott_designer_session)
assert_response(:success)
assert_not_nil(assigns(:design))
assert_equal(@mx234a.id, assigns(:design).id)
assert_equal('252-234-a0 g', assigns(:design).part_number.pcb_display_name)
assert_not_nil(assigns(:oi_category_list))
oi_category_list = assigns(:oi_category_list)
assert_equal(categories.size, oi_category_list.size)
categories.each_index do |i|
assert_equal(categories[i], oi_category_list[i].name)
end
# Verify that a contractor PCB Designer can access the list.
get(:oi_category_selection, { :design_id => @mx234a.id }, siva_designer_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
#assert_equal("You are not authorized to access this page", flash['notice'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_feature_for_category\r\n\t\tfeatures = Feature.for_category(categories(:root).id, 99)\r\n\r\n\t\tassert_equal(2, features.length)\r\n\t\tassert_equal(true, features.include?(products(:persian)))\r\n\t\tassert_equal(true, features.include?(products(:cow2)))\r\n\r\n\t\tfeatures = Feature.for_category(catego... | [
"0.6159697",
"0.6121553",
"0.6109961",
"0.61050713",
"0.6050262",
"0.59318423",
"0.5913041",
"0.589557",
"0.588123",
"0.5817813",
"0.5737933",
"0.57141",
"0.5670626",
"0.56403756",
"0.55908376",
"0.5588808",
"0.5502979",
"0.5473487",
"0.5470811",
"0.5427661",
"0.5418104",
"... | 0.7933748 | 0 |
test_section_selection Description: This method does the functional testing of the section_selection method from the OI Instruction Controller class | def test_section_selection
# Try accessing from an account that is not a PCB Designer and
# verify that the user is redirected.
get(:section_selection,
{ :id => @board_prep.id, :design_id => @mx234a.id },
pat_dfm_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a Teradyne PCB Designer can access the list.
post(:section_selection,
{:id => @board_prep.id, :design_id => @mx234a.id},
scott_designer_session)
assert_response(:success)
design = assigns(:design)
assert_not_nil(design)
assert_equal(@mx234a.id, design.id)
assert_equal('252-234-a0 g', design.part_number.pcb_display_name)
category = assigns(:category)
assert_not_nil(category)
assert_equal(@board_prep.id, category.id)
assert_equal('Board Preparation', category.name)
exp_sections = [oi_category_sections(:board_prep_1),
oi_category_sections(:board_prep_2),
oi_category_sections(:board_prep_3)]
sections = assigns(:sections)
exp_sections.each do |exp_section|
actual_section = sections.shift
assert_equal(exp_section.id, actual_section.id)
assert_equal(exp_section.name, actual_section.name)
assert_equal(exp_section.url1, actual_section.url1)
assert_equal(exp_section.instructions, actual_section.instructions)
assert_equal(exp_section.oi_category_id,
actual_section.oi_category_id)
assert_equal(exp_section.allegro_board_symbol,
actual_section.allegro_board_symbol)
assert_equal(exp_section.outline_drawing_link,
actual_section.outline_drawing_link)
end
# Verify that a contractor PCB Designer can not access the list.
get(:section_selection,
{:id => @board_prep.id, :design_id => @mx234a.id},
siva_designer_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
#assert_equal("You are not authorized to access this page", flash['notice'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def section\n section_test.section\n end",
"def assert_section (selected)\n is_nil = selected === nil\n @assertions.each do |section,tests|\n now = Time.now\n if section === selected or is_nil then\n puts 'Testing ' + section\n tests.each do |test|\n @... | [
"0.6841492",
"0.67223203",
"0.6290562",
"0.623527",
"0.6116589",
"0.5965091",
"0.59279114",
"0.58901155",
"0.5863963",
"0.58354694",
"0.5829924",
"0.57749844",
"0.5761754",
"0.57307285",
"0.5727075",
"0.57064474",
"0.5703775",
"0.56948864",
"0.568129",
"0.5634366",
"0.561321"... | 0.74733424 | 0 |
test_process_assignments Description: This method does the functional testing of the | def test_process_assignments
board_prep_sections = [oi_category_sections(:board_prep_1),
oi_category_sections(:board_prep_2),
oi_category_sections(:board_prep_3)]
section_ids = board_prep_sections.collect { |s| s.id }
team_member_list = [@siva_e]
section_selections = {}
section_ids.each { |id| section_selections[id.to_s] = '0' }
# Try accessing from an account that is not a PCB Designer and
# verify that the user is redirected.
post(:process_assignments,
{ :category => { :id => @board_prep.id },
:design => { :id => @mx234a.id },
:section => section_selections },
pat_dfm_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a contractor PCB Designer can not access the list.
post(:process_assignments,
{ :category => { :id => @board_prep.id },
:design => { :id => @mx234a.id },
:section => section_selections },
siva_designer_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
#assert_equal("You are not authorized to access this page", flash['notice'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_assignments(user)\n # A user can manage an Assignment if they have the\n # can_manage_assignments? permission in any of the CourseOfferings of\n # the Course that the assignment belongs to.\n #\n # TODO This may need improvement.\n can :manage, Assignment do |assignment|\n course... | [
"0.6459815",
"0.6316795",
"0.61676776",
"0.61282265",
"0.60985446",
"0.58879894",
"0.5867649",
"0.5842562",
"0.58248323",
"0.5806834",
"0.5797749",
"0.5794961",
"0.5794961",
"0.5794961",
"0.5794961",
"0.5794961",
"0.5760024",
"0.5683397",
"0.5625491",
"0.5575681",
"0.5547382"... | 0.6767746 | 0 |
test_process_assignment_details Description: This method does the functional testing of the | def test_task_assignment
board_prep_sections = [oi_category_sections(:board_prep_1),
oi_category_sections(:board_prep_2),
oi_category_sections(:board_prep_3)]
section_ids = board_prep_sections.collect { |s| s.id }
team_member_list = [@siva_e]
designer_session = scott_designer_session
# Verify that a Teradyne PCB Designer can access the list
#
# Section Selection - Other
get(:section_selection,
{ :id => @other.id, :design_id => @mx234a.id },
designer_session)
assert_redirected_to(:action => :process_assignments,
:category_id => @other.id,
:design_id => @mx234a.id,
:section_id => OiCategory.other_category_section_id)
# Section Selection - Board Prep
get(:section_selection,
{:id => @board_prep.id, :design_id => @mx234a.id },
designer_session)
assert_equal(board_prep_sections, assigns(:sections))
assert_equal(0, assigns(:section_id))
# Process Assignments - No step selected
post(:process_assignments,
{ :design => { :id => @mx234a.id },
:category => { :id => @board_prep.id } },
designer_session)
#assert_equal("Please select the step", flash['notice'])
assert_nil(flash[:assignment])
assert_redirected_to(:action => 'section_selection',
:id => @board_prep.id,
:design_id => @mx234a.id)
# Process Assignments - No errors
post(:process_assignments,
{ :section_id => oi_category_sections(:board_prep_1).id,
:design => { :id => @mx234a.id },
:category => { :id => @board_prep.id } },
designer_session)
assert_equal(@mx234a.id, assigns(:design).id)
assert_equal(@board_prep.id, assigns(:category).id)
lcr_team_members = assigns(:team_members)
expected_team_members = [@siva_e, @mathi_n]
assert_equal(expected_team_members, lcr_team_members)
assert_equal(oi_category_sections(:board_prep_1).id,
assigns(:selected_step).id)
instruction = assigns(:instruction)
assert_equal(@board_prep.id, instruction.oi_category_section_id)
assert_equal(@mx234a.id, instruction.design_id)
assignment = assigns(:assignment)
assert_equal((Time.now+1.day).year, assignment.due_date.year)
assert_equal((Time.now+1.day).month, assignment.due_date.month)
assert_equal((Time.now+1.day).day, assignment.due_date.day)
assert_equal(OiAssignment.complexity_id('Low'), assignment.complexity_id)
assert_not_nil(assigns(:comment))
assert(!assigns(:selected_step).outline_drawing_link?)
allegro_board_symbol = '10987654321'
assignment_comment = 'This is a test'
medium_complexity_id = OiAssignment.complexity_id('Medium')
due_date = Time.local(2007, "May", 1)
# Process Assignment Details - No allegro board symbol provided.
post(:process_assignment_details,
{ :category => { :id => @board_prep.id },
:design => { :id => @mx234a.id },
:comment => { :comment => assignment_comment},
:instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s },
:assignment => { :complexity_id => medium_complexity_id,
"due_date(1i)" => "2007",
"due_date(2i)" => "5",
"due_date(3i)" => "1" },
:team_member => { "5004" => '1', "5005" => '1' } },
designer_session,
{:assignment => {:instruction => "",
:member_selections => "",
:comment => "",
:assignment => ""
} }
)
#assert_equal('Please identify the Allegro Board Symbol', flash['notice'])
#assert_not_nil(flash[:assignment])
assignment = flash[:assignment]
#assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)
#assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)
#assert_not_nil(assignment[:design])
#assert_equal(@mx234a.id, assignment[:design].id)
#flash[:assignment][:design].name = 'abc'
#assert_not_nil(assignment[:selected_step])
#assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)
#assert_not_nil(assignment[:instruction])
#assert_equal(board_prep_sections[0].id,
# assignment[:instruction].oi_category_section_id)
#assert_not_nil(assignment[:member_selections])
#assert_equal({ "5004" => '1', "5005" => '1' }, assignment[:member_selections])
#assert_not_nil(assignment[:team_members])
#assert_equal([@siva_e, @mathi_n], assignment[:team_members])
#assert_not_nil(assignment[:comment])
#assert_equal(assignment_comment, assignment[:comment].comment )
assert_redirected_to(:action => 'process_assignments',
:category_id => @board_prep.id,
:design_id => @mx234a.id)
return
follow_redirect!
#Verify that the variable where loaded from the flash.
#assert_equal(assignment[:design], assigns(:design))
#assert_equal(assignment[:category], assigns(:category))
#assert_equal(assignment[:team_members], assigns(:team_members))
#assert_equal(assignment[:selected_step], assigns(:selected_step))
#assert_equal(assignment[:instruction], assigns(:instruction))
#assert_equal(assignment[:assignment], assigns(:assignment))
#assert_equal(assignment[:comment], assigns(:comment))
#assert_not_nil(flash[:assignment])
#assert_nil(assigns(:outline_drawing))
# Process Assignment Details - No team members identified.
post(:process_assignment_details,
:category => { :id => @board_prep.id },
:design => { :id => @mx234a.id },
:comment => { :comment => assignment_comment},
:instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s,
:allegro_board_symbol => allegro_board_symbol },
:assignment => { :complexity_id => medium_complexity_id,
"due_date(1i)" => "2007",
"due_date(2i)" => "5",
"due_date(3i)" => "1" },
:team_member => { "5004" => '0', "5005" => '0' })
assert_equal('Please select a team member or members', flash['notice'])
assert_not_nil(flash[:assignment])
assignment = flash[:assignment]
assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)
assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)
assert_not_nil(assignment[:design])
assert_equal(@mx234a.id, assignment[:design].id)
flash[:assignment][:design].name = 'abc'
assert_not_nil(assignment[:selected_step])
assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)
assert_not_nil(assignment[:instruction])
assert_equal(board_prep_sections[0].id,
assignment[:instruction].oi_category_section_id)
assert_not_nil(assignment[:member_selections])
assert_equal({ "5004" => '0', "5005" => '0' }, assignment[:member_selections])
assert_not_nil(assignment[:team_members])
assert_equal([@siva_e, @mathi_n], assignment[:team_members])
assert_not_nil(assignment[:comment])
assert_equal(assignment_comment, assignment[:comment].comment )
assert_redirected_to(:action => 'process_assignments',
:category_id => @board_prep.id,
:design_id => @mx234a.id)
follow_redirect
#Verify that the variable where loaded from the flash.
assert_equal(assignment[:design], assigns(:design))
assert_equal(assignment[:category], assigns(:category))
assert_equal(assignment[:team_members], assigns(:team_members))
assert_equal(assignment[:selected_step], assigns(:selected_step))
assert_equal(assignment[:instruction], assigns(:instruction))
assert_equal(assignment[:assignment], assigns(:assignment))
assert_equal(assignment[:comment], assigns(:comment))
assert_not_nil(flash[:assignment])
assert_nil(assigns(:outline_drawing))
section_selections = {}
section_ids.each { |id| section_selections[id.to_s] = '0' }
# Process Assignment Details - No team members identified and no allegro board symbol
# provided.
post(:process_assignment_details,
:category => { :id => @board_prep.id },
:design => { :id => @mx234a.id },
:comment => { :comment => assignment_comment},
:instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s },
:assignment => { :complexity_id => medium_complexity_id,
"due_date(1i)" => "2007",
"due_date(2i)" => "5",
"due_date(3i)" => "1" },
:team_member => { "5004" => '0', "5005" => '0' })
assert_equal('Please identify the Allegro Board Symbol<br />' +
'Please select a team member or members',
flash['notice'])
assert_not_nil(flash[:assignment])
assignment = flash[:assignment]
assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)
assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)
assert_not_nil(assignment[:design])
assert_equal(@mx234a.id, assignment[:design].id)
flash[:assignment][:design].name = 'abc'
assert_not_nil(assignment[:selected_step])
assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)
assert_not_nil(assignment[:instruction])
assert_equal(board_prep_sections[0].id,
assignment[:instruction].oi_category_section_id)
assert_not_nil(assignment[:member_selections])
assert_equal({ "5004" => '0', "5005" => '0' }, assignment[:member_selections])
assert_not_nil(assignment[:team_members])
assert_equal([@siva_e, @mathi_n], assignment[:team_members])
assert_not_nil(assignment[:comment])
assert_equal(assignment_comment, assignment[:comment].comment )
assert_redirected_to(:action => 'process_assignments',
:category_id => @board_prep.id,
:design_id => @mx234a.id)
follow_redirect
#Verify that the variable where loaded from the flash.
assert_equal(assignment[:design], assigns(:design))
assert_equal(assignment[:category], assigns(:category))
assert_equal(assignment[:team_members], assigns(:team_members))
assert_equal(assignment[:selected_step], assigns(:selected_step))
assert_equal(assignment[:instruction], assigns(:instruction))
assert_equal(assignment[:assignment], assigns(:assignment))
assert_equal(assignment[:comment], assigns(:comment))
assert_not_nil(flash[:assignment])
assert_nil(assigns(:outline_drawing))
instruction_count = OiInstruction.count
assignment_count = OiAssignment.count
assignment_comment_count = OiAssignmentComment.count
post(:view_assignments,
:id => @board_prep.id,
:design_id => @mx234a.id)
assert_response(:success)
assert_equal(@mx234a.id, assigns(:design).id)
assert_equal(0, assigns(:assignment_list).size)
# Process Assignment Details - No errors
post(:process_assignment_details,
:category => { :id => @board_prep.id },
:design => { :id => @mx234a.id },
:comment => { :comment => assignment_comment},
:instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s,
:allegro_board_symbol => allegro_board_symbol },
:assignment => { :complexity_id => medium_complexity_id,
"due_date(1i)" => "2007",
"due_date(2i)" => "5",
"due_date(3i)" => "1" },
:team_member => { "5004" => '1', "5005" => '1' })
assert_equal('The work assignments have been recorded - mail was sent',
flash['notice'])
assert_nil(flash[:assignment])
assert_redirected_to(:action => 'oi_category_selection',
:design_id => @mx234a.id)
assert_equal(instruction_count+1, OiInstruction.count)
instructions = OiInstruction.find(:all)
last_instruction = instructions.pop
assert_equal(@scott_g.id, last_instruction.user_id)
assert_equal(allegro_board_symbol, last_instruction.allegro_board_symbol)
assert_equal(board_prep_sections[0].id, last_instruction.oi_category_section_id)
assert_equal(assignment_count+2, OiAssignment.count)
assignments = OiAssignment.find(:all)
mathi_assignment = assignments.pop
siva_assignment = assignments.pop
assert(!siva_assignment.complete?)
assert_equal(@siva_e.id, siva_assignment.user_id)
assert_equal(last_instruction.id, siva_assignment.oi_instruction_id)
assert_equal(due_date.to_i, siva_assignment.due_date.to_i)
assert_equal(medium_complexity_id, siva_assignment.complexity_id)
assert(!mathi_assignment.complete?)
assert_equal(@mathi_n.id, mathi_assignment.user_id)
assert_equal(last_instruction.id, mathi_assignment.oi_instruction_id)
assert_equal(due_date.to_i, mathi_assignment.due_date.to_i)
assert_equal(medium_complexity_id, mathi_assignment.complexity_id)
assert_equal(assignment_comment_count+2, OiAssignmentComment.count)
assignment_comments = OiAssignmentComment.find(:all)
mathi_comment = assignment_comments.pop
siva_comment = assignment_comments.pop
assert_equal(siva_assignment.id, siva_comment.oi_assignment_id)
assert_equal(@scott_g.id, siva_comment.user_id)
assert_equal(assignment_comment, siva_comment.comment)
assert_equal(mathi_assignment.id, mathi_comment.oi_assignment_id)
assert_equal(@scott_g.id, mathi_comment.user_id)
assert_equal(assignment_comment, mathi_comment.comment)
# Try accessing from an account that is not a PCB Designer and
# verify that the user is redirected.
set_user(@pat_a.id, 'Product Support')
post(:process_assignment_details)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a contractor PCB Designer can not access the list.
set_user(@siva_e.id, 'Designer')
post(:process_assignment_details)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify the email that was generated
expected_to = [ [ @siva_e.email ].sort,
[ @mathi_n.email ].sort,
[ @siva_e.email, @mathi_n.email ].sort ]
expected_cc_list = [@scott_g.email,
@jim_l.email,
@jan_k.email,
users(:bala_g).email,
@cathy_m.email].sort
assert_equal(2, @emails.size)
mathi_email = @emails.pop
siva_email = @emails.pop
assert_equal(1, siva_email.to.size)
assert_equal(@siva_e.email, siva_email.to.pop)
assert_equal(expected_cc_list, siva_email.cc.sort)
assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment created',
siva_email.subject)
assert_equal(1, mathi_email.to.size)
assert_equal(@mathi_n.email, mathi_email.to.pop)
assert_equal(expected_cc_list, mathi_email.cc.sort)
assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment created',
mathi_email.subject)
# Verify that a user from outside the PCB Group can not
# access the view_assignments view
set_user(@pat_a.id, 'Product Support')
post(:view_assignments)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a contractor PCB Designer can not access the
# view_assignments view
set_user(@siva_e.id, 'Designer')
post(:view_assignments)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a Teradyne PCB Designer can access the
# view_assignments view
set_user(@scott_g.id, 'Designer')
post(:view_assignments,
:id => @board_prep.id,
:design_id => @mx234a.id)
assert_response(:success)
assert_equal(@mx234a.id, assigns(:design).id)
assignment_list = assigns(:assignment_list)
assert_equal(1, assignment_list.size)
expected_sections = board_prep_sections.dup
# There is only on category populated
assignment_list.each do |category, assignments|
assert_equal(expected_sections.shift.id, category.id)
assert_equal(2, assignments.size)
end
# Verify that a user from outside the PCB Group can not
# access the assignment_view view
set_user(@pat_a.id, 'Product Support')
post(:assignment_view)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a Teradyne PCB Designer can access the
# the assignment_view view
set_user(@scott_g.id, 'Designer')
assignment_id = assignments.pop.id
post(:assignment_view, :id => assignment_id)
assert_response(:success)
assert_equal(assignment_id, assigns(:assignment).id)
assert_equal(@mx234a.id, assigns(:design).id)
assert_equal(@board_prep.id, assigns(:category).id)
comments = assigns(:comments)
assert_equal(1, comments.size)
comment = comments.pop
assert_equal(assignment_comment, comment.comment)
assert_not_nil(assigns(:post_comment))
# Verify that a user from outside the PCB Group can not
# access the category_details view
set_user(@pat_a.id, 'Product Support')
post(:category_details)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a contractor Team Member can access the
# category_details view
set_user(@siva_e.id, 'Designer')
post(:category_details, :id => @mx234a.id)
assert_response(:success)
assert_equal(@mx234a.id, assigns(:design).id)
siva_assignments = assigns(:category_list)
assert_equal(2, siva_assignments.size)
assert_not_nil(siva_assignments[@board_prep])
assignment_list = siva_assignments[@board_prep]
assert_equal(1, assignment_list.size)
assert_not_nil(assignment_list.detect { |a|
a.oi_instruction.oi_category_section_id == board_prep_sections[0].id })
assignment_list.each { |a| assert_equal(@siva_e.id, a.user_id) }
# Verify that a user from outside the PCB Group can not
# access the assignment_details view
set_user(@pat_a.id, 'Product Support')
post(:assignment_details)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a contractor Team Member can access the
# category_details view
set_user(@siva_e.id, 'Designer')
post(:assignment_details,
:id => @board_prep.id,
:design_id => @mx234a.id)
assert_response(:success)
assert_equal(@mx234a.id, assigns(:design).id)
assert_equal(@board_prep.id, assigns(:category).id)
section_list = assigns(:section_list)
assert_equal('Board Preparation', section_list[:category].name)
assert_equal(1, section_list[:assignment_list].size)
assert_equal(1, section_list[:assignment_list][0].oi_instruction.oi_category_section_id)
# Verify that a user from outside the PCB Group can not
# update an assignment.
set_user(@pat_a.id, 'Product Support')
post(:assignment_update)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a member of the PCB Design group can
# update an assignment
set_user(@siva_e.id, 'Designer')
# Get the instruction with 2 assignments associated with it
instruction = OiInstruction.find_by_design_id_and_oi_category_section_id(
@mx234a.id,
board_prep_sections[0].id)
siva_assignment = instruction.oi_assignments.detect { |a| a.user_id == @siva_e.id }
mathi_assignment = instruction.oi_assignments.detect { |a| a.user_id == @mathi_n.id }
assert_equal(2, instruction.oi_assignments.size)
assert_equal(1, siva_assignment.oi_assignment_comments.size)
assert_equal(0, siva_assignment.complete)
assert_equal(@siva_e.id, siva_assignment.user_id)
assert_equal(1, mathi_assignment.oi_assignment_comments.size)
assert_equal(0, mathi_assignment.complete)
assert_equal(@mathi_n.id, mathi_assignment.user_id)
siva_assignment_comment = siva_assignment.oi_assignment_comments.pop
mathi_assignment_comment = mathi_assignment.oi_assignment_comments.pop
assert_not_equal(siva_assignment_comment.id, mathi_assignment_comment.id)
post(:assignment_update,
:assignment => siva_assignment,
:post_comment => {:comment => 'My 2 cents'})
siva_assignment.reload
mathi_assignment.reload
assert_equal(2, instruction.oi_assignments.size)
assert_equal(2, siva_assignment.oi_assignment_comments.size)
assert_equal(0, siva_assignment.complete)
assert_equal(@siva_e.id, siva_assignment.user_id)
assert_equal(1, mathi_assignment.oi_assignment_comments.size)
assert_equal(0, mathi_assignment.complete)
assert_equal(@mathi_n.id, mathi_assignment.user_id)
cc_list = expected_cc_list.dup + [@siva_e.email] - [@scott_g.email]
email = @emails.pop
assert_equal([@scott_g.email], email.to.sort)
assert_equal(cc_list.sort, email.cc.sort)
assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update',
email.subject)
post(:assignment_update,
:assignment => { :id => siva_assignment.id,
:complete => "1"},
:post_comment => {:comment => 'It is done'})
siva_assignment.reload
mathi_assignment.reload
assert_equal(2, instruction.oi_assignments.size)
assert_equal(3, siva_assignment.oi_assignment_comments.size)
assert_equal(1, siva_assignment.complete)
assert_equal(@siva_e.id, siva_assignment.user_id)
assert_equal(1, mathi_assignment.oi_assignment_comments.size)
assert_equal(0, mathi_assignment.complete)
assert_equal(@mathi_n.id, mathi_assignment.user_id)
email = @emails.pop
assert_equal([@scott_g.email], email.to.sort)
assert_equal(cc_list.sort, email.cc.sort)
assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update - Completed',
email.subject)
set_user(@scott_g.id, 'Designer')
post(:assignment_update,
:assignment => { :id => siva_assignment.id,
:complete => "0"},
:post_comment => {:comment => 'My 2 cents'})
siva_assignment.reload
mathi_assignment.reload
assert_equal(2, instruction.oi_assignments.size)
assert_equal(4, siva_assignment.oi_assignment_comments.size)
assert_equal(0, siva_assignment.complete)
assert_equal(@siva_e.id, siva_assignment.user_id)
assert_equal(1, mathi_assignment.oi_assignment_comments.size)
assert_equal(0, mathi_assignment.complete)
assert_equal(@mathi_n.id, mathi_assignment.user_id)
cc_list = expected_cc_list.dup
email = @emails.pop
assert_equal([@siva_e.email], email.to.sort)
assert_equal(cc_list.sort, email.cc.sort)
assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update - Reopened',
email.subject)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_process_assignments\n \n board_prep_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n section_ids = board_prep_sections.collect { |s| s.id }\n team_member_li... | [
"0.67055166",
"0.61792755",
"0.60794455",
"0.59472847",
"0.58578086",
"0.58466375",
"0.57890767",
"0.5770384",
"0.5729329",
"0.5682453",
"0.5673812",
"0.5661049",
"0.56528574",
"0.563056",
"0.5623086",
"0.5607764",
"0.5607616",
"0.55951285",
"0.5565419",
"0.55369407",
"0.5527... | 0.65888274 | 1 |
test_report_card_list Description: This method does the functional testing of the report card list view. | def test_report_card_list
get(:report_card_list,
{ :id => @board_prep.id, :design_id => @mx234a.id },
scott_designer_session)
assert_equal(@mx234a.id, assigns(:design).id)
assert_equal(@board_prep.id, assigns(:category).id)
assert_nil(assigns(:assignments_list))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deck_has_cards\n assert_equal [@card_1, @card_2, @card_3], @deck.cards\n end",
"def cardlist\n if params.has_key?(:nocache) || !flash.empty? || stale?(:last_modified => @cardset.last_edit_log.updated_at, :etag => \"cardset_#{@cardset.id}_cardlist\")\n respond_to do |format|\n format.h... | [
"0.5846489",
"0.58184975",
"0.5715349",
"0.56638736",
"0.56466544",
"0.56362575",
"0.56354636",
"0.552045",
"0.54872024",
"0.54784036",
"0.5396856",
"0.5375988",
"0.5368743",
"0.5368743",
"0.5313435",
"0.53019434",
"0.53002983",
"0.52925974",
"0.52864707",
"0.5280211",
"0.527... | 0.6882792 | 0 |
test_create_assignment_report Description: This method does the functional testing of the create assignment report view. | def test_create_assignment_report
first_report = oi_assignment_reports(:first)
# Try accessing from an account that is not a PCB Designer and
# verify that the user is redirected.
get(:create_assignment_report, { :id => oi_assignment_reports(:first) }, lee_hweng_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
get(:create_assignment_report, {:id => first_report}, scott_designer_session)
assert_equal(first_report.id, assigns(:assignment).id)
assert_equal(1, assigns(:complexity_id))
assert_equal(OiAssignmentReport::NOT_SCORED, assigns(:report).score)
assert_equal([], assigns(:comments))
assert_equal(OiAssignmentReport.report_card_scoring,
assigns(:scoring_table))
# Verify the redirect to create_assignment_report by create report when the
# report has not been scored.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_view_assignment_report\n \n first_assignment = oi_assignments(:first)\n \n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n get(:view_assignment_report, { :id => first_assignment }, siva_designer_session)\n assert_redirected_to(:... | [
"0.6981552",
"0.64904445",
"0.6470197",
"0.6369361",
"0.62846583",
"0.62846583",
"0.6195638",
"0.61498445",
"0.6143314",
"0.6131525",
"0.6127125",
"0.6093784",
"0.6082833",
"0.6043959",
"0.60354584",
"0.6031244",
"0.6025659",
"0.6022759",
"0.59975857",
"0.59962714",
"0.599592... | 0.7563527 | 0 |
test_static_view Description: This method does the functional testing of the static_view view. | def test_static_view
first_assignment = oi_assignments(:first)
# Try accessing from an account that is not a PCB Designer and
# verify that the user is redirected.
get(:static_view, { :id => first_assignment }, siva_designer_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
get(:static_view, {:id => first_assignment}, scott_designer_session)
assert_equal(first_assignment.id, assigns(:assignment).id)
assert_equal(oi_category_sections(:placement_3), assigns(:section))
assert_equal(designs(:mx234a), assigns(:design))
assert_equal([], assigns(:comments))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_index \n get :index\n assert_response :success\n assert_template 'index'\n end",
"def test_index \n get :index\n assert_response :success\n assert_template 'index'\n end",
"def test_should_show_index\n login_as :admin\n\n get :index\n assert_response ... | [
"0.620146",
"0.6173631",
"0.61484206",
"0.59964097",
"0.5978809",
"0.59613407",
"0.5932028",
"0.59311694",
"0.5916225",
"0.5893453",
"0.5809368",
"0.5800353",
"0.57798797",
"0.5766727",
"0.57615876",
"0.57615876",
"0.5761294",
"0.5752731",
"0.57192093",
"0.5706943",
"0.569331... | 0.6990885 | 0 |
test_view_assignment_report Description: This method does the functional testing of the view assignment report view. | def test_view_assignment_report
first_assignment = oi_assignments(:first)
# Try accessing from an account that is not a PCB Designer and
# verify that the user is redirected.
get(:view_assignment_report, { :id => first_assignment }, siva_designer_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
get(:view_assignment_report, { :id => first_assignment }, scott_designer_session)
assert_equal(first_assignment.id, assigns(:assignment).id)
assert_equal([], assigns(:comments))
assert_equal(OiAssignmentReport.report_card_scoring, assigns(:scoring_table))
assert_equal("0% Rework", assigns(:current_score))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_assignment_report\n \n first_report = oi_assignment_reports(:first)\n \n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n get(:create_assignment_report, { :id => oi_assignment_reports(:first) }, lee_hweng_session)\n assert... | [
"0.67401147",
"0.622488",
"0.61929166",
"0.6048909",
"0.5982111",
"0.58500254",
"0.58500254",
"0.5776563",
"0.5731412",
"0.568352",
"0.56371826",
"0.5625055",
"0.55252844",
"0.54299563",
"0.53632176",
"0.5355442",
"0.5316235",
"0.52715546",
"0.5243433",
"0.5243433",
"0.524343... | 0.7340644 | 0 |
A featured number (something unique to this exercise) is an odd number that is a multiple of 7, and whose digits occur exactly once each. So, for example, 49 is a featured number, but 98 is not (it is not odd), 97 is not (it is not a multiple of 7), and 133 is not (the digit 3 appears twice). Write a method that takes a single integer as an argument, and returns the next featured number that is greater than the argument. Issue an error message if there is no next featured number. Solution : | def featured(n)
(n..9_999_999_999).each {|number| return number if number_valid?(n, number)}
return "There is no possible number that fulfills those requirements."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def featured(num)\n # next_num = 7 # assume input is only positive\n closer_num = num / 7 * 7 # to start closer to the next required number instead of starting from 7\n next_num = closer_num.odd? ? closer_num : closer_num + 7 # so that next_num is odd and we can increment by 14 in the while loop\n\n while next... | [
"0.8416592",
"0.83547753",
"0.8308533",
"0.8230069",
"0.8137688",
"0.8069092",
"0.80039865",
"0.79901063",
"0.78999215",
"0.78786457",
"0.7830859",
"0.78024894",
"0.78010833",
"0.7773184",
"0.76714987",
"0.76628697",
"0.7648454",
"0.76433915",
"0.76429534",
"0.7612073",
"0.76... | 0.71051323 | 25 |
based on the reference spec in lib/rpmvercmp.c in rpm 4.9.0 | def rpmvercmp(x, y)
# easy! :)
return 0 if x == y
if x.nil?
x = ""
end
if y.nil?
y = ""
end
# not so easy :(
#
# takes 2 strings like
#
# x = "1.20.b18.el5"
# y = "1.20.b17.el5"
#
# breaks into purely alpha and numeric segments and compares them using
# some rules
#
# * 10 > 1
# * 1 > a
# * z > a
# * Z > A
# * z > Z
# * leading zeros are ignored
# * separators (periods, commas) are ignored
# * "1.20.b18.el5.extrastuff" > "1.20.b18.el5"
x_pos = 0 # overall string element reference position
x_pos_max = x.length - 1 # number of elements in string, starting from 0
x_seg_pos = 0 # segment string element reference position
x_comp = nil # segment to compare
y_pos = 0
y_seg_pos = 0
y_pos_max = y.length - 1
y_comp = nil
while x_pos <= x_pos_max && y_pos <= y_pos_max
# first we skip over anything non alphanumeric
while (x_pos <= x_pos_max) && (isalnum(x[x_pos]) == false)
x_pos += 1 # +1 over pos_max if end of string
end
y_pos += 1 while (y_pos <= y_pos_max) && (isalnum(y[y_pos]) == false)
# if we hit the end of either we are done matching segments
if (x_pos == x_pos_max + 1) || (y_pos == y_pos_max + 1)
break
end
# we are now at the start of a alpha or numeric segment
x_seg_pos = x_pos
y_seg_pos = y_pos
# grab segment so we can compare them
if isdigit(x[x_seg_pos].ord)
x_seg_is_num = true
# already know it's a digit
x_seg_pos += 1
# gather up our digits
x_seg_pos += 1 while (x_seg_pos <= x_pos_max) && isdigit(x[x_seg_pos])
# copy the segment but not the unmatched character that x_seg_pos will
# refer to
x_comp = x[x_pos, x_seg_pos - x_pos]
y_seg_pos += 1 while (y_seg_pos <= y_pos_max) && isdigit(y[y_seg_pos])
y_comp = y[y_pos, y_seg_pos - y_pos]
else
# we are comparing strings
x_seg_is_num = false
x_seg_pos += 1 while (x_seg_pos <= x_pos_max) && isalpha(x[x_seg_pos])
x_comp = x[x_pos, x_seg_pos - x_pos]
y_seg_pos += 1 while (y_seg_pos <= y_pos_max) && isalpha(y[y_seg_pos])
y_comp = y[y_pos, y_seg_pos - y_pos]
end
# if y_seg_pos didn't advance in the above loop it means the segments are
# different types
if y_pos == y_seg_pos
# numbers always win over letters
return x_seg_is_num ? 1 : -1
end
# move the ball forward before we mess with the segments
x_pos += x_comp.length # +1 over pos_max if end of string
y_pos += y_comp.length
# we are comparing numbers - simply convert them
if x_seg_is_num
x_comp = x_comp.to_i
y_comp = y_comp.to_i
end
# compares ints or strings
# don't return if equal - try the next segment
if x_comp > y_comp
return 1
elsif x_comp < y_comp
return -1
end
# if we've reached here than the segments are the same - try again
end
# we must have reached the end of one or both of the strings and they
# matched up until this point
# segments matched completely but the segment separators were different -
# rpm reference code treats these as equal.
if (x_pos == x_pos_max + 1) && (y_pos == y_pos_max + 1)
return 0
end
# the most unprocessed characters left wins
if (x_pos_max - x_pos) > (y_pos_max - y_pos)
1
else
-1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rpm_version(name)\n if (self.centos? && !self.centos7?) || self.fedora? || self.redhat8? || self.oracle8? || self.redhat9?\n # returns epoch.version\n v = Chef::Provider::Package::Dnf::PythonHelper.instance.\n package_query(:whatinstalled, name).version\n unless v.nil?\n ... | [
"0.63795966",
"0.62147635",
"0.61626464",
"0.61626464",
"0.61104226",
"0.6106799",
"0.6083635",
"0.6077758",
"0.6024959",
"0.60186243",
"0.60100156",
"0.60028785",
"0.59957945",
"0.59578854",
"0.59387094",
"0.5937774",
"0.5911235",
"0.5895849",
"0.5877471",
"0.5854041",
"0.58... | 0.63841134 | 0 |
Rough RPM::Version rpm_version_cmp equivalent except much slower :) partial lets epoch and version segment equality be good enough to return equal, eg: 2:1.21 == 2:1.2 2:1.21 == 2: | def compare_versions(y, partial = false)
x = self
# compare epoch
if (x.e.nil? == false && x.e > 0) && y.e.nil?
return 1
elsif x.e.nil? && (y.e.nil? == false && y.e > 0)
return -1
elsif x.e.nil? == false && y.e.nil? == false
if x.e < y.e
return -1
elsif x.e > y.e
return 1
end
end
# compare version
if partial && (x.v.nil? || y.v.nil?)
return 0
elsif x.v.nil? == false && y.v.nil?
return 1
elsif x.v.nil? && y.v.nil? == false
return -1
elsif x.v.nil? == false && y.v.nil? == false
cmp = RPMUtils.rpmvercmp(x.v, y.v)
return cmp if cmp != 0
end
# compare release
if partial && (x.r.nil? || y.r.nil?)
return 0
elsif x.r.nil? == false && y.r.nil?
return 1
elsif x.r.nil? && y.r.nil? == false
return -1
elsif x.r.nil? == false && y.r.nil? == false
cmp = RPMUtils.rpmvercmp(x.r, y.r)
return cmp
end
0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rpmvercmp(x, y)\n # easy! :)\n return 0 if x == y\n\n if x.nil?\n x = \"\"\n end\n\n if y.nil?\n y = \"\"\n end\n\n # not so easy :(\n #\n # takes 2 strings like\n ... | [
"0.68930626",
"0.6777023",
"0.66131496",
"0.658415",
"0.65485173",
"0.6538966",
"0.6520678",
"0.6511816",
"0.63691634",
"0.6321949",
"0.628066",
"0.626531",
"0.62384665",
"0.6185876",
"0.61678445",
"0.61628306",
"0.61530167",
"0.6127873",
"0.6123939",
"0.6079843",
"0.60696566... | 0.71972096 | 0 |
Test if another RPMDependency satisfies our requirements | def satisfy?(y)
unless y.is_a?(RPMDependency)
raise ArgumentError, "Expecting an RPMDependency object"
end
x = self
# Easy!
if x.name != y.name
return false
end
# Partial compare
#
# eg: x.version 2.3 == y.version 2.3-1
sense = x.version.partial_compare(y.version)
# Thanks to rpmdsCompare() rpmds.c
if (sense < 0) && ((x.flag == :> || x.flag == :>=) || (y.flag == :<= || y.flag == :<))
return true
elsif (sense > 0) && ((x.flag == :< || x.flag == :<=) || (y.flag == :>= || y.flag == :>))
return true
elsif sense == 0 && (
((x.flag == :== || x.flag == :<= || x.flag == :>=) && (y.flag == :== || y.flag == :<= || y.flag == :>=)) ||
(x.flag == :< && y.flag == :<) ||
(x.flag == :> && y.flag == :>)
)
return true
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def =~(other)\n unless Gem::Dependency === other\n return unless other.respond_to?(:name) && other.respond_to?(:version)\n other = Gem::Dependency.new other.name, other.version\n end\n\n return false unless name === other.name\n\n reqs = other.requirement.requirements\n\n return false unle... | [
"0.7186977",
"0.70694053",
"0.6906571",
"0.68474925",
"0.6784584",
"0.667682",
"0.6645595",
"0.6627601",
"0.66122615",
"0.6579966",
"0.643627",
"0.6425606",
"0.6317606",
"0.6298653",
"0.6295924",
"0.6294732",
"0.6243786",
"0.61787283",
"0.61519796",
"0.61489576",
"0.6130937",... | 0.7707219 | 0 |
Lookup package_name and return a descending array of package objects | def lookup(package_name)
pkgs = @rpms[package_name]
if pkgs
pkgs.sort.reverse
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_package_by_name(name)\n @packages[name]\n end",
"def search_for_description pkgname, packages = []\n cache_key = \"description_package_#{pkgname.downcase}\"\n description_package = Rails.cache.fetch(cache_key, :expires_in => 12.hours) do\n if packages.blank?\n package... | [
"0.7300775",
"0.7257258",
"0.70202047",
"0.69410783",
"0.68412924",
"0.67444324",
"0.6609925",
"0.65386343",
"0.653666",
"0.65336734",
"0.6526174",
"0.6486079",
"0.6486079",
"0.64606327",
"0.6380588",
"0.6360088",
"0.63586986",
"0.63584906",
"0.6318584",
"0.6305778",
"0.62259... | 0.7955433 | 0 |
Using the package name as a key, and nevra for an index, keep a unique list of packages. The available/installed state can be overwritten for existing packages. | def push(*args)
args.flatten.each do |new_rpm|
unless new_rpm.is_a?(RPMDbPackage)
raise ArgumentError, "Expecting an RPMDbPackage object"
end
@rpms[new_rpm.n] ||= []
# we may already have this one, like when the installed list is refreshed
idx = @index[new_rpm.nevra]
if idx
# grab the existing package if it's not
curr_rpm = idx
else
@rpms[new_rpm.n] << new_rpm
new_rpm.provides.each do |provide|
@provides[provide.name] ||= []
@provides[provide.name] << new_rpm
end
curr_rpm = new_rpm
end
# Track the nevra -> RPMPackage association to avoid having to compare versions
# with @rpms[new_rpm.n] on the next round
@index[new_rpm.nevra] = curr_rpm
# these are overwritten for existing packages
if new_rpm.available
@available << curr_rpm
end
if new_rpm.installed
@installed << curr_rpm
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_packages(pattern)\n packages = RailsPwnerer::Base.all_packages\n Hash[packages.select { |key, value|\n pattern.kind_of?(Regexp) ? (pattern =~ key) : key.index(pattern)\n }.map { |key, value|\n # apt-cache search sometimes leaves version numbers out\n # Update the cache with versi... | [
"0.6211733",
"0.6074426",
"0.6007114",
"0.5980379",
"0.5915451",
"0.58449703",
"0.5836779",
"0.57482874",
"0.57482874",
"0.57408214",
"0.5735739",
"0.57170093",
"0.57163805",
"0.57151437",
"0.56889135",
"0.56455445",
"0.5641386",
"0.5638998",
"0.56162965",
"0.56049263",
"0.55... | 0.0 | -1 |
Lists the names of the store this user is entitled to read or write to. | def store_names
names = @store_names.dup
names << "users" unless names.include?("users")
names
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_store_names\n\n if @user.admin?\n find_all_storenames\n else\n @permissions.keys.sort\n end\n end",
"def find_all_storenames\n\n WiStore.find(:all).collect do |store|\n store.name\n end\n end",
"def index\n @stores = current_account.stores.find(... | [
"0.7399919",
"0.6922078",
"0.6532522",
"0.6490655",
"0.63840324",
"0.63617325",
"0.62848675",
"0.6239569",
"0.62273854",
"0.622369",
"0.6205164",
"0.60669655",
"0.6049849",
"0.6042551",
"0.60425305",
"0.60425305",
"0.60425305",
"0.60425305",
"0.60425305",
"0.6031795",
"0.5974... | 0.69922507 | 1 |
Returns the permission for the given store. | def permission (store_name)
return RWD_STORE_PERMISSION if @user.admin?
return RWD_STORE_PERMISSION if store_name == 'users'
@permissions[store_name]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_permissions (user, store_name)\n s = \"\"\n [ :read, :write, :delegate ].each do |action|\n s << action.to_s[0, 1] \\\n if @auth_system.authorized?(user, store_name, action)\n end\n s\n end",
"def find_permissions\n\n return nil if @user.admin?\n\n groupna... | [
"0.6499601",
"0.6216662",
"0.55079794",
"0.54641545",
"0.5447283",
"0.5420848",
"0.5382845",
"0.53765523",
"0.53488135",
"0.5347169",
"0.5325485",
"0.52896684",
"0.528886",
"0.52618",
"0.52474105",
"0.52408576",
"0.52322125",
"0.523144",
"0.5229859",
"0.51618344",
"0.51603085... | 0.7805503 | 0 |
Returns the workitems for the given store. | def workitems (store_name=nil)
return load_user_workitems if store_name == 'users'
return (@workitems[store_name] || []) if store_name
# then return all the workitems the user has access to
wis = load_user_workitems
@store_names.inject(wis) do |r, sname|
r += (@workitems[sname] || [])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_store_items(opts = {})\n data, _status_code, _headers = get_store_items_with_http_info(opts)\n return data\n end",
"def each (&block)\n\n return unless block\n\n wis = Workitem.find_by_store_name(@store_name)\n\n wis.each { |wi| block.call(wi) }\n end",
"def get_wms_store... | [
"0.6577767",
"0.6322996",
"0.6125597",
"0.5964179",
"0.59063333",
"0.5893999",
"0.5842434",
"0.571832",
"0.5678437",
"0.5545342",
"0.55338",
"0.5500814",
"0.54911095",
"0.54763865",
"0.5455842",
"0.5428017",
"0.54177606",
"0.54126227",
"0.5400239",
"0.53830254",
"0.53824455",... | 0.804833 | 0 |
Returns the list of store[ names]s to which the user can delegate. If a workitem is passed, makes sure to remove the workitem current store name from the resulting list. | def delegation_targets (workitem=nil)
names = @store_names.find_all { |n| permission(n).may_delegate? }
names.delete(workitem.store_name) if workitem
names
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workitems (store_name=nil)\n\n return load_user_workitems if store_name == 'users'\n return (@workitems[store_name] || []) if store_name\n\n # then return all the workitems the user has access to\n\n wis = load_user_workitems\n\n @store_names.inject(wis) do |r, sname|\n r += (@workitems[sna... | [
"0.6875334",
"0.6045649",
"0.6026068",
"0.56866467",
"0.5318249",
"0.5267477",
"0.5237851",
"0.5135215",
"0.5087775",
"0.5026814",
"0.5006327",
"0.497881",
"0.49108797",
"0.4821121",
"0.47736892",
"0.4773425",
"0.4773425",
"0.4730687",
"0.4725012",
"0.47026858",
"0.46875027",... | 0.77069974 | 0 |
Given a search string, returns all the matching workitems (in the stores in which the user can read). | def search (query_string)
OpenWFE::Extras::Workitem.search(query_string, store_names).find_all do |wi|
@user.admin? or (
wi.store_name != 'users' || wi.participant_name == @user.name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(search_string)\n root = EmployeeFolder.root\n result = []\n key = search_string.downcase\n Dir.glob(\"#{root}/*/*\") do |folder|\n next unless Dir.exist? folder\n next unless folder[key]\n\n employee_spec = parse_dir folder\n next if project? employee_spec\n\n result... | [
"0.6381887",
"0.62826955",
"0.6244389",
"0.61944616",
"0.60290784",
"0.5967592",
"0.5943505",
"0.593287",
"0.5931565",
"0.59101796",
"0.5901961",
"0.5880442",
"0.5867845",
"0.586291",
"0.58337057",
"0.58210737",
"0.5818531",
"0.5802142",
"0.5801932",
"0.57808614",
"0.576399",... | 0.67167896 | 0 |
Returns all the store names (according to the 'wi_stores' table) | def find_all_storenames
WiStore.find(:all).collect do |store|
store.name
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_store_names\n\n if @user.admin?\n find_all_storenames\n else\n @permissions.keys.sort\n end\n end",
"def get_wms_stores workspace = nil\n ws = workspace.nil?? get_workspaces : [get_workspace(workspace)]\n cs = []\n ws.each{ |w| cs += w.wms_stores if w.wms_... | [
"0.71889263",
"0.688306",
"0.64553434",
"0.6337646",
"0.6303855",
"0.61992735",
"0.6159913",
"0.61306286",
"0.6119914",
"0.60766655",
"0.6008347",
"0.6000676",
"0.59800816",
"0.5974715",
"0.59460187",
"0.59197265",
"0.58701867",
"0.5842894",
"0.5842894",
"0.5842894",
"0.58428... | 0.8794882 | 0 |
Returns the mapping "storename" > Permission instance | def find_permissions
return nil if @user.admin?
groupnames = Group.find_groups(@user)
StorePermission.find_all_by_groupname(groupnames).inject({}) do
|result, permission|
result[permission.storename] = permission
result
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permission (store_name)\n\n return RWD_STORE_PERMISSION if @user.admin?\n return RWD_STORE_PERMISSION if store_name == 'users'\n @permissions[store_name]\n end",
"def permissions = {}",
"def permission_mapping\n super.merge(\n {\n 'index_role_screen' => 'index',\n 'index_rol... | [
"0.677501",
"0.6169189",
"0.6016778",
"0.5778898",
"0.5659508",
"0.56052434",
"0.5601946",
"0.5568518",
"0.55033296",
"0.5458634",
"0.5458634",
"0.54528016",
"0.54023063",
"0.53707504",
"0.5334834",
"0.53318614",
"0.5313097",
"0.52998924",
"0.52880937",
"0.52857155",
"0.52756... | 0.6694527 | 1 |
Returns a list of Store instances. | def find_store_names
if @user.admin?
find_all_storenames
else
@permissions.keys.sort
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_instances(enabled_stores, store_configs)\n fail \"No stores have been enabled, see configuration file\" if enabled_stores.blank?\n fail \"No store configuration present, see configuration file\" if store_configs.blank?\n\n enabled_stores.collect do |store_name|\n STORES[store_name].new(\n ... | [
"0.71081614",
"0.69828284",
"0.69593227",
"0.68698156",
"0.68698156",
"0.68698156",
"0.68698156",
"0.68698156",
"0.6759534",
"0.67400247",
"0.6716083",
"0.6543452",
"0.65233463",
"0.6468889",
"0.64407545",
"0.6394418",
"0.6380012",
"0.6371188",
"0.6368392",
"0.6259121",
"0.62... | 0.5544448 | 82 |
Companion function to the !roles command used to generate the embeds for each group | def generate_embed(index)
embed = Discordrb::Webhooks::Embed.new
embed.color = 0xFFD700
# If index for a role group is given, generate embed for that group
if index > 0
group = AssignableRoleGroup.all[index - 1]
embed.author = {
name: "Group: #{group.name}",
icon_url: BOT_AVATAR_URL
}
embed.description = <<~DESC.strip
#{group.description}
#{group.is_exclusive ? '**This group is exclusive; you can only have one role from it at a time.**' : nil}
DESC
roles_text = if group.roles.any?
group.roles.map do |role|
if role.description
"• `!#{role.key}` **#{SERVER.role(role.id).name}** - *#{role.description}*"
else
"• `!#{role.key}` **#{SERVER.role(role.id).name}**"
end
end.join("\n")
else
'No roles found.'
end
embed.add_field(
name: 'Roles',
value: roles_text
)
embed.footer = {text: "Group key: #{group.key}"}
# Otherwise, generate an embed for ungrouped roles
else
roles = AssignableRole.all.reject { |r| r.group }
embed.author = {
name: "Ungrouped Roles",
icon_url: BOT_AVATAR_URL
}
embed.description = <<~DESC_DICHADO.strip
This is a list of all assignable roles that do not have a group.
Use a role's command to assign it to you, and use it again to remove it.
DESC_DICHADO
roles_text = if roles.any?
roles.map do |role|
if role.description
"• `!#{role.key}` **#{SERVER.role(role.id).name}** - *#{role.description}*"
else
"• `!#{role.key}` **#{SERVER.role(role.id).name}**"
end
end.join("\n")
else
'No roles found.'
end
embed.add_field(
name: 'Roles',
value: roles_text
)
embed.footer = {text: "Use the reaction buttons to scroll through the groups."}
end
embed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roles_to_embed *roles\n raise \"Must be implemented by embed storage to generate a set of roles to embed\"\n end",
"def groups\n roles\n end",
"def show_roles(roles, editable: false, only_speaker: false, show_registration: false)\n if only_speaker \n roles = roles.select{|r| r.speak... | [
"0.7119568",
"0.6027745",
"0.5926707",
"0.57730526",
"0.56533283",
"0.56523526",
"0.55967224",
"0.55532175",
"0.5518457",
"0.5500429",
"0.54974747",
"0.5497411",
"0.5494413",
"0.54918516",
"0.5464567",
"0.54566014",
"0.543802",
"0.54372394",
"0.5430615",
"0.541105",
"0.540867... | 0.7491963 | 0 |
GET /score_evaluations GET /score_evaluations.json | def index
@score_evaluations = ScoreEvaluation.all
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @score_evaluations }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @score_evaluation = ScoreEvaluation.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @score_evaluation }\n end\n end",
"def get_eval\n\t\t@student = Student.find(params[:student_id])\n\t\t@evaluation = @student... | [
"0.70963204",
"0.7001828",
"0.6768023",
"0.67598486",
"0.67183495",
"0.6691511",
"0.66504794",
"0.66358405",
"0.663198",
"0.6578833",
"0.65650374",
"0.65650374",
"0.65650374",
"0.65650374",
"0.65650374",
"0.64273256",
"0.64253145",
"0.6393016",
"0.63750654",
"0.62790066",
"0.... | 0.7937988 | 0 |
GET /score_evaluations/1 GET /score_evaluations/1.json | def show
@score_evaluation = ScoreEvaluation.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @score_evaluation }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @score_evaluations = ScoreEvaluation.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @score_evaluations }\n end\n end",
"def get_eval\n\t\t@student = Student.find(params[:student_id])\n\t\t@evaluation = @student.evaluatio... | [
"0.7758526",
"0.73732257",
"0.70204735",
"0.6716154",
"0.66650575",
"0.663015",
"0.6580333",
"0.6580333",
"0.6580333",
"0.6580333",
"0.6580333",
"0.6572777",
"0.65650946",
"0.65452427",
"0.6541506",
"0.6540212",
"0.64819765",
"0.64585924",
"0.64346033",
"0.63955975",
"0.63431... | 0.7525323 | 1 |
GET /score_evaluations/new GET /score_evaluations/new.json | def new
@score_evaluation = ScoreEvaluation.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @score_evaluation }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @enrolled_score = EnrolledScore.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @enrolled_score }\n end\n end",
"def new\n @scoring_method = ScoringMethod.new\n\n respond_to do |format|\n format.html # new.html.erb... | [
"0.7627355",
"0.757976",
"0.7560061",
"0.7560061",
"0.7487279",
"0.72648525",
"0.72530866",
"0.7227352",
"0.7157638",
"0.7148147",
"0.7145764",
"0.71226704",
"0.7105994",
"0.7081638",
"0.7004847",
"0.6993702",
"0.69931126",
"0.69393915",
"0.69366086",
"0.6908612",
"0.68849134... | 0.8273216 | 0 |
POST /score_evaluations POST /score_evaluations.json | def create
@score_evaluation = ScoreEvaluation.new(params[:score_evaluation])
respond_to do |format|
if @score_evaluation.save
format.html { redirect_to @score_evaluation, :notice => t('selecao_admin.flash_messages.successfully_created.', :model => @score_evaluation.class.model_name.human) }
format.json { render :json => @score_evaluation, :status => :created, :location => @score_evaluation }
format.js
else
format.html { render :action => "new" }
format.json { render :json => @score_evaluation.errors, :status => :unprocessable_entity }
format.js
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # ToDo: 名前の変更\n score = params[:score]\n \n\n if @evaluation.update_attributes(score: score)\n render :show, status: :ok, location: @evaluation\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def create\n @evaluations = Evaluatio... | [
"0.7332654",
"0.67077494",
"0.6616827",
"0.64930874",
"0.64740974",
"0.64423674",
"0.6432431",
"0.637621",
"0.63749444",
"0.6361069",
"0.63250655",
"0.62867385",
"0.62867385",
"0.62663",
"0.62436855",
"0.62362534",
"0.62195516",
"0.6217482",
"0.6213327",
"0.615658",
"0.614815... | 0.68660045 | 1 |
PUT /score_evaluations/1 PUT /score_evaluations/1.json | def update
@score_evaluation = ScoreEvaluation.find(params[:id])
params[:score_evaluation][:discipline_ids] ||= []
respond_to do |format|
if @score_evaluation.update_attributes(params[:score_evaluation])
format.html { redirect_to @score_evaluation, :notice => t('selecao_admin.flash_messages.successfully_updated', :model => @score_evaluation.class.model_name.human) }
format.json { head :no_content }
format.js
else
format.html { render :action => "edit" }
format.json { render :json => @score_evaluation.errors, :status => :unprocessable_entity }
format.js
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # ToDo: 名前の変更\n score = params[:score]\n \n\n if @evaluation.update_attributes(score: score)\n render :show, status: :ok, location: @evaluation\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def update_score\n question_param... | [
"0.7260799",
"0.67114663",
"0.6629903",
"0.65614665",
"0.64909816",
"0.6460522",
"0.64427364",
"0.6435706",
"0.6433818",
"0.64332044",
"0.643314",
"0.643314",
"0.643314",
"0.6429852",
"0.6429852",
"0.6429852",
"0.6428169",
"0.64125896",
"0.64125896",
"0.64125896",
"0.64125896... | 0.6244234 | 31 |
DELETE /score_evaluations/1 DELETE /score_evaluations/1.json | def destroy
@score_evaluation = ScoreEvaluation.find(params[:id])
@score_evaluation.destroy
respond_to do |format|
format.html { redirect_to score_evaluations_url }
format.json { head :no_content }
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url }\n format.json { h... | [
"0.73572135",
"0.73572135",
"0.7300002",
"0.7240983",
"0.72230655",
"0.71482706",
"0.7110597",
"0.7079376",
"0.70701236",
"0.70690894",
"0.70690894",
"0.70690894",
"0.70690894",
"0.70687413",
"0.7065726",
"0.7065726",
"0.7065726",
"0.7065726",
"0.7065726",
"0.7065726",
"0.706... | 0.74119717 | 0 |
Return string that describes year, make, and model, and optional submod. | def ymmText
ans = date_of_manufacture
ans += ' ' + make.name
if model
ans += ' ' + model.name
end
if submodel
ans += ' ' + submodel.name
end
return ans
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info\n @model + \" \" + @year\n end",
"def name\n return \"#{year.to_s} #{make.name} #{model.name}\"\n end",
"def vehicle_details\n \"#{year} #{make} #{model}\"\n end",
"def to_s\n txt = name\n txt += \" (#{self.year})\" if self.year && self.year > 0\n return txt\n end",
"def insp... | [
"0.70236707",
"0.70207965",
"0.6833335",
"0.65488356",
"0.64275956",
"0.63911164",
"0.61556107",
"0.6001814",
"0.5972173",
"0.59226567",
"0.58873117",
"0.5864135",
"0.5864135",
"0.5847761",
"0.57896286",
"0.57839864",
"0.5776276",
"0.5706453",
"0.56913716",
"0.56651926",
"0.5... | 0.6805958 | 3 |
GET /today_activities/1 GET /today_activities/1.xml | def show
@today_activity = TodayActivity.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @today_activity }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activities\n get_call(\"1/activities.json\")\n end",
"def activities(params = {})\n scope 'default'\n get('activities/', params)\n end",
"def recent_activities\n get(\"/user/#{@user_id}/activities/recent.json\")\n end",
"def recent_activities()\n get(\"/user/#{@user_id}/... | [
"0.73294634",
"0.7149871",
"0.7085055",
"0.70748377",
"0.7040429",
"0.7039494",
"0.69966096",
"0.69966096",
"0.69782054",
"0.67987555",
"0.67987555",
"0.6772547",
"0.66820544",
"0.6679438",
"0.6602559",
"0.6597832",
"0.6584657",
"0.6570117",
"0.65365404",
"0.65365404",
"0.649... | 0.72362953 | 1 |
GET /today_activities/new GET /today_activities/new.xml | def new
@today_activity = TodayActivity.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @today_activity }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activ... | [
"0.72711295",
"0.72711295",
"0.72711295",
"0.7268141",
"0.72278106",
"0.70316213",
"0.70222986",
"0.6999209",
"0.699162",
"0.6908136",
"0.68990225",
"0.68770003",
"0.6799573",
"0.6799573",
"0.6744312",
"0.6713452",
"0.67091805",
"0.67066514",
"0.6685236",
"0.6669365",
"0.6653... | 0.78723276 | 0 |
POST /today_activities POST /today_activities.xml | def create
@today_activity = TodayActivity.new(params[:today_activity])
respond_to do |format|
if @today_activity.save
flash[:notice] = 'TodayActivity was successfully created.'
format.html { redirect_to(@today_activity) }
format.xml { render :xml => @today_activity, :status => :created, :location => @today_activity }
else
format.html { render :action => "new" }
format.xml { render :xml => @today_activity.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n data = reload(get_series('activities'), str(Date.strptime(params[:activity].values.join(\"-\"))))\n saved = false\n get_series('activities').each do |s|\n puts \"Updating series=#{s}\"\n data[s].each do |day|\n @activity = for_date(day['dateTime'])\n @activity.send(s.p... | [
"0.62320113",
"0.60473484",
"0.60353965",
"0.5974586",
"0.5961937",
"0.5950495",
"0.59354126",
"0.5923211",
"0.5879357",
"0.5876503",
"0.58538103",
"0.5826054",
"0.5824398",
"0.58243537",
"0.5814983",
"0.57971054",
"0.5758822",
"0.57548803",
"0.5734489",
"0.5684397",
"0.56716... | 0.663838 | 0 |
PUT /today_activities/1 PUT /today_activities/1.xml | def update
@today_activity = TodayActivity.find(params[:id])
respond_to do |format|
if @today_activity.update_attributes(params[:today_activity])
flash[:notice] = 'TodayActivity was successfully updated.'
format.html { redirect_to(@today_activity) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @today_activity.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activities_path }\n format.xml { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n ... | [
"0.631074",
"0.607107",
"0.6034178",
"0.60261756",
"0.6022064",
"0.5983958",
"0.59805375",
"0.5972873",
"0.59531415",
"0.59507155",
"0.59136194",
"0.58991814",
"0.58951575",
"0.5884823",
"0.58019334",
"0.5793046",
"0.57847863",
"0.57422596",
"0.5723481",
"0.5698547",
"0.56886... | 0.6804169 | 0 |
DELETE /today_activities/1 DELETE /today_activities/1.xml | def destroy
@today_activity = TodayActivity.find(params[:id])
@today_activity.destroy
respond_to do |format|
format.html { redirect_to(today_activities_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @evactivity = Evactivity.find(params[:id])\n @evactivity.destroy\n\n respond_to do |format|\n format.html { redirect_to(evactivities_url) }\n format.xml { head :ok }\n end\n end",
"def delete_activity(db, act_id)\n\tdb.execute(\"DELETE FROM activities WHERE id=?\", [act_id])... | [
"0.66917735",
"0.6593528",
"0.6591737",
"0.6578982",
"0.65553606",
"0.65204775",
"0.65204775",
"0.65204775",
"0.65204775",
"0.6473795",
"0.6459832",
"0.6441286",
"0.6338811",
"0.62965286",
"0.6288732",
"0.6274719",
"0.62332684",
"0.622137",
"0.61857164",
"0.61740637",
"0.6173... | 0.71921545 | 0 |
In the following 6 digit number: 283910 91 is the greatest sequence of 2 digits. Complete the solution so that it returns the largest five digit number found within the number given.. The number will be passed in as a string of only digits. It should return a five digit integer. The number passed may be as large as 1000 digits. | def solution(digits)
digits.scan(/\d{5}/).max.to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution(digits)\n greatest = 0\n (0..(digits.size - 1)).each do |pos|\n num = digits[pos..pos+5].to_i\n greatest = num if num > greatest\n end\n greatest \nend",
"def solution(digits)\n digits.split('').each_cons(5).max.join.to_i\nend",
"def solution(digits)\n\tstop = digits.length - 4\n\tgo =... | [
"0.83006096",
"0.785736",
"0.7820732",
"0.778584",
"0.7728957",
"0.7593007",
"0.75362617",
"0.7466691",
"0.74362713",
"0.7419624",
"0.73802584",
"0.73550844",
"0.73188853",
"0.73064935",
"0.7212375",
"0.7205079",
"0.7204353",
"0.7165965",
"0.7152583",
"0.71505404",
"0.7138082... | 0.83084786 | 0 |
Adds a properly formatted entry to the exception's backtrace. | def add_backtrace_entry(filename) # :nodoc:
@sass_filename ||= filename
self.backtrace ||= []
self.backtrace.unshift "#{@sass_filename || '(sass)'}:#{@sass_line}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_backtrace(backtrace)\n safe_join(backtrace.to_a, tag.br)\n end",
"def formatted\n message = \"\\n#{@exception.class}: #{@exception.message}\\n \"\n message << @exception.backtrace.join(\"\\n \")\n message << \"\\n\\n\"\n end",
"def set_backtrace(bt)\n if @cause\n ... | [
"0.6723981",
"0.6405788",
"0.621267",
"0.6140735",
"0.6136937",
"0.6133015",
"0.6112489",
"0.60806924",
"0.60640556",
"0.6034824",
"0.60305166",
"0.59950125",
"0.59851074",
"0.59000087",
"0.58676815",
"0.58202934",
"0.5798464",
"0.5765267",
"0.5752046",
"0.5752046",
"0.573241... | 0.649048 | 2 |
Rock Paper Scissors Let's play! You have to return which player won! In case of a draw return Draw!. Examples: rps('scissors','paper') // Player 1 won! rps('scissors','rock') // Player 2 won! rps('paper','paper') // Draw! My code: | def rps(p1, p2)
if p1 == "scissors" && p2 == "paper"
return "Player 1 won!"
elsif p1 == "scissors" && p2 == "rock"
return "Player 2 won!"
elsif p1 == "scissors" && p2 == "scissors"
return "Draw!"
end
if p1 == "paper" && p2 == "paper"
return "Draw!"
elsif p1 == "paper" && p2 == "rock"
return "Player 1 won!"
elsif p1 == "paper" && p2 == "scissors"
return "Player 2 won!"
end
if p1 == "rock" && p2 == "paper"
return "Player 2 won!"
elsif p1 == "rock" && p2 == "rock"
return "Draw!"
elsif p1 == "rock" && p2 == "scissors"
return "Player 1 won!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rps(p1, p2)\n return 'Player 1 won!' if p1 == 'scissors' && p2 == 'paper'\n return 'Player 1 won!' if p1 == 'paper' && p2 == 'rock'\n return 'Player 1 won!' if p1 == 'rock' && p2 == 'scissors'\n return 'Draw!' if p1 == p2\n # Otherwise player 2 wins...\n 'Player 2 won!'\nend",
"def rps(choice)\n choic... | [
"0.7909239",
"0.7767667",
"0.7549004",
"0.7447289",
"0.7404648",
"0.73192704",
"0.7290745",
"0.72346854",
"0.7197022",
"0.71951705",
"0.71461445",
"0.7145533",
"0.71226215",
"0.7109055",
"0.71026695",
"0.7096357",
"0.70457935",
"0.70231926",
"0.7000322",
"0.6953865",
"0.69460... | 0.8137535 | 0 |
GET /auto1h_fold_changes/1 GET /auto1h_fold_changes/1.xml | def show
@auto1h_fold_change = Auto1hFoldChange.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @auto1h_fold_change }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n\n respond_to do |format|\n if @auto1h_fold_change.update_attributes(params[:auto1h_fold_change])\n format.html { redirect_to(@auto1h_fold_change, :notice => 'Auto1h fold change was successfully updated.') }\n format.xm... | [
"0.66975474",
"0.63715464",
"0.6345822",
"0.60864514",
"0.60087264",
"0.57884383",
"0.57838863",
"0.57491595",
"0.5675938",
"0.5662908",
"0.55488575",
"0.55389583",
"0.54748243",
"0.54565024",
"0.5376001",
"0.53462684",
"0.5249507",
"0.52120405",
"0.52045774",
"0.5199062",
"0... | 0.68709546 | 0 |
GET /auto1h_fold_changes/new GET /auto1h_fold_changes/new.xml | def new
@auto1h_fold_change = Auto1hFoldChange.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @auto1h_fold_change }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @hetero1h_fold_change = Hetero1hFoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hetero1h_fold_change }\n end\n end",
"def new\n @auto24h_fold_change = Auto24hFoldChange.new\n\n respond_to do |format|\n format.html # n... | [
"0.69216496",
"0.67254597",
"0.66003704",
"0.61234367",
"0.60837746",
"0.6052604",
"0.604529",
"0.5884453",
"0.58323526",
"0.57824755",
"0.577326",
"0.56456065",
"0.5607873",
"0.5531151",
"0.5477435",
"0.543659",
"0.5433517",
"0.5428538",
"0.5402589",
"0.5397345",
"0.5373941"... | 0.75340813 | 0 |
POST /auto1h_fold_changes POST /auto1h_fold_changes.xml | def create
@auto1h_fold_change = Auto1hFoldChange.new(params[:auto1h_fold_change])
respond_to do |format|
if @auto1h_fold_change.save
format.html { redirect_to(@auto1h_fold_change, :notice => 'Auto1h fold change was successfully created.') }
format.xml { render :xml => @auto1h_fold_change, :status => :created, :location => @auto1h_fold_change }
else
format.html { render :action => "new" }
format.xml { render :xml => @auto1h_fold_change.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n\n respond_to do |format|\n if @auto1h_fold_change.update_attributes(params[:auto1h_fold_change])\n format.html { redirect_to(@auto1h_fold_change, :notice => 'Auto1h fold change was successfully updated.') }\n format.xm... | [
"0.6669969",
"0.61592245",
"0.6146433",
"0.57850224",
"0.5746697",
"0.5727979",
"0.5665986",
"0.5624672",
"0.5528979",
"0.5212441",
"0.5196037",
"0.51373094",
"0.51309395",
"0.5124373",
"0.5124307",
"0.5124254",
"0.49629757",
"0.48081446",
"0.47723004",
"0.47159457",
"0.47105... | 0.63633174 | 1 |
PUT /auto1h_fold_changes/1 PUT /auto1h_fold_changes/1.xml | def update
@auto1h_fold_change = Auto1hFoldChange.find(params[:id])
respond_to do |format|
if @auto1h_fold_change.update_attributes(params[:auto1h_fold_change])
format.html { redirect_to(@auto1h_fold_change, :notice => 'Auto1h fold change was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @auto1h_fold_change.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @hetero1h_fold_change = Hetero1hFoldChange.find(params[:id])\n\n respond_to do |format|\n if @hetero1h_fold_change.update_attributes(params[:hetero1h_fold_change])\n format.html { redirect_to(@hetero1h_fold_change, :notice => 'Hetero1h fold change was successfully updated.') }\n ... | [
"0.6806152",
"0.6460156",
"0.60975254",
"0.60180956",
"0.59429765",
"0.59218717",
"0.58927643",
"0.5807008",
"0.54730195",
"0.5468437",
"0.54474705",
"0.53939223",
"0.5383452",
"0.52899224",
"0.5144697",
"0.5093051",
"0.50664556",
"0.50269735",
"0.5022232",
"0.4989123",
"0.49... | 0.73654467 | 0 |
DELETE /auto1h_fold_changes/1 DELETE /auto1h_fold_changes/1.xml | def destroy
@auto1h_fold_change = Auto1hFoldChange.find(params[:id])
@auto1h_fold_change.destroy
respond_to do |format|
format.html { redirect_to(auto1h_fold_changes_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @auto24h_fold_change = Auto24hFoldChange.find(params[:id])\n @auto24h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto24h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hetero1h_fold_change = Hetero1hFoldChange.f... | [
"0.6999659",
"0.69996226",
"0.65494996",
"0.6258215",
"0.58834153",
"0.58636796",
"0.5760584",
"0.5737086",
"0.5615536",
"0.5603464",
"0.55823964",
"0.55224675",
"0.54767346",
"0.5435245",
"0.54351914",
"0.53915316",
"0.53686434",
"0.5356971",
"0.53467727",
"0.5346028",
"0.53... | 0.75717944 | 0 |
runs after each test | def teardown
# delete everything
@client.delete('/words.json') rescue nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_test(_test); end",
"def after_test(_test); end",
"def after_test(_test); end",
"def after; end",
"def after; end",
"def after\n end",
"def testing_end\n end",
"def after\n end",
"def after\n end",
"def after\n end",
"def after_teardown; end",
"def after() nil ; end",... | [
"0.870935",
"0.870935",
"0.870935",
"0.7898083",
"0.7898083",
"0.7802519",
"0.7731518",
"0.7725426",
"0.7725426",
"0.7721521",
"0.76235646",
"0.74868226",
"0.73683226",
"0.73535156",
"0.73533344",
"0.71286774",
"0.709552",
"0.7061224",
"0.7002905",
"0.68963164",
"0.6883115",
... | 0.0 | -1 |
~ Validation ............................................................... ~ Constants ................................................................ ~ Hooks .................................................................... ~ Class methods ............................................................ ~ Instance methods ......................................................... clone inst_chapter_module | def clone(book, chapter)
ch_mod = InstChapterModule.new
ch_mod.inst_chapter_id = chapter.id
ch_mod.inst_module_id = self.inst_module_id
ch_mod.module_position = self.module_position
ch_mod.save
inst_sections.each do |section|
inst_section = section.clone(book, ch_mod)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone(inst_book)\n ch = InstChapter.new\n ch.inst_book_id = inst_book.id\n ch.name = self.name\n ch.short_display_name = self.short_display_name\n ch.position = self.position\n ch.save\n\n inst_chapter_modules.each do |chapter_module|\n inst_chapter_module = chapter_module.clone(inst_... | [
"0.7890258",
"0.6462407",
"0.621236",
"0.6099441",
"0.6005311",
"0.6005311",
"0.6005311",
"0.5979878",
"0.5948332",
"0.59145516",
"0.59145516",
"0.59145516",
"0.58370215",
"0.58052343",
"0.58052343",
"0.57945704",
"0.5776038",
"0.5721032",
"0.57147",
"0.57038325",
"0.56764686... | 0.7693855 | 1 |
gets all the exercises in one module | def get_exercises_list
exercises_list = []
inst_sections.each do |inst_section|
exercises_ids = inst_section.inst_book_section_exercises.collect(&:inst_exercise_id).compact
exercises_objs = InstExercise.where(id: exercises_ids)
exercises_list.concat exercises_objs.collect(&:short_name)
end
return exercises_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bk_sec_exercises()\n InstBookSectionExercise.includes(:inst_exercise)\n .joins(:inst_section)\n .where(inst_sections: {inst_chapter_module_id: self.id})\n end",
"def index\n @programme_exercises = ProgrammeExercise.all\n end",
"def index\n @api_v1_exercises = Api::V1::Exercise.all\... | [
"0.68270224",
"0.63926715",
"0.63837355",
"0.6327996",
"0.6315433",
"0.6277688",
"0.62363505",
"0.6235913",
"0.6233418",
"0.62311316",
"0.617177",
"0.5988263",
"0.5979324",
"0.58786833",
"0.58611494",
"0.57945496",
"0.57819676",
"0.57789344",
"0.57742757",
"0.573673",
"0.5695... | 0.74532676 | 0 |
get all of the inst_book_section_exercise instances associated with this module | def get_bk_sec_exercises()
InstBookSectionExercise.includes(:inst_exercise)
.joins(:inst_section)
.where(inst_sections: {inst_chapter_module_id: self.id})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_exercises_list\n exercises_list = []\n inst_sections.each do |inst_section|\n exercises_ids = inst_section.inst_book_section_exercises.collect(&:inst_exercise_id).compact\n exercises_objs = InstExercise.where(id: exercises_ids)\n exercises_list.concat exercises_objs.collect(&:short_nam... | [
"0.73905605",
"0.61486846",
"0.6032731",
"0.58753085",
"0.58352643",
"0.568193",
"0.56593484",
"0.5606959",
"0.5599002",
"0.5564633",
"0.55466497",
"0.55225277",
"0.5483004",
"0.54768443",
"0.54677606",
"0.5445167",
"0.54239225",
"0.540966",
"0.5392279",
"0.5383424",
"0.53695... | 0.7846473 | 0 |
get all exercise progresses for the exercises in this module for the specified user | def get_exercise_progresses(user_id)
OdsaExerciseProgress.joins(inst_book_section_exercise: [:inst_section])
.where(inst_sections: {inst_chapter_module_id: self.id}, user_id: user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @user = User.find(params[:user_id])\n @exercises = @user.exercises.all\n end",
"def index\n @user = User.find(current_user.id)\n @exercises = Exercise.all\n end",
"def get_exercises_list\n exercises_list = []\n inst_sections.each do |inst_section|\n exercises_ids = inst_sec... | [
"0.62693167",
"0.5825106",
"0.5666747",
"0.5660282",
"0.5629161",
"0.55948055",
"0.553738",
"0.5506217",
"0.54563826",
"0.5438358",
"0.54136205",
"0.5322686",
"0.5318455",
"0.5294175",
"0.52817625",
"0.52794385",
"0.52567387",
"0.5256051",
"0.5254691",
"0.5232709",
"0.5173285... | 0.79263496 | 0 |
GET /volunteer_jobs GET /volunteer_jobs.json | def index
@volunteer_jobs = VolunteerJob.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @volunteer_jobs }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @volunteer_job = VolunteerJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volunteer_job }\n end\n end",
"def index\n @jobs = current_user.jobs\n\n respond_to do |format|\n format.html # index.html.erb\n fo... | [
"0.7364898",
"0.712347",
"0.7085784",
"0.6929859",
"0.6753155",
"0.6736709",
"0.66865975",
"0.64835364",
"0.6483072",
"0.64656293",
"0.6452728",
"0.6450726",
"0.64321464",
"0.6416266",
"0.6416266",
"0.64099526",
"0.6407239",
"0.6379839",
"0.6371384",
"0.6371384",
"0.63697743"... | 0.790424 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.