query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
DELETE /forum_cat_l1s/1 DELETE /forum_cat_l1s/1.xml | def destroy
@forum_cat_l1 = ForumCatL1.find(params[:id])
@forum_cat_l1.destroy
respond_to do |format|
format.html { redirect_to(forum_cat_l1s_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @forum_post = ForumPost.find(params[:id])\n forum_cat_l2 = @forum_post.forum_cat_l2\n @forum_post.destroy\n\n respond_to do |format|\n format.html { redirect_to forum_cat_l2_path(forum_cat_l2) }\n format.xml { head :ok }\n end\n end",
"def delete_forum id\n\t\t\t\t\tFresh... | [
"0.71156746",
"0.67091733",
"0.66993564",
"0.665105",
"0.66479176",
"0.65998554",
"0.65891576",
"0.6509587",
"0.6448298",
"0.64113075",
"0.640622",
"0.6388922",
"0.6378038",
"0.63606995",
"0.6355409",
"0.63508177",
"0.62868",
"0.6277622",
"0.6273756",
"0.62716573",
"0.6259538... | 0.77989984 | 0 |
GET /portal/learners GET /portal/learners.xml | def index
@portal_learners = Portal::Learner.search(params[:search], params[:page], nil)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @portal_learners }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @learners = Learner.all\n end",
"def new\n @portal_learner = Portal::Learner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @portal_learner }\n end\n end",
"def index\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE\n ... | [
"0.6887659",
"0.6740972",
"0.6546517",
"0.6353626",
"0.6158483",
"0.60948175",
"0.5989694",
"0.5976165",
"0.5920067",
"0.585862",
"0.58358645",
"0.58119965",
"0.57782644",
"0.5743717",
"0.57227707",
"0.57206905",
"0.5714451",
"0.5702505",
"0.56483495",
"0.56342185",
"0.558779... | 0.703121 | 0 |
GET /portal/learners/1/open_response_report GET /portal/learners/1/open_response_report.xml | def open_response_report
@portal_learner = Portal::Learner.find(params[:id])
respond_to do |format|
format.html # report.html.haml
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_response_report\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHOOSE_AUTHORIZE\n # no authorization needed ...\n # authorize Portal::Learner\n # authorize @learner\n # authorize Portal::Learner, :new_or_create?\n # authorize @learner, :update_edit_or_destroy?\n @portal_learner = Portal::L... | [
"0.69289225",
"0.6280504",
"0.6258765",
"0.6258765",
"0.5913563",
"0.58976084",
"0.58624345",
"0.58320194",
"0.5812011",
"0.5787797",
"0.5779233",
"0.5773819",
"0.5771644",
"0.5771005",
"0.57687",
"0.57683724",
"0.57568294",
"0.5755484",
"0.57528955",
"0.5735385",
"0.56987286... | 0.7529565 | 0 |
GET /portal/learners/1/multiple_choice_report GET /portal/learners/1/multiple_choice_report.xml | def multiple_choice_report
@portal_learner = Portal::Learner.find(params[:id])
respond_to do |format|
format.html # report.html.haml
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multiple_choice_report\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHOOSE_AUTHORIZE\n # no authorization needed ...\n # authorize Portal::Learner\n # authorize @learner\n # authorize Portal::Learner, :new_or_create?\n # authorize @learner, :update_edit_or_destroy?\n @portal_learner = Portal:... | [
"0.73271894",
"0.62780035",
"0.62171257",
"0.6011317",
"0.5902038",
"0.58832306",
"0.5837398",
"0.5745126",
"0.56874603",
"0.56874603",
"0.56849986",
"0.5626224",
"0.55406445",
"0.5522408",
"0.55100685",
"0.5503292",
"0.5492647",
"0.5462987",
"0.5432649",
"0.54154414",
"0.540... | 0.80092335 | 0 |
GET /portal/learners/1/bundle_report GET /portal/learners/1/bundle_report.xml | def bundle_report
@portal_learner = Portal::Learner.find(params[:id])
respond_to do |format|
format.html # report.html.haml
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bundle_report\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHOOSE_AUTHORIZE\n # no authorization needed ...\n # authorize Portal::Learner\n # authorize @learner\n # authorize Portal::Learner, :new_or_create?\n # authorize @learner, :update_edit_or_destroy?\n @portal_learner = Portal::Learner.... | [
"0.67965174",
"0.60938025",
"0.60678214",
"0.602353",
"0.5999329",
"0.59496105",
"0.58446866",
"0.5828353",
"0.57782066",
"0.57782066",
"0.57239056",
"0.5691119",
"0.56887",
"0.5677733",
"0.56447494",
"0.5640766",
"0.5632636",
"0.5608801",
"0.55764884",
"0.5571586",
"0.556530... | 0.7743663 | 0 |
GET /portal/learners/new GET /portal/learners/new.xml | def new
@portal_learner = Portal::Learner.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @portal_learner }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @portal_learner = Portal::Learner.new(params[:learner])\n\n respond_to do |format|\n if @portal_learner.save\n flash[:notice] = 'Portal::Learner was successfully created.'\n format.html { redirect_to(@portal_learner) }\n format.xml { render :xml => @portal_learner, :st... | [
"0.73440623",
"0.7120477",
"0.704073",
"0.6972769",
"0.6964356",
"0.68110347",
"0.67845285",
"0.675575",
"0.6717819",
"0.66996443",
"0.66921794",
"0.6691826",
"0.66797376",
"0.6663254",
"0.6658634",
"0.66570395",
"0.6641818",
"0.6639715",
"0.66185206",
"0.6604964",
"0.6600085... | 0.78264666 | 0 |
POST /portal/learners POST /portal/learners.xml | def create
@portal_learner = Portal::Learner.new(params[:learner])
respond_to do |format|
if @portal_learner.save
flash[:notice] = 'Portal::Learner was successfully created.'
format.html { redirect_to(@portal_learner) }
format.xml { render :xml => @portal_learner, :status => :cre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE\n # authorize Portal::Learner\n @portal_learner = Portal::Learner.new(params[:learner])\n\n respond_to do |format|\n if @portal_learner.save\n flash[:notice] = 'Portal::Learner was successfully created.'\n format.ht... | [
"0.6938103",
"0.6385076",
"0.6179851",
"0.59332085",
"0.5912572",
"0.59061766",
"0.5651073",
"0.56488985",
"0.5646559",
"0.55446005",
"0.5529626",
"0.5484558",
"0.5480279",
"0.5458917",
"0.54394794",
"0.5380092",
"0.53788173",
"0.5377595",
"0.5368053",
"0.5321442",
"0.5303776... | 0.7061077 | 0 |
PUT /portal/learners/1 PUT /portal/learners/1.xml | def update
@portal_learner = Portal::Learner.find(params[:id])
respond_to do |format|
if @portal_learner.update_attributes(params[:learner])
flash[:notice] = 'Portal::Learner was successfully updated.'
format.html { redirect_to(@portal_learner) }
format.xml { head :ok }
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE (did not find instance)\n # authorize @learner\n @portal_learner = Portal::Learner.find(params[:id])\n\n respond_to do |format|\n if @portal_learner.update_attributes(params[:learner])\n flash[:notice] = 'Portal::Learner w... | [
"0.66387635",
"0.63641405",
"0.61911106",
"0.6068104",
"0.58350945",
"0.5793474",
"0.5713103",
"0.56420976",
"0.5604703",
"0.5587539",
"0.5583807",
"0.55471885",
"0.55346245",
"0.5482316",
"0.5470577",
"0.5464942",
"0.5450375",
"0.5440535",
"0.5422126",
"0.53941256",
"0.53704... | 0.6968493 | 0 |
DELETE /portal/learners/1 DELETE /portal/learners/1.xml | def destroy
@portal_learner = Portal::Learner.find(params[:id])
@portal_learner.destroy
respond_to do |format|
format.html { redirect_to(portal_learners_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE (did not find instance)\n # authorize @learner\n @portal_learner = Portal::Learner.find(params[:id])\n @portal_learner.destroy\n\n respond_to do |format|\n format.html { redirect_to(portal_learners_url) }\n format.xml {... | [
"0.70256513",
"0.6791501",
"0.65993",
"0.65353346",
"0.65283394",
"0.64936334",
"0.6363794",
"0.6329985",
"0.6323121",
"0.62932867",
"0.62773335",
"0.6267726",
"0.6203709",
"0.61961305",
"0.6189406",
"0.61839694",
"0.6148021",
"0.6148021",
"0.6147826",
"0.61392593",
"0.613715... | 0.7416241 | 0 |
Adjusts the hash storage and redistributes the entries among the new bins. Any Iterator instance will be invalid after a call to redistribute. Does not recalculate the cached key_hash values. See +rehash+. | def redistribute(entries)
capacity = @capacity
# Rather than using __setup__, initialize the specific values we need to
# change so we don't eg overwrite @state.
if @size > @max_entries
@capacity = capacity * 2
@max_entries = @max_entries * 2
@min_entries = @min_entries * 2
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redistribute(entries)\n capacity = @capacity\n\n # TODO: grow smaller too\n __setup__ @capacity * 2, @max_entries * 2, @size\n\n i = -1\n while (i += 1) < capacity\n next unless old = entries[i]\n while old\n old.next = nil if nxt = old.next\n\n index = key_index old.key_... | [
"0.6982203",
"0.675086",
"0.6451028",
"0.605086",
"0.57184774",
"0.5632947",
"0.56229144",
"0.55872303",
"0.5548985",
"0.54727006",
"0.54340965",
"0.5432246",
"0.5380388",
"0.5318216",
"0.528489",
"0.51877475",
"0.517789",
"0.5117986",
"0.5104547",
"0.50954103",
"0.5089018",
... | 0.68818825 | 1 |
Extract any payment errors from pending offer orders | def payment_error_notifications
payment_logs = order_logs
.joins(:order => :offer_order)
.where("orders.status IN ('pending') AND lower(order_logs.action) IN ('bill', 'payment')")
.order('order_logs.created_at')
payment_logs.group_by(&:order_id).reduce([]) do |a, (order_id, logs)|
log... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def errors\n p = build_payment\n p.valid?\n p.errors\n end",
"def paypal_errors_msg\n \"We are sorry, but the purchase was not completed due the following errors: #{errors.full_messages.join(', ')}\"\n end",
"def return_shipment_errors\n [\"#{@shipment}.buy(no rates found for this shipment... | [
"0.6203334",
"0.61273426",
"0.6099045",
"0.59701705",
"0.56007934",
"0.55140173",
"0.5483827",
"0.53790593",
"0.5370483",
"0.52740854",
"0.5249226",
"0.52462",
"0.5234787",
"0.5234353",
"0.52242297",
"0.51837796",
"0.5175309",
"0.5161314",
"0.5143378",
"0.5122039",
"0.510268"... | 0.689593 | 0 |
Compute the actual value of a field for a given serializer instance. | def value(serializer)
if block
serializer.instance_eval(&block)
else
serializer.read_attribute_for_serialization(name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_field_value(obj, name)\n begin\n @struct_field_getter.call(obj, name)\n rescue\n 0\n end\n end",
"def get_value(field)\n field = item_type.find_field(field) unless field.is_a? Field\n field.value_for_item(self)\n end",
"def field_value(field)\n ... | [
"0.6748203",
"0.6200198",
"0.6184239",
"0.61141616",
"0.6105577",
"0.60647213",
"0.60548264",
"0.58782715",
"0.5868786",
"0.5817276",
"0.5768793",
"0.57410145",
"0.5691646",
"0.56735164",
"0.5661844",
"0.5659576",
"0.56276053",
"0.5621258",
"0.5609502",
"0.56037843",
"0.56009... | 0.6846504 | 0 |
:callseq: add(MyReleaseClass) Add a Release implementation to the list of available Release classes. | def add(release)
@list ||= []
@list |= [release]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_on_distro_release(distro, release, name, version=nil)\n distro_releases[[distro, release]] << [name, version]\n end",
"def add_class(new_class)\n @classes << new_class\n end",
"def add(klass)\n @known_classes << klass\n end",
"def add(klass, position = registered_items.size... | [
"0.5785558",
"0.5385419",
"0.5381441",
"0.53082067",
"0.51846546",
"0.51846546",
"0.51443654",
"0.5133686",
"0.50745404",
"0.5027424",
"0.50091416",
"0.50054693",
"0.49902195",
"0.49484912",
"0.49325216",
"0.49302375",
"0.49039114",
"0.4899441",
"0.48849308",
"0.48402685",
"0... | 0.69061494 | 1 |
:callseq: extract_version() => this_version Extract the current version number from the buildfile. Raise an error if not found. | def extract_version
buildfile = File.read(Rake.application.rakefile).force_encoding("ISO-8859-1").encode("utf-8", replace: nil)
buildfile.scan(THIS_VERSION_PATTERN)[0][2]
rescue
fail 'Looking for THIS_VERSION = "1.0.0-rc1" in your Buildfile, none found'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_version\n buildfile = File.read(version_file)\n buildfile.scan(THIS_VERSION_PATTERN)[0][2]\n rescue\n fail 'Looking for THIS_VERSION = \"...\" in your Buildfile, none found'\n end",
"def build_version\n string = plist_buddy.plist_read(\"CFBundleVersion\", info_plist_path)\n ... | [
"0.84408754",
"0.6472261",
"0.64500403",
"0.6438712",
"0.63816166",
"0.63013315",
"0.62654823",
"0.6176433",
"0.61686075",
"0.61397475",
"0.6132354",
"0.6118228",
"0.6117402",
"0.6113286",
"0.60789984",
"0.607277",
"0.60645723",
"0.60093766",
"0.59999335",
"0.59854895",
"0.59... | 0.7951729 | 1 |
Move the version to next and save the updated buildfile | def update_buildfile
buildfile = change_version { |version| # THIS_VERSION minus SNAPSHOT
resolve_next_version(this_version) # THIS_VERSION
}
File.open(Rake.application.rakefile.to_s, 'w') { |file| file.write buildfile }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_buildfile\n buildfile = change_version { |version| # THIS_VERSION minus SNAPSHOT\n resolve_next_version(this_version) # THIS_VERSION\n }\n File.open(version_file, 'w') { |file| file.write buildfile }\n end",
"def update_version_to_next\n super\n info \"Current versio... | [
"0.77271146",
"0.7209762",
"0.63637227",
"0.6313188",
"0.6283097",
"0.62792295",
"0.62788224",
"0.6259882",
"0.61795384",
"0.61575544",
"0.61250705",
"0.61115867",
"0.60973257",
"0.6060992",
"0.6026321",
"0.59850246",
"0.5981068",
"0.59690034",
"0.5958315",
"0.5954643",
"0.59... | 0.752837 | 1 |
Return the message to use to commit the buildfile with the next version | def message
version = extract_version
msg = Release.commit_message || "Changed version number to #{version}"
msg = msg.call(version) if Proc === msg
msg
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_version_to_next\n super\n info \"Current version is now #{extract_version}\"\n Hg.commit File.basename(version_file), message\n Hg.push if Hg.remote\n end",
"def commit_message\n @commit.sub '%.%.%', @after_version\n end",
"def update_buildfile\n buildfile = chang... | [
"0.7133768",
"0.70819384",
"0.6720151",
"0.6618071",
"0.65373284",
"0.6351196",
"0.62521625",
"0.6127682",
"0.60882264",
"0.60267824",
"0.59917647",
"0.5972133",
"0.5931828",
"0.5928321",
"0.592758",
"0.58913636",
"0.5838882",
"0.5831469",
"0.58167374",
"0.5810524",
"0.578811... | 0.7228319 | 1 |
:callseq: git(args) Executes a Git command and returns the output. Throws exception if the exit status is not zero. For example: git 'commit' git 'remote', 'show', 'origin' | def git(*args)
cmd = "git #{args.shift} #{args.map { |arg| arg.inspect }.join(' ')}"
output = `#{cmd}`
fail "GIT command \"#{cmd}\" failed with status #{$?.exitstatus}\n#{output}" unless $?.exitstatus == 0
return output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git(*args)\n cmd(*['git'] + args)\n end",
"def git(*args)\n cmd(*['git'] + args)\n end",
"def git(*args, &block)\n options = args.extract_options!\n system_args = ['--git-dir', root_url, '-c', 'core.quotepath=false']\n\n args = system_args + Array.wrap(args)\n args = arg... | [
"0.80866045",
"0.80866045",
"0.7993441",
"0.798694",
"0.79055065",
"0.7795743",
"0.7695566",
"0.7680668",
"0.76475877",
"0.7645145",
"0.76142055",
"0.75880176",
"0.75628316",
"0.73071253",
"0.7188069",
"0.7121762",
"0.7066952",
"0.68923753",
"0.67880005",
"0.67830676",
"0.670... | 0.8750967 | 1 |
Returns list of uncommited/untracked files as reported by git status. | def uncommitted_files
`git status`.scan(/^#(\t|\s{7})(\S.*)$/).map { |match| match.last.split.last }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_uncommitted_files\n\t\t\tlist = read_command_output( 'hg', 'status', '-n', '--color', 'never' )\n\t\t\tlist = list.split( /\\n/ )\n\n\t\t\ttrace \"Changed files: %p\" % [ list ]\n\t\t\treturn list\n\t\tend",
"def uncommitted_files\n svn('status', '--ignore-externals').split(\"\\n\").reject { |line| ... | [
"0.7949743",
"0.7858256",
"0.7604518",
"0.7592769",
"0.6977188",
"0.69291365",
"0.686998",
"0.684934",
"0.6786466",
"0.65984774",
"0.64842325",
"0.6372661",
"0.6371909",
"0.63645184",
"0.62491596",
"0.62377334",
"0.62377334",
"0.60348916",
"0.59823763",
"0.5968926",
"0.596131... | 0.836846 | 1 |
Commit the given file with a message. The file has to be known to Git meaning that it has either to have been already committed in the past or freshly added to the index. Otherwise it will fail. | def commit(file, message)
git 'commit', '-m', message, file
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit(file, message)\n hg 'commit', '-m', message, file\n end",
"def commit(message = nil)\n # Write current index back to the repository\n index = @repo.index\n commit_tree = index.write_tree @repo\n\n # Commit message\n message = \"Affected files: #{@affected_files.uniq.jo... | [
"0.7875317",
"0.75850695",
"0.7332475",
"0.72253996",
"0.70301443",
"0.7004379",
"0.69789493",
"0.6968867",
"0.6931715",
"0.6870631",
"0.6769182",
"0.6611701",
"0.6474825",
"0.64290655",
"0.6427936",
"0.6417664",
"0.6413019",
"0.63693213",
"0.636375",
"0.63595146",
"0.6358841... | 0.8352529 | 1 |
this will check if the obj is locked with any user. | def locked?(obj)
RedisMutexer.config.redis.exists(key(obj))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locked?\n !!@owner\n end",
"def locked?\n fetch_lock_info\n\n obj_exists_and_is_not_type? obj: @lock_info, type: []\n end",
"def can_lock?(current_user)\n return false if current_user.anonymous?\n\n not is_locked?\n end",
"def can_lock?\n SpaceRequestPolicy.can_lock?(curren... | [
"0.7684398",
"0.7403483",
"0.7345187",
"0.72594255",
"0.71440417",
"0.7131871",
"0.7095968",
"0.708216",
"0.7010908",
"0.6980229",
"0.6971062",
"0.69588786",
"0.6956333",
"0.69508123",
"0.694917",
"0.69092435",
"0.69092435",
"0.69092435",
"0.69092435",
"0.6883724",
"0.6838925... | 0.74661 | 1 |
Calculate the sub_total as the SUM(line_item.line_amount). | def sub_total
total_cache(:sub_total) || sum_line_items(line_items, :line_amount)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subtotal\n line_items.reduce(BigDecimal(\"0\")) { |result, item| result += item.amount }\n end",
"def sub_total\n sum = 0\n line_items.each do |line_item|\n sum += line_item.total_price\n end\n sum\n end",
"def sub_total\n return ApplicationHelper.round_currency(self.line_items.inj... | [
"0.8941642",
"0.87423617",
"0.8526777",
"0.8475841",
"0.81044716",
"0.7917328",
"0.7806597",
"0.77830803",
"0.77776575",
"0.7768823",
"0.77299535",
"0.77105564",
"0.77105564",
"0.7653539",
"0.76464564",
"0.76460207",
"0.76066554",
"0.7598901",
"0.7590735",
"0.75285095",
"0.74... | 0.87697595 | 1 |
If a templating language other than ERB is specified, add the relevant gem to the Gemfile. | def add_view_language_gem
return if view_language == "erb"
add_gems %(gem "#{view_language}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_linter_gems(engine)\n return '' if engine.blank?\n\n case engine.to_s\n when 'haml'\n \"gem 'haml_lint'#{gemfile_requirement('haml_lint')}, require: false\"\n when 'slim'\n \"gem 'slim_lint'#{gemfile_requirement('slim_lint')}, require: false\"\n else\n \"g... | [
"0.6434705",
"0.62683153",
"0.6247927",
"0.62002105",
"0.61389774",
"0.57077384",
"0.56590736",
"0.5601729",
"0.557176",
"0.5535659",
"0.5502187",
"0.5473761",
"0.54413515",
"0.5350218",
"0.52036774",
"0.52022403",
"0.5175113",
"0.51533234",
"0.51533234",
"0.51533234",
"0.515... | 0.7270648 | 0 |
Run the Views generator to produce views | def generate_views
Views.new(cli: cli, app_path: app_path).generate
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_view \n \n return if skip_method(__method__)\n \n # build edit _form index new show\n \n ['_form','edit','new','index','show'].each do |file|\n \n \n template = File.read(template(\"rails/views/#{file}.html.erb\"))\n \n # need to use ERB for these templates\n t... | [
"0.72299117",
"0.7178173",
"0.69774723",
"0.6902254",
"0.67007166",
"0.66692483",
"0.6498586",
"0.6430707",
"0.6332138",
"0.62775815",
"0.6263002",
"0.62627524",
"0.6200726",
"0.6200673",
"0.6165071",
"0.6149146",
"0.61454237",
"0.6119936",
"0.60735446",
"0.6062002",
"0.60467... | 0.79429555 | 0 |
generates a fetch statistic image | def stats!
info "STATS"
task "generate chart" do
c = Chart::StatsPerCollection.new
@dbi.execute( File.read( sql_query(:chart) ) ).each{ |date,collection|
c.add_one(collection, Date.parse(date).day)
}
Chart.new(c).write File.join( @config['settings']['output'], '/chart.jpg' )
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @samples = ImageReaderService.new(@image).analyze.generate_samples 4\n end",
"def show\n unless (request.path.scan(/^\\/(.{1,})\\/.{1,}$/)[0].nil? || request.path.scan(/^\\/(.{1,})\\/.{1,}$/)[0][0] == \"imgnewsletters\")\n @newsletter = Newsletter.find(params[:id])\n respond_wit... | [
"0.5667243",
"0.5641356",
"0.55593824",
"0.5435218",
"0.53880805",
"0.53696626",
"0.53649914",
"0.536338",
"0.5345917",
"0.53441507",
"0.5323299",
"0.532244",
"0.53213435",
"0.5309056",
"0.53035444",
"0.5246989",
"0.5244687",
"0.523554",
"0.523322",
"0.52300507",
"0.52249205"... | 0.5662734 | 1 |
> compress [1, 1, 2, 3, 3, 3] => [1, 2, 3] | def compress(array)
array.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compress(list)\n list.zip(list[1..-1] + [nil]). # Zip with shifted list\n select {|a,b| a != b}. # Filter dups\n map {|a,b| a} # Unzip\nend",
"def compress(array)\n prev = nil\n array.select {|v| v == prev ? false : prev = v}\nend",
"def compress(data); end",
"def compres... | [
"0.7903527",
"0.73421437",
"0.6634792",
"0.6615078",
"0.6261407",
"0.61034465",
"0.60872287",
"0.60740423",
"0.6065707",
"0.6043544",
"0.59632117",
"0.5960188",
"0.5942582",
"0.5940796",
"0.5913524",
"0.5880538",
"0.5861572",
"0.5854636",
"0.5848758",
"0.5837404",
"0.5806937"... | 0.80014986 | 0 |
GET /admin/enrollments/new GET /admin/enrollments/new.xml | def new
@enrollment = Enrollment.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @enrollment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @entitlement = Entitlement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entitlement }\n end\n end",
"def new\n @assessment = Assessment.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { rend... | [
"0.7059007",
"0.7040094",
"0.7016466",
"0.7011768",
"0.7005482",
"0.7005482",
"0.6924383",
"0.6910551",
"0.6910551",
"0.68755823",
"0.68755823",
"0.68755823",
"0.68608713",
"0.6819725",
"0.6760885",
"0.6758027",
"0.67453074",
"0.6742924",
"0.67345005",
"0.67328286",
"0.673001... | 0.76625216 | 1 |
Generate a searchable schema list in the output | def generate_schema_list
puts "GENERATE SCHEMA LIST"
# load all the features from the Registry
@items = Registry.all(:schema).sort { |a,b| a.name.downcase <=> b.name.downcase }
@list_title = "Schema List"
@list_type = "schema"
# optional: the specified stylesheet class
# when not specified it will... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @schemas = Schema.all\n end",
"def schema\n []\n end",
"def available_schemas\n load_schemas.transform_values(&:description).to_a\n end",
"def user_defined_schemas(stream)\n return if (list = (@connection.user_defined_schemas - ['public'])).empty?\n\n ... | [
"0.64337724",
"0.6202368",
"0.6157455",
"0.6154027",
"0.614332",
"0.61003363",
"0.60073525",
"0.60014963",
"0.59498584",
"0.5901143",
"0.58913946",
"0.58911574",
"0.5885941",
"0.5870931",
"0.58381474",
"0.5816694",
"0.58004546",
"0.5765432",
"0.5716042",
"0.56836516",
"0.5682... | 0.6860441 | 0 |
Remove a link from the website | def remove_link(link)
links.delete(link)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_links\n gsub(%r{</?a.*?>}, \"\")\n end",
"def clear_link\n @link = nil\n @autolink = false\n end",
"def strip_links(html); end",
"def strip_links(html); end",
"def strip_links(html); end",
"def remove_hyperlink(hyperlink_to_delete)\n hyperlinks = self.hyperlinks\n hyperli... | [
"0.72726053",
"0.72398233",
"0.713943",
"0.713943",
"0.713943",
"0.70390487",
"0.6958023",
"0.6928066",
"0.68861246",
"0.677371",
"0.677371",
"0.67188716",
"0.6716101",
"0.67093617",
"0.67045206",
"0.6691306",
"0.6643811",
"0.65920997",
"0.65794975",
"0.6573608",
"0.65212876"... | 0.7798636 | 0 |
Finds all links that contain the search string | def find_links(search)
links.select { |link| link.contains? search }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_links(page,content)\n page.links_with( :text => Regexp.new(content, true))\n end",
"def research_sites(search_str)\n search_sites = link_to \"Google\", 'http://www.google.com/search?q=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Yahoo\", 'http://... | [
"0.7509331",
"0.6644939",
"0.6555102",
"0.6539062",
"0.6487399",
"0.6372842",
"0.6367508",
"0.6366524",
"0.62081313",
"0.61661977",
"0.61636686",
"0.5996572",
"0.597002",
"0.5932552",
"0.5927549",
"0.5926851",
"0.5862333",
"0.5827129",
"0.582345",
"0.5766893",
"0.5757087",
... | 0.84877676 | 0 |
Merge links based on the provided attribue to one link by combining the values. The first link will be updated and the obsolete links are deleted and will be returned | def merge_links_on(attribute, concat_string = ',')
links_group_by(attribute)
.select { |key, link_list| links.size > 1 }
.map do |key, link_list|
merge_attributes = Link::ATTRS - [attribute]
link_list.first
.update(Hash[extract_columns(link_lis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def links_duplicate_on(attribute, separator)\n links.map do |link|\n link.send(attribute).split(separator).collect do |value|\n link.dup.update(Hash[attribute, value])\n end\n end.flatten\n end",
"def links_group_by(attribute, linkz = links)\n linkz.map { |link| { k... | [
"0.67300624",
"0.5892039",
"0.57265204",
"0.57170516",
"0.56841004",
"0.5675346",
"0.5667954",
"0.552701",
"0.55245966",
"0.54597044",
"0.5459626",
"0.5449457",
"0.5447379",
"0.5322642",
"0.52903587",
"0.5281846",
"0.52752876",
"0.5264464",
"0.5255046",
"0.52191734",
"0.51897... | 0.7790461 | 0 |
Groups the links on the provided attribute. If no links array is provided the links from self are used | def links_group_by(attribute, linkz = links)
linkz.map { |link| { key: link.send(attribute), link: link } }
.group_by { |entry| entry[:key] }
.each { |key, link| link.map! { |l| l[:link] }}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_links_on(attribute, concat_string = ',')\n links_group_by(attribute)\n .select { |key, link_list| links.size > 1 }\n .map do |key, link_list| \n merge_attributes = Link::ATTRS - [attribute]\n link_list.first\n .update(Hash[extract_colum... | [
"0.7047207",
"0.7033148",
"0.6494589",
"0.6442318",
"0.6316675",
"0.6301108",
"0.6301108",
"0.62618494",
"0.6206597",
"0.6140449",
"0.6079296",
"0.60771763",
"0.60771763",
"0.60771763",
"0.5947005",
"0.5944945",
"0.5903296",
"0.58844495",
"0.58785987",
"0.5834544",
"0.5829364... | 0.78843886 | 0 |
Groups the links on the provided attribute. If the attribute's value contains the provided separator, the value is split up and each of the values is used as group key | def links_group_by_separated(attribute, separator)
links_group_by(attribute, links_duplicate_on(attribute, separator))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def links_duplicate_on(attribute, separator)\n links.map do |link|\n link.send(attribute).split(separator).collect do |value|\n link.dup.update(Hash[attribute, value])\n end\n end.flatten\n end",
"def links_group_by(attribute, linkz = links)\n linkz.map { |link| { k... | [
"0.7209345",
"0.70819247",
"0.69402635",
"0.6790765",
"0.6052833",
"0.6040942",
"0.56788397",
"0.5547922",
"0.5515898",
"0.55039525",
"0.53730845",
"0.5370734",
"0.5358011",
"0.52397287",
"0.523127",
"0.5194748",
"0.51419896",
"0.51263756",
"0.511681",
"0.51120263",
"0.510387... | 0.8568337 | 0 |
Create multiple Links based on the attribute provided. The specified spearator will splitt the attribute value in distinct values and for each different value a Link will be created | def links_duplicate_on(attribute, separator)
links.map do |link|
link.send(attribute).split(separator).collect do |value|
link.dup.update(Hash[attribute, value])
end
end.flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_attribute_list(attribute, separator = nil)\n links.map {|link| link.send(attribute).split(separator)}.flatten.uniq.sort\n end",
"def merge_links_on(attribute, concat_string = ',')\n links_group_by(attribute)\n .select { |key, link_list| links.size > 1 }\n .map do |key, l... | [
"0.64542395",
"0.63775426",
"0.636507",
"0.6291467",
"0.6144503",
"0.59896106",
"0.596741",
"0.5905394",
"0.580128",
"0.5676942",
"0.56404126",
"0.56242275",
"0.5576618",
"0.5538052",
"0.55129176",
"0.55090517",
"0.5487199",
"0.54685205",
"0.54665613",
"0.54513675",
"0.538629... | 0.7174124 | 0 |
Return an array of all link values as rows | def rows
links.map { |link| link.row }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def links\n @links.values\n end",
"def get_values\n data = []\n rows = text_range.to_s.split(/\\<\\/tr>/)\n rows.each_with_index do |row, row_i|\n cells = row.split(/\\<\\/td>/)\n row_data = []\n cells.each_with_index do |cell, cell_i|\n datum = cell.sub('</a>... | [
"0.6483877",
"0.6429069",
"0.603671",
"0.6009847",
"0.6004347",
"0.6001252",
"0.59963286",
"0.59733826",
"0.5964714",
"0.5961859",
"0.59537923",
"0.59466726",
"0.5942035",
"0.58889484",
"0.58887583",
"0.5839805",
"0.5821074",
"0.58192897",
"0.57346374",
"0.57065535",
"0.56957... | 0.8204305 | 0 |
Mark that you want to use stdin and raise an exception if it's already been used. | def can_i_haz_stdin!
raise ArgumentError, "stdin (-) cannot be specified multiple times" if @stdin_used
@stdin_used = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stdin!(stdin)\n @stdin = stdin\n self\n end",
"def exit_pretend_user_input\n $stdin = STDIN\nend",
"def with_stdin\n stdin = $stdin\n $stdin, write = IO.pipe\n yield write\nensure\n write.close\n $stdin = stdin\nend",
"def feed_stdin(str)\n old_stdin = $stdin\n $stdin = Stri... | [
"0.7156818",
"0.71262616",
"0.6788906",
"0.66727614",
"0.66703266",
"0.6551462",
"0.6295386",
"0.61591655",
"0.6125575",
"0.6125575",
"0.6098941",
"0.60499394",
"0.60273015",
"0.6015149",
"0.58483684",
"0.58328414",
"0.5831816",
"0.5798967",
"0.5795052",
"0.57116383",
"0.5674... | 0.79393625 | 0 |
Determines if the ledger can be conciliated or nulled | def can_conciliate_or_null?
!(nuller_id.present? || approver_id.present?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_consumable?\n true\n end",
"def null_config?\n actual_config.base_currency.nil? || actual_config.currency_rates.nil?\n end",
"def valid?\n acyclic? and connected?\n end",
"def minimal_charge_enabled?\n minimal_charge != 0\n end",
"def has_bridge?\r\n not @bridges.empty?\r\... | [
"0.6465277",
"0.63448155",
"0.6259447",
"0.6233344",
"0.6162302",
"0.6091201",
"0.6048049",
"0.60303116",
"0.59993446",
"0.5997734",
"0.59807295",
"0.59759563",
"0.59466183",
"0.5941523",
"0.5926792",
"0.585824",
"0.5828116",
"0.58205736",
"0.5797997",
"0.5786325",
"0.5783781... | 0.6623659 | 1 |
Verifico si el Medidor al que pertenece el estado, es de energia reactiva | def es_medidor_de_energia_reactiva
medidor_id = MedidorEstadoMedidor.where(estado_medidor_id: self.id).take.medidor_id
medidor = Medidor.find(medidor_id)
return medidor.tipo_medidor.codigo == 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def energized?\n @cur_energy > 0\n end",
"def revolution_per_meter? = unit == 'revolution-per-meter'",
"def past_step_2?\n !spectator? && status_is_active?(\"events\")\n end",
"def set_is_recorded\n write_attribute(:is_recorded, !exercise_minutes.to_i.zero? || !exercise_steps.to_i.zero? || self.en... | [
"0.6492438",
"0.5864758",
"0.5692867",
"0.55882525",
"0.55780554",
"0.55420303",
"0.5530164",
"0.55298436",
"0.55294484",
"0.55100954",
"0.5505155",
"0.55001956",
"0.549322",
"0.54898816",
"0.54870045",
"0.5481236",
"0.5476788",
"0.54651594",
"0.54651594",
"0.54544574",
"0.54... | 0.7939472 | 0 |
Seteo el periodo "mes/anio" | def set_periodo
self.periodo = "#{self.fecha_medicion.month}/#{self.fecha_medicion.year}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def period=(value)\n @period = value\n end",
"def frecuencia_pago_intermediario_w\n case self.frecuencia_pago_intermediario\n when 1\n I18n.t('Sistema.Body.General.Periodos.mensual')\n when 3\n I18n.t('Sistema.Body.Gener... | [
"0.62965125",
"0.6242815",
"0.62229675",
"0.61014354",
"0.6084683",
"0.6084683",
"0.6084683",
"0.60129595",
"0.58583754",
"0.57750285",
"0.5763601",
"0.57557017",
"0.572984",
"0.57110614",
"0.56708086",
"0.5622959",
"0.558434",
"0.55741805",
"0.55708677",
"0.55609673",
"0.554... | 0.77822435 | 0 |
Seteo el consumo promedio | def set_consumo_promedio
self.promedio = self.consumo_promedio
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_consumo\n @consumo = Consumo.find(params[:id])\n end",
"def set_copropietario\n @copropietario = Copropietario.find(params[:id])\n end",
"def set_procon\n @procon = Procon.find(params[:id])\n end",
"def asignar_titulo_propiedad()\n \n end",
"def set_propostum\n... | [
"0.67202896",
"0.66108555",
"0.6603203",
"0.6508413",
"0.63148475",
"0.6289735",
"0.6289735",
"0.6289735",
"0.6289735",
"0.6289735",
"0.6289735",
"0.6289735",
"0.6289735",
"0.6271108",
"0.6250806",
"0.6218165",
"0.62097245",
"0.6181791",
"0.6176842",
"0.6155868",
"0.61521876"... | 0.8240537 | 0 |
Calculo el consumo para esa toma de estado | def consumo
estado_actual - estado_anterior
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def consumo_promedio\n medidor_id = MedidorEstadoMedidor.where(estado_medidor_id: self.id).take.medidor_id\n estado_medidor_id = MedidorEstadoMedidor.where(medidor_id: medidor_id).map(&:estado_medidor_id)\n periodo = \"#{self.fecha_medicion.month}/#{self.fecha_medicion.year}\"\n estados = EstadoMedidor... | [
"0.71257466",
"0.6902688",
"0.6443456",
"0.6379449",
"0.62647855",
"0.621782",
"0.6212504",
"0.6212504",
"0.6209098",
"0.6190779",
"0.6144927",
"0.6131498",
"0.61176854",
"0.61128134",
"0.6092782",
"0.6073375",
"0.60526043",
"0.6038242",
"0.5991762",
"0.59720343",
"0.5953152"... | 0.76880634 | 0 |
GET /first_semester_library_book_outlines/1 GET /first_semester_library_book_outlines/1.json | def show
@first_semester_library_book_outline = FirstSemesterLibraryBookOutline.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @first_semester_library_book_outline }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @second_semester_library_book_outline = SecondSemesterLibraryBookOutline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @second_semester_library_book_outline }\n end\n end",
"def new\n @first_semester_library_book_outline ... | [
"0.73043036",
"0.70101863",
"0.6979276",
"0.65504867",
"0.6531357",
"0.63347316",
"0.62700015",
"0.6269688",
"0.5727571",
"0.57268167",
"0.5457231",
"0.54255074",
"0.54200023",
"0.53816247",
"0.5374278",
"0.53681225",
"0.53279835",
"0.5322215",
"0.530522",
"0.5296461",
"0.522... | 0.71769243 | 1 |
GET /first_semester_library_book_outlines/new GET /first_semester_library_book_outlines/new.json | def new
@first_semester_library_book_outline = FirstSemesterLibraryBookOutline.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @first_semester_library_book_outline }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @second_semester_library_book_outline = SecondSemesterLibraryBookOutline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @second_semester_library_book_outline }\n end\n end",
"def create\n @second_semester_library_book_outline = SecondSeme... | [
"0.7727355",
"0.67513174",
"0.6704959",
"0.6649451",
"0.6621744",
"0.6582856",
"0.6450111",
"0.6446456",
"0.6445895",
"0.6412568",
"0.6359923",
"0.63554245",
"0.6343102",
"0.6305554",
"0.6282859",
"0.6271041",
"0.6257088",
"0.6256571",
"0.62559855",
"0.6241202",
"0.6241202",
... | 0.7762794 | 0 |
POST /first_semester_library_book_outlines POST /first_semester_library_book_outlines.json | def create
@first_semester_library_book_outline = FirstSemesterLibraryBookOutline.new(params[:first_semester_library_book_outline])
respond_to do |format|
if @first_semester_library_book_outline.save
format.html { redirect_to ([:administrator, @first_semester_library_book_outline]), notice: 'Firs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @second_semester_library_book_outline = SecondSemesterLibraryBookOutline.new(params[:second_semester_library_book_outline])\n\n respond_to do |format|\n if @second_semester_library_book_outline.save\n format.html { redirect_to ([:administrator, @second_semester_library_book_outline])... | [
"0.7216646",
"0.6680735",
"0.66055524",
"0.64832455",
"0.63993776",
"0.5941207",
"0.58848184",
"0.58844554",
"0.578455",
"0.5350378",
"0.5201201",
"0.5192987",
"0.51917803",
"0.51750815",
"0.51332396",
"0.5128681",
"0.51053727",
"0.5101283",
"0.50947386",
"0.50909024",
"0.508... | 0.72161144 | 1 |
PUT /first_semester_library_book_outlines/1 PUT /first_semester_library_book_outlines/1.json | def update
@first_semester_library_book_outline = FirstSemesterLibraryBookOutline.find(params[:id])
respond_to do |format|
if @first_semester_library_book_outline.update_attributes(params[:first_semester_library_book_outline])
format.html { redirect_to ([:administrator, @first_semester_library_bo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @second_semester_library_book_outline = SecondSemesterLibraryBookOutline.find(params[:id])\n\n respond_to do |format|\n if @second_semester_library_book_outline.update_attributes(params[:second_semester_library_book_outline])\n format.html { redirect_to ([:administrator, @second_seme... | [
"0.7037561",
"0.67367375",
"0.6688401",
"0.6677294",
"0.6631812",
"0.61064166",
"0.60777324",
"0.57979673",
"0.5693921",
"0.54442817",
"0.5413638",
"0.5331234",
"0.5320914",
"0.52447987",
"0.5231045",
"0.5222837",
"0.52115697",
"0.5159946",
"0.51523453",
"0.51322454",
"0.5111... | 0.7112624 | 0 |
DELETE /first_semester_library_book_outlines/1 DELETE /first_semester_library_book_outlines/1.json | def destroy
@first_semester_library_book_outline = FirstSemesterLibraryBookOutline.find(params[:id])
@first_semester_library_book_outline.destroy
respond_to do |format|
format.html { redirect_to administrator_first_semester_library_book_outlines_url }
format.json { head :no_content }
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @second_semester_library_book_outline = SecondSemesterLibraryBookOutline.find(params[:id])\n @second_semester_library_book_outline.destroy\n\n respond_to do |format|\n format.html { redirect_to administrator_second_semester_library_book_outlines_url }\n format.json { head :no_conte... | [
"0.77728635",
"0.7117115",
"0.6694376",
"0.6642634",
"0.6609743",
"0.6608732",
"0.6608732",
"0.65992564",
"0.6593193",
"0.6569368",
"0.6552684",
"0.6484056",
"0.6484056",
"0.64831024",
"0.64758855",
"0.6433199",
"0.64313555",
"0.64302516",
"0.64287686",
"0.6427422",
"0.642344... | 0.7930115 | 0 |
Checks whether +file+ is compliant with our cstyle guidelines using the `indent` utility. | def c_compliant?(file)
corrected = "#{file}_corrected"
status = system("indent #{file} -o #{corrected}")
return nil if status.nil?
return false unless FileUtils.compare_file(file, corrected)
return true
ensure
FileUtils.rm_f(corrected)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkstyle(filename)\n cmd = [Dependency.find_by(name: 'cs-checkstyle').path, File.basename(filename)].join(' ')\n capture = Open3.capture3(cmd, chdir: File.dirname(filename))\n\n Capture.new(cmd, capture)\n end",
"def chk_format(config)\n skip = false\n config.each_line do |l... | [
"0.6002013",
"0.5896103",
"0.5845411",
"0.5822154",
"0.57406276",
"0.5688194",
"0.5501497",
"0.5483768",
"0.5449653",
"0.54476815",
"0.54147255",
"0.5181427",
"0.5060326",
"0.5017108",
"0.498734",
"0.49308065",
"0.49082625",
"0.4897584",
"0.48770759",
"0.48579293",
"0.4854259... | 0.75560665 | 0 |
Get all the presentation ids from the grid view of the presentations and return an array of ids | def get_presentation_ids(base_url)
ids_arr=[]
get_page(base_url)
grid = @wait.until{@driver.find_element(:id,"presentation_grid")}
presentation_list = @driver.find_elements(:css, ".presentation_wrap")
presentation_list.each do |presentation|
presentation_id = presentation.attribute("id")
presentation... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sheet_ids\n sheet_ids = []\n sheets = Sheet.find_all_by_survey_id(self.id)\n sheets.each do |sheet|\n sheet_ids << sheet.id\n end\n return sheet_ids\n end",
"def participant_ids\n participants.pluck(:id)\n end",
"def division_ids(season)\n ids = Division.where(:season_id => seas... | [
"0.6413428",
"0.6107001",
"0.6061341",
"0.5998015",
"0.5989683",
"0.59677243",
"0.58413106",
"0.58382535",
"0.57692426",
"0.57543653",
"0.57534105",
"0.57534105",
"0.5748409",
"0.57362914",
"0.57156026",
"0.5657332",
"0.565315",
"0.56286293",
"0.5610111",
"0.55980617",
"0.559... | 0.81500673 | 0 |
Running tests with the ONLY_OS environment variable set limits the tested platforms to the specified values. Example: ONLY_OS=centos7x86_64,ubuntu14x86_64 | def only_test_os
if ENV.key?('ONLY_OS')
ENV['ONLY_OS'].split(',')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exclude_test_os\n if ENV.key?('EXCLUDE_OS')\n ENV['EXCLUDE_OS'].split(',')\n end\nend",
"def on_os_under_test\n on_supported_os.reject do |os, facts|\n (only_test_os() && !only_test_os.include?(os)) ||\n (exclude_test_os() && exclude_test_os.include?(os))\n end\nend",
"def check_platform(a... | [
"0.72467107",
"0.7035191",
"0.6877291",
"0.6828068",
"0.67982554",
"0.67280394",
"0.66957104",
"0.6582198",
"0.65519696",
"0.6548101",
"0.65443254",
"0.65361667",
"0.64682806",
"0.64546293",
"0.6329405",
"0.6321391",
"0.631356",
"0.6301306",
"0.6300785",
"0.62839705",
"0.6223... | 0.78152275 | 0 |
Running tests with the EXCLUDE_OS environment variable set limits the tested platforms to all but the specified values. Example: EXCLUDE_OS=centos7x86_64,ubuntu14x86_64 | def exclude_test_os
if ENV.key?('EXCLUDE_OS')
ENV['EXCLUDE_OS'].split(',')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_os_under_test\n on_supported_os.reject do |os, facts|\n (only_test_os() && !only_test_os.include?(os)) ||\n (exclude_test_os() && exclude_test_os.include?(os))\n end\nend",
"def only_test_os\n if ENV.key?('ONLY_OS')\n ENV['ONLY_OS'].split(',')\n end\nend",
"def exclude_pe_upgrade_platfo... | [
"0.7788235",
"0.747524",
"0.6439767",
"0.6358739",
"0.6235619",
"0.6187325",
"0.6100337",
"0.6095439",
"0.60098463",
"0.6006786",
"0.59239376",
"0.5857372",
"0.583325",
"0.5814551",
"0.57953453",
"0.57785404",
"0.57700527",
"0.5765902",
"0.5762372",
"0.57604283",
"0.5748695",... | 0.8375436 | 0 |
Register a Let's Encrypt account This is required a private key to do this, and Let's Encrypt will use this private key to connect with domain and assign the owner who can renew and revoked. | def register(email)
account = client.new_account(contact: "mailto:#{email}", terms_of_service_agreed: true)
logger.info "Successfully registered private key with address #{email}"
account.kid # TODO: Save KID
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register\n enc_password = Authentication::Encryptor.digest(password)\n account = Authentication::Account.find_or_initialize_by({email: username})\n account.assign_attributes({'encrypted_password' => enc_password, 'gid' => gid})\n account.roles.concat(role.to_a).uniq!\n account.save!\n ... | [
"0.62717634",
"0.6236414",
"0.61966443",
"0.608187",
"0.60175425",
"0.5814123",
"0.56559443",
"0.55758756",
"0.5564925",
"0.5563685",
"0.55515116",
"0.5535045",
"0.5506047",
"0.5502468",
"0.5501809",
"0.54797465",
"0.54707164",
"0.5465139",
"0.5356201",
"0.53537947",
"0.53429... | 0.65624154 | 0 |
GET /normas/1 GET /normas/1.xml | def show
@norma = Norma.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @norma }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.hos... | [
"0.6173393",
"0.6156843",
"0.60809755",
"0.58903414",
"0.5884842",
"0.5835906",
"0.57748127",
"0.5772957",
"0.575499",
"0.5749537",
"0.57461905",
"0.5742105",
"0.57334083",
"0.57271457",
"0.57139564",
"0.57110673",
"0.5699079",
"0.56712115",
"0.5661917",
"0.5656422",
"0.56521... | 0.6805338 | 0 |
GET /normas/new GET /normas/new.xml | def new
@norma = Norma.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @norma }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end",
"def ne... | [
"0.7220552",
"0.7168956",
"0.70436466",
"0.6952536",
"0.6899364",
"0.6887829",
"0.6801287",
"0.6801287",
"0.678975",
"0.6786747",
"0.67562115",
"0.6733357",
"0.6732324",
"0.6721447",
"0.670579",
"0.66994715",
"0.66968226",
"0.6681275",
"0.66792697",
"0.66661775",
"0.66648954"... | 0.7562103 | 0 |
POST /normas POST /normas.xml | def create
@norma = Norma.new(params[:norma])
respond_to do |format|
if @norma.save
format.html { redirect_to(@norma, :notice => 'Norma was successfully created.') }
format.xml { render :xml => @norma, :status => :created, :location => @norma }
else
format.html { render :ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def new\n @norma = Norma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @norma }\... | [
"0.5817741",
"0.5744845",
"0.57311445",
"0.5683097",
"0.56655604",
"0.56556445",
"0.5608256",
"0.5589595",
"0.5553461",
"0.55108374",
"0.5456953",
"0.5420579",
"0.5373471",
"0.52988124",
"0.529538",
"0.52333295",
"0.52129006",
"0.5195305",
"0.5185612",
"0.5169016",
"0.5163574... | 0.63164693 | 0 |
DELETE /normas/1 DELETE /normas/1.xml | def destroy
@norma = Norma.find(params[:id])
@norma.destroy
respond_to do |format|
format.html { redirect_to(normas_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def delete()\n response = send_post_request(@xml_api_del... | [
"0.6808671",
"0.6708888",
"0.66801244",
"0.65826946",
"0.6489992",
"0.6474245",
"0.6465759",
"0.643621",
"0.6430296",
"0.6420173",
"0.64148337",
"0.6396787",
"0.6392645",
"0.6378127",
"0.63672113",
"0.6328987",
"0.6327253",
"0.6316562",
"0.6308252",
"0.630362",
"0.62990457",
... | 0.7091317 | 0 |
Implementation of enter that calls transform for the traversed node. | def enter(node, depth)
transform(node)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter(node, depth)\n method_name = \"enter_#{node.node_type}\"\n if respond_to?(method_name)\n send method_name, *[node, depth][0...method(method_name).arity]\n end\n end",
"def enter!\n @state_machine.current_state = self\n\n @entry_actions.each do |entry_action|\n ... | [
"0.61757076",
"0.6017361",
"0.5895592",
"0.5875677",
"0.5745028",
"0.5711508",
"0.56742907",
"0.5654039",
"0.5636795",
"0.56204844",
"0.56087005",
"0.5576442",
"0.5523049",
"0.5387376",
"0.5378495",
"0.5367927",
"0.5302114",
"0.52514416",
"0.5190156",
"0.5173956",
"0.51664746... | 0.8140209 | 0 |
Called to do the actual transformation of the source node into the target node. Delegates to transform_ if possible. The default implementation does nothing. | def transform(source)
method_name = "transform_#{source.node_type}"
if respond_to?(method_name)
send method_name, source
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform\n # Pass through\n @target.transform\n end",
"def transform!\n raise NotImplementedError, \"You have to implement #transform! in your transformer\"\n end",
"def on_transform(&blk)\n @transform_handler = blk\n self\n end",
"def apply_transform(tree)\n ... | [
"0.7162967",
"0.68824023",
"0.6370784",
"0.62922126",
"0.6219303",
"0.6169243",
"0.61490166",
"0.61447185",
"0.6142655",
"0.6130794",
"0.6084592",
"0.6078942",
"0.5989419",
"0.5890639",
"0.58786696",
"0.5809969",
"0.57800615",
"0.57622427",
"0.5747481",
"0.5732751",
"0.573275... | 0.72962856 | 0 |
Copies the given node into the resulting tree. Includes all attributes and the schema if the given node has one. | def copy_node!(source)
child! source.node_type, source.attributes.merge({ __location: source })
if source.has_schema?
current.instance_variable_set(:@schema, source.instance_variable_get(:@schema))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_node(original_node); end",
"def cloneAll(node,bodyStack = @defaultBodyStack,substp = FALSE)\n newnode = node.clone() ;\n if(node.kind_of?(Element)) then\n node.each { |e|\n\tnewnode.add(cloneAll(e,bodyStack,substp)) ;\n }\n node.attributes.each {|key,attr|\n\tif(substp) then\n\t tr... | [
"0.5966918",
"0.57801753",
"0.5695705",
"0.55888534",
"0.55888534",
"0.5400525",
"0.53995043",
"0.53410506",
"0.53191376",
"0.53113985",
"0.52819824",
"0.5266566",
"0.52406824",
"0.5237756",
"0.5230825",
"0.5198472",
"0.5124338",
"0.507509",
"0.5050429",
"0.50025773",
"0.5002... | 0.73058796 | 0 |
GET /gene_names/1 GET /gene_names/1.json | def show
@gene_name = GeneName.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @gene_name }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @gene_name = GeneName.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gene_name }\n end\n end",
"def get_name(somegeneID)\n if self.gene_id.include? somegeneID\n return self.gene_name[self.gene_id.index(somegeneID)]\n end\n end",... | [
"0.6523728",
"0.61929667",
"0.6125455",
"0.60814244",
"0.5992108",
"0.5892785",
"0.5817058",
"0.57419527",
"0.5666294",
"0.56337494",
"0.5576316",
"0.55585",
"0.55035657",
"0.54977834",
"0.549643",
"0.549643",
"0.54895884",
"0.54817843",
"0.5468246",
"0.5441415",
"0.5419633",... | 0.7313697 | 0 |
GET /gene_names/new GET /gene_names/new.json | def new
@gene_name = GeneName.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @gene_name }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @gene_name = GeneName.new(params[:gene_name])\n\n respond_to do |format|\n if @gene_name.save\n format.html { redirect_to @gene_name, notice: 'Gene name was successfully created.' }\n format.json { render json: @gene_name, status: :created, location: @gene_name }\n else\n... | [
"0.7128864",
"0.68376195",
"0.6492006",
"0.63031137",
"0.628574",
"0.61504453",
"0.61068916",
"0.60997087",
"0.59849834",
"0.59618896",
"0.59547",
"0.59159017",
"0.59066784",
"0.5890762",
"0.58803785",
"0.58633363",
"0.58529395",
"0.585156",
"0.5829858",
"0.58291864",
"0.5823... | 0.7757667 | 0 |
POST /gene_names POST /gene_names.json | def create
@gene_name = GeneName.new(params[:gene_name])
respond_to do |format|
if @gene_name.save
format.html { redirect_to @gene_name, notice: 'Gene name was successfully created.' }
format.json { render json: @gene_name, status: :created, location: @gene_name }
else
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @gene = Gene.new(gene_params)\n\n respond_to do |format|\n if @gene.save\n format.html { redirect_to @gene, notice: 'Gene was successfully created.' }\n format.json { render :show, status: :created, location: @gene }\n else\n format.html { render :new }\n fo... | [
"0.61724555",
"0.6016811",
"0.5987025",
"0.5412203",
"0.52780473",
"0.52758086",
"0.5190906",
"0.5107133",
"0.51040596",
"0.50974673",
"0.5056585",
"0.5034397",
"0.5033198",
"0.5006084",
"0.500223",
"0.4999419",
"0.49969375",
"0.49883807",
"0.4952977",
"0.49338788",
"0.490672... | 0.6964618 | 0 |
PUT /gene_names/1 PUT /gene_names/1.json | def update
@gene_name = GeneName.find(params[:id])
respond_to do |format|
if @gene_name.update_attributes(params[:gene_name])
format.html { redirect_to @gene_name, notice: 'Gene name was successfully updated.' }
format.json { head :no_content }
else
format.html { render acti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @gene.update(gene_params)\n format.html { redirect_to @gene, notice: 'Gene was successfully updated.' }\n format.json { render :show, status: :ok, location: @gene }\n else\n format.html { render :edit }\n format.json { render json: @... | [
"0.62671185",
"0.6239912",
"0.587007",
"0.57803935",
"0.57526296",
"0.56994194",
"0.5681606",
"0.56784767",
"0.56206864",
"0.56084037",
"0.56005967",
"0.55686736",
"0.5527372",
"0.55206954",
"0.55136704",
"0.5508712",
"0.5504186",
"0.54551697",
"0.5424152",
"0.54077333",
"0.5... | 0.7108051 | 0 |
DELETE /gene_names/1 DELETE /gene_names/1.json | def destroy
@gene_name = GeneName.find(params[:id])
@gene_name.destroy
respond_to do |format|
format.html { redirect_to gene_names_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @gene.destroy\n respond_to do |format|\n format.html { redirect_to genes_url, notice: 'Gene was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gid2name = Gid2name.find(params[:id])\n @gid2name.destroy\n\n respond_to do |forma... | [
"0.7046045",
"0.66885334",
"0.6572183",
"0.65706766",
"0.6563253",
"0.65061414",
"0.6476887",
"0.6476887",
"0.6461873",
"0.64480096",
"0.642958",
"0.64083153",
"0.6388026",
"0.62649286",
"0.62568575",
"0.62134457",
"0.6202229",
"0.619262",
"0.6091542",
"0.6087188",
"0.6071824... | 0.7675884 | 0 |
method to rearrange facts returned from puppetdb so that the key for 'value' is the fact name instead of the literal string 'value' and deletes the entry for 'name' | def format_facts(array, factname)
array.each do |h|
h.store(factname, h.delete('value'))
h.delete('name')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(name)\n name = name.to_sym\n if @values.key? name\n delete_name name\n @values.delete name\n end\n end",
"def unstore_fact(object) \n @bot.debug \"Unstoring #{object}\"\n query = config[:dbh].prepare \"DELETE FROM facts WHERE object=?\"\n query.execute object\n\n query ... | [
"0.58825797",
"0.54602957",
"0.54552096",
"0.53699535",
"0.5323647",
"0.5296735",
"0.52723265",
"0.5270282",
"0.52649075",
"0.5258038",
"0.5246185",
"0.5246185",
"0.5234265",
"0.52162075",
"0.5201379",
"0.51188725",
"0.51148087",
"0.51043636",
"0.5086966",
"0.5076144",
"0.507... | 0.6853401 | 0 |
method to merge arrays of hashes on a common field | def merge_hasharray(array1, array2, commonfield)
xref = {}
array2.each { |hash| xref[hash[commonfield]] = hash }
array1.each do |hash|
next if xref[hash[commonfield]].empty?
xref[hash[commonfield]].each_pair do |kk, vv|
next if commonfield == kk
hash[kk] = vv
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concat_merge original\n {}.tap do |result|\n original.each do |element|\n element.each_pair do |key, value|\n if value.is_a?(Array)\n result[key] ||= []\n result[key].concat value\n merge_if_equals(result[key])\n ... | [
"0.7185269",
"0.71112937",
"0.70626235",
"0.70444024",
"0.6896376",
"0.6871923",
"0.6836876",
"0.6836326",
"0.6812399",
"0.6811324",
"0.67422193",
"0.6689892",
"0.6644896",
"0.65271825",
"0.6498335",
"0.6489018",
"0.64767134",
"0.6463658",
"0.64213955",
"0.63873994",
"0.63410... | 0.7797683 | 0 |
method to make a hacky json inventory for Ansible | def hacky_json(nodes)
meta = {}
hosts = []
nodes.each do |node|
hosts.push(node['fqdn'])
meta[node['fqdn']] = { 'ansible_host' => node['ipaddress'] }
end
meta = { '_meta' => { 'hostvars' => meta } }
hosts = { 'all' => { 'hosts' => hosts } }
JSON.generate(hosts.merge(meta))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_inventory\n inventory = { 'all' => { 'hosts' => {} } }\n jack.each(kind: 'system') do |system|\n if options[:use_ip]\n iface = jack.fetch(kind: 'ipv4_interface',\n all?: { 'net.dns.fqdn' => system['net.dns.fqdn'] })\n ip = { 'ansible_host' => iface['ne... | [
"0.6750007",
"0.64115524",
"0.64115524",
"0.6111257",
"0.6083967",
"0.6029376",
"0.5920944",
"0.5916045",
"0.5763866",
"0.572963",
"0.5635833",
"0.5578304",
"0.55680144",
"0.55456483",
"0.5505147",
"0.5480267",
"0.5477722",
"0.54776424",
"0.5474821",
"0.54711664",
"0.5466885"... | 0.6420255 | 1 |
use the highest value found in our cache of avg_24_hours | def choose_suitable_avg_24_hours
expose_selected_values(:avg_24_hours).max
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max24hr_rec(ints)\n max24help(ints.sort) #O(4log4)=> 2.5 on ave 16 at worst\nend",
"def average(difficulty=1.0, hashrate=1)\n difficulty = current_difficulty\n hashrate = hash_per_second * 1024 * 1024 * 1024\n # Todo: find the current value for foo (seconds?)\n average_foo = eval(\"#{difficulty}... | [
"0.61861575",
"0.6152579",
"0.6047828",
"0.579395",
"0.5773138",
"0.57239884",
"0.5700676",
"0.5681136",
"0.56599873",
"0.5643403",
"0.5555947",
"0.5542025",
"0.55341023",
"0.5533211",
"0.5490417",
"0.5489318",
"0.5487585",
"0.54781145",
"0.54575014",
"0.54535234",
"0.5432349... | 0.715428 | 0 |
GET /brigade_memberships/1 GET /brigade_memberships/1.json | def show
brigade = Brigade.find(params[:brigade_id])
@brigade_membership = brigade.brigade_memberships.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @membership = Adhocracy::Membership.find(params[:id])\n\n render json: @membership\n end",
"def GetMembership id\n\n APICall(path: \"group_memberships/#{id}.json\")\n\n end",
"def index\n @memberships = @user.memberships\n end",
"def show\n\n respond_to do |fo... | [
"0.6927647",
"0.6885264",
"0.67561066",
"0.6717465",
"0.6666008",
"0.66342163",
"0.6618249",
"0.6583743",
"0.65564793",
"0.6553806",
"0.65480375",
"0.64969146",
"0.64969146",
"0.64969146",
"0.6478067",
"0.6477985",
"0.64609075",
"0.64442027",
"0.6339653",
"0.62985045",
"0.627... | 0.7168519 | 0 |
POST /brigade_memberships POST /brigade_memberships.json | def create
brigade = Brigade.find(params[:brigade_id])
@brigade_membership = brigade.brigade_memberships.create(brigade_membership_params)
respond_to do |format|
if @brigade_membership.save
format.html { redirect_to brigade_brigade_memberships_url, notice: 'Brigade membership was successfully... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateMembership params = {}\n \n APICall(path: 'group_memberships.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n #sanity checks, can only modify memberships that you own\n if params[:user_id].to_i != current_user.id then\n render json: {message:'Y... | [
"0.7416727",
"0.73998725",
"0.71063167",
"0.69991755",
"0.6829126",
"0.6822624",
"0.68153",
"0.6797499",
"0.67934155",
"0.6789455",
"0.674693",
"0.6669678",
"0.6652666",
"0.6620921",
"0.6614524",
"0.6540361",
"0.653778",
"0.65145373",
"0.64882565",
"0.6462233",
"0.64237595",
... | 0.7474953 | 0 |
PATCH/PUT /brigade_memberships/1 PATCH/PUT /brigade_memberships/1.json | def update
brigade = Brigade.find(params[:brigade_id])
@brigade_membership = brigade.brigade_memberships.find(params[:id])
respond_to do |format|
if @brigade_membership.update(brigade_membership_params)
format.html { redirect_to brigade_brigade_memberships_url, notice: 'Brigade membership was... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n authorize @organization_membership\n\n if @organization_membership.update(organization_membership_update_params)\n head :no_content\n else\n render json: @organization_membership.errors, status: :unprocessable_entity\n end\n end",
"def UpdateMembership params = {}\n \n ... | [
"0.66806126",
"0.66594344",
"0.6618375",
"0.6562799",
"0.6548472",
"0.65317965",
"0.6528354",
"0.64818823",
"0.64818823",
"0.64818823",
"0.64818823",
"0.64818823",
"0.64496964",
"0.64355224",
"0.642475",
"0.64119613",
"0.62516755",
"0.6248656",
"0.624579",
"0.6229899",
"0.622... | 0.73531294 | 0 |
DELETE /brigade_memberships/1 DELETE /brigade_memberships/1.json | def destroy
brigade = Brigade.find(params[:brigade_id])
@brigade_membership = brigade.brigade_memberships.find(params[:id])
@brigade_membership.destroy
respond_to do |format|
format.html { redirect_to brigade_brigade_memberships_url, notice: 'Brigade membership was successfully destroyed.' }
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @tribal_membership.destroy\n respond_to do |format|\n format.html { redirect_to tribal_memberships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @band_membership = BandMembership.find(params[:id])\n @band_membership.destroy\n\n respond_to do |for... | [
"0.7470196",
"0.7281869",
"0.7260003",
"0.72548515",
"0.72548515",
"0.71653414",
"0.7135157",
"0.7053886",
"0.7029465",
"0.7007146",
"0.69640875",
"0.69522524",
"0.6949805",
"0.69477904",
"0.6911123",
"0.68736047",
"0.68141466",
"0.68113124",
"0.67352253",
"0.67142",
"0.67009... | 0.75529 | 0 |
Builds the audit configuration as a hash | def build
{ audit: @config }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_config_audit(eh)\n if controller_name == \"ops\" && @sb[:active_tab] == \"settings_server\"\n server = MiqServer.find(@sb[:selected_server_id])\n message = \"Server [#{server.name}] (#{server.id}) in Zone [#{server.my_zone}] VMDB config updated\"\n else\n message = \"VMDB config upda... | [
"0.65356696",
"0.63442874",
"0.62737966",
"0.62154245",
"0.615035",
"0.6049359",
"0.6049359",
"0.6045917",
"0.600022",
"0.600022",
"0.5992351",
"0.5975883",
"0.5943585",
"0.58664787",
"0.58277136",
"0.5798916",
"0.576725",
"0.57396424",
"0.57336843",
"0.5659829",
"0.558553",
... | 0.8067966 | 0 |
GET /keeps GET /keeps.json | def index
@keeps = current_user.keeps
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @keep.destroy\n respond_to do |format|\n format.html { redirect_to keeps_url, notice: 'Keep was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def keep\n __flag__ :keep\n end",
"def create\n @keep = current_user.keeps.new(keep_params)\n... | [
"0.61826485",
"0.5939061",
"0.578585",
"0.5736232",
"0.5604894",
"0.55700713",
"0.55409604",
"0.5297712",
"0.5288494",
"0.52320296",
"0.514387",
"0.5052219",
"0.5008525",
"0.4967727",
"0.495026",
"0.4914129",
"0.48160097",
"0.48013148",
"0.47971484",
"0.47622234",
"0.47618657... | 0.6799335 | 0 |
POST /keeps POST /keeps.json | def create
@keep = current_user.keeps.new(keep_params)
respond_to do |format|
if @keep.save
format.html { redirect_to @keep, notice: 'Keep was successfully created.' }
format.json { render :show, status: :created, location: @keep }
else
format.html { render :new }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keep_params\n params.require(:keep).permit(:name, :note)\n end",
"def destroy\n @keep.destroy\n respond_to do |format|\n format.html { redirect_to keeps_url, notice: 'Keep was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @keeps = cu... | [
"0.63878644",
"0.6159866",
"0.6089544",
"0.59637654",
"0.5772348",
"0.5732716",
"0.5611234",
"0.54059875",
"0.5142877",
"0.5059239",
"0.5031172",
"0.502622",
"0.4993139",
"0.49844244",
"0.49567896",
"0.49027336",
"0.48594236",
"0.48133045",
"0.47660825",
"0.47459084",
"0.4713... | 0.65362144 | 0 |
PATCH/PUT /keeps/1 PATCH/PUT /keeps/1.json | def update
respond_to do |format|
if @keep.update(keep_params)
format.html { redirect_to @keep, notice: 'Keep was successfully updated.' }
format.json { render :show, status: :ok, location: @keep }
else
format.html { render :edit }
format.json { render json: @keep.errors,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keep_params\n params.require(:keep).permit(:name, :note)\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n if @bookkeeping.update(bookkeeping_params)\n ... | [
"0.6169629",
"0.5838606",
"0.58272153",
"0.5804568",
"0.56894994",
"0.56139165",
"0.5543352",
"0.5519432",
"0.5514486",
"0.5481023",
"0.5462124",
"0.5448219",
"0.5445128",
"0.5445128",
"0.53900695",
"0.5244469",
"0.52325255",
"0.522228",
"0.52157545",
"0.51975554",
"0.5197555... | 0.6775914 | 0 |
DELETE /keeps/1 DELETE /keeps/1.json | def destroy
@keep.destroy
respond_to do |format|
format.html { redirect_to keeps_url, notice: 'Keep was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete path\n make_request(p... | [
"0.6477453",
"0.63981193",
"0.6344374",
"0.63188684",
"0.62339234",
"0.6199888",
"0.6199843",
"0.61940086",
"0.6188869",
"0.6167954",
"0.6146313",
"0.61321557",
"0.61170363",
"0.61096305",
"0.6093699",
"0.6093699",
"0.6093699",
"0.6093699",
"0.6093699",
"0.6093699",
"0.609369... | 0.7112117 | 0 |
POST /admin/seasons POST /admin/seasons.json | def create
@admin_season = Season.new(admin_season_params)
respond_to do |format|
if @admin_season.save
format.html { redirect_to @admin_season, success: 'Season was successfully created.' }
format.json { render :show, status: :created, location: @admin_season }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @season = Season.new(season_params)\n\n if @season.save\n render :show, status: :created\n else\n render json: @season.errors, status: :unprocessable_entity\n end\n end",
"def create\n @season = Season.new(season_params)\n\n respond_to do |format|\n if @season.save\... | [
"0.76837736",
"0.7523077",
"0.7463524",
"0.7298656",
"0.7272153",
"0.7209834",
"0.7198521",
"0.7117333",
"0.7105351",
"0.70489275",
"0.7010434",
"0.7005163",
"0.6982686",
"0.69234407",
"0.69234407",
"0.69234407",
"0.689465",
"0.6885727",
"0.6819873",
"0.6817382",
"0.681178",
... | 0.7867362 | 0 |
PATCH/PUT /admin/seasons/1 PATCH/PUT /admin/seasons/1.json | def update
respond_to do |format|
if @admin_season.update(admin_season_params)
format.html { redirect_to @admin_season, success: 'Season was successfully updated.' }
format.json { render :show, status: :ok, location: @admin_season }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @season.update(season_params)\n render :show, status: :ok\n else\n render json: @season.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_with @season.update(season_params)\n end",
"def update\n respond_to do |format|\n if @season.upda... | [
"0.72138053",
"0.71359223",
"0.70761573",
"0.7051942",
"0.6991588",
"0.6871768",
"0.6759073",
"0.6624852",
"0.63472354",
"0.6291078",
"0.6265505",
"0.6259548",
"0.6250065",
"0.6246902",
"0.62152296",
"0.6158318",
"0.6158318",
"0.6158318",
"0.6158318",
"0.6152593",
"0.6124393"... | 0.7618151 | 0 |
DELETE /admin/seasons/1 DELETE /admin/seasons/1.json | def destroy
@admin_season.destroy
respond_to do |format|
format.html { redirect_to admin_seasons_url, success: 'Season was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n # @season = Season.find(params[:id])\n # @season.destroy\n\n respond_to do |format|\n format.html { redirect_to seasons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @season = Season.find(params[:id])\n @season.destroy\n\n respond_to do |forma... | [
"0.7915161",
"0.7884197",
"0.7858903",
"0.7802964",
"0.7740253",
"0.76941186",
"0.7636819",
"0.75907576",
"0.73634756",
"0.7242498",
"0.70923734",
"0.7075628",
"0.70716405",
"0.7067745",
"0.70570636",
"0.7053149",
"0.70393634",
"0.70211005",
"0.70117146",
"0.6993472",
"0.6988... | 0.8084412 | 0 |
Update the visibility of the work to match the correct state of the embargo, then clear the embargo date, etc. Saves the embargo and the work | def destroy
case work
when Valkyrie::Resource
embargo_manager = Hyrax::EmbargoManager.new(resource: work)
return if embargo_manager.embargo.embargo_release_date.blank?
embargo_manager.deactivate!
work.embargo = Hyrax.persister.save(resource: embargo_manager.embar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deactivate_embargo!\n return if embargo.nil?\n # embargo.deactivate! whipes out work.visibility_after_embargo before it can be applied, so save it and apply it\n vis_after = visibility_after_embargo\n vis_after = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATE... | [
"0.5976257",
"0.59403116",
"0.5825746",
"0.56778425",
"0.5637207",
"0.56207114",
"0.5617127",
"0.5612085",
"0.54693437",
"0.5466499",
"0.54524815",
"0.5413655",
"0.5394189",
"0.5387808",
"0.537591",
"0.5370347",
"0.5364161",
"0.5341061",
"0.53320587",
"0.53238064",
"0.5314773... | 0.6435617 | 0 |
Returns all helper classes under the Hyde::Helpers module. | def get_helpers
Hyde::Helpers.constants.inject([Hyde::Helpers]) do |a, constant|
mod = Hyde::Helpers.const_get(constant)
a << mod if mod.is_a? Module
a
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_app_helper_classes\n klasses = []\n expression = \"#{Jets.root}app/helpers/**/*\"\n Dir.glob(expression).each do |path|\n next unless File.file?(path)\n class_name = path.sub(\"#{Jets.root}app/helpers/\",\"\").sub(/\\.rb/,'')\n unless class_name == \"applica... | [
"0.8000439",
"0.7471334",
"0.7220933",
"0.71666306",
"0.7035728",
"0.6984757",
"0.6959735",
"0.6859301",
"0.67870086",
"0.67782754",
"0.6773248",
"0.6769744",
"0.6736882",
"0.6736882",
"0.6736882",
"0.6736882",
"0.6625418",
"0.6603668",
"0.6567974",
"0.65569323",
"0.65351605"... | 0.8618396 | 0 |
get the class eav attributes | def class_eav_attributes
self.class.class_eav_attributes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_attributes; end",
"def attrs\n self.class.attrs\n end",
"def attributes\n self.class::ATTRIBUTES\n end",
"def class_attributes\n @__class_attributes\n end",
"def attributes\n self.class.class_variable_get(:@@attributes)\n end",
"def attr_info; end",
... | [
"0.78152573",
"0.74947804",
"0.74825466",
"0.7437369",
"0.7332412",
"0.7282562",
"0.7260009",
"0.7175514",
"0.7144768",
"0.7137381",
"0.7137381",
"0.709971",
"0.709194",
"0.70870787",
"0.70865947",
"0.707456",
"0.7071141",
"0.7063033",
"0.7062979",
"0.7024419",
"0.7016693",
... | 0.8413792 | 0 |
get all the eav attribute instances available for this model instance eg: if you model says 'has_eav :through => :post_attribute' these are all PostAttribute's | def eav_attributes
@eav_attributes ||= eav_class.all(
:conditions => { self_key => self.id }
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eav_attributes_list # :nodoc:\n (\n self.instance_eav_attributes + self.class_eav_attributes.keys\n ).collect { |attribute| attribute.to_s }.uniq\n end",
"def instance_eav_attributes\n []\n end",
"def class_eav_attributes\n self.class.class_eav_a... | [
"0.7160483",
"0.71404773",
"0.6560422",
"0.62237036",
"0.6057279",
"0.6022066",
"0.6004467",
"0.5991975",
"0.5979192",
"0.5960487",
"0.5939792",
"0.58464634",
"0.58055544",
"0.57552516",
"0.5714781",
"0.57125956",
"0.5695753",
"0.56900287",
"0.56176496",
"0.5597341",
"0.55913... | 0.72051424 | 0 |
save the list of eav_attribute back to the database | def save_eav_attributes # :nodoc:
eav_attributes.select { |a| a.changed? }.each do |a|
if a.new_record?
a.send( :write_attribute, self_key, self.id )
end
a.save!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_save_list\n save_list.each do |obj|\n obj.save!\n end\n end",
"def store_values\n self.parent.write_attribute(self.field_name, self.ids)\n end",
"def save_flex_attributes\n @save_flex_attr ||= []\n attribute_class = self.flex_options[:class_name].constantize\n... | [
"0.6415177",
"0.6237235",
"0.61945754",
"0.6173415",
"0.6088706",
"0.6061614",
"0.5941664",
"0.5883169",
"0.58692884",
"0.5864993",
"0.5863809",
"0.57627577",
"0.5724682",
"0.5711941",
"0.56883806",
"0.5686315",
"0.5654714",
"0.5646488",
"0.5631958",
"0.5616012",
"0.55745417"... | 0.7276086 | 0 |
destroy eav_attributes from database | def destroy_eav_attributes # :nodoc:
eav_class.send :delete_all, "#{self_key} = #{self.id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n row.delete_attribute(attr_name)\n row.save\n end",
"def destroy\n @exp_attribute.destroy\n end",
"def destroy\n @image_attrib.destroy\n end",
"def destroy\n @attr_val = AttrVal.find(params[:id])\n @attr_val.destroy\n \n respond_to do |format|\n format... | [
"0.7304668",
"0.72847164",
"0.71885896",
"0.7016078",
"0.68958515",
"0.6863548",
"0.67528373",
"0.66602373",
"0.66602373",
"0.66602373",
"0.66602373",
"0.6653157",
"0.66492736",
"0.6625578",
"0.66135097",
"0.6468355",
"0.64663786",
"0.64618444",
"0.6456652",
"0.64319843",
"0.... | 0.83372605 | 0 |
override changed if any of the eav_attributes has changed, the object has changed. | def changed?
eav_attributes.each do |attribute|
return true if ( attribute.changed? || attribute.new_record? )
end
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_eav_attributes # :nodoc:\n eav_attributes.select { |a| a.changed? }.each do |a|\n if a.new_record?\n a.send( :write_attribute, self_key, self.id )\n end\n\n a.save!\n end\n end",
"def changed_attributes\n @_hr_changed.select{|k,... | [
"0.68536747",
"0.64793795",
"0.64159346",
"0.63754934",
"0.6277467",
"0.6277467",
"0.6178014",
"0.6160696",
"0.61295795",
"0.6078641",
"0.60720426",
"0.5986306",
"0.5982237",
"0.5976874",
"0.5960141",
"0.59529346",
"0.5917471",
"0.59070575",
"0.5902903",
"0.58974177",
"0.5877... | 0.72777396 | 0 |
get a complete list of eav_attributes (class + instance) | def eav_attributes_list # :nodoc:
(
self.instance_eav_attributes + self.class_eav_attributes.keys
).collect { |attribute| attribute.to_s }.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance_eav_attributes\n []\n end",
"def class_eav_attributes\n self.class.class_eav_attributes\n end",
"def eav_attributes\n @eav_attributes ||= eav_class.all(\n :conditions => { self_key => self.id }\n )\n end",
"def attributes\n ... | [
"0.8126298",
"0.79447365",
"0.768488",
"0.71056926",
"0.6892443",
"0.67610013",
"0.6665689",
"0.6635092",
"0.6618549",
"0.6616941",
"0.66059387",
"0.6604837",
"0.6596148",
"0.6564673",
"0.6551039",
"0.64977753",
"0.6489918",
"0.64826006",
"0.64826006",
"0.6474307",
"0.6459152... | 0.84049815 | 0 |
cast an eav value to it's desired class | def cast_eav_value value, attribute # :nodoc:
attributes = self.class_eav_attributes.stringify_keys
return value unless attributes.keys.include?(attribute)
return value if attributes[attribute] == String # no need for casting
begin
# for core types [eg: Integer '12'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast_value(value)\n case value\n when String then decode_and_initialize(value)\n when Hash then extract_model_klass(value).new(value)\n when nil then value\n else\n raise_cast_error(value) unless value.class.ancestors.include?(StoreModel::Model)\n\n value\n ... | [
"0.7295181",
"0.7224626",
"0.720881",
"0.7150351",
"0.7137998",
"0.6998941",
"0.6989034",
"0.69835377",
"0.6951463",
"0.68612784",
"0.6808247",
"0.675752",
"0.6708058",
"0.6697641",
"0.6695794",
"0.6665635",
"0.6645443",
"0.6633784",
"0.65911055",
"0.65722615",
"0.6547955",
... | 0.8019697 | 0 |
Validate that the URIs I'm trying to connect belongs to the resource owner | def validate_owner(record, attribute, uris)
klass = Device
ids = find_ids(uris)
real = klass.in(id: ids).where(resource_owner_id: record.resource_owner_id)
expected = klass.in(id: ids)
not_owned_ids = expected.map(&:id) - real.map(&:id)
record.errors.add(attribute, "not owned with IDs #{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate\n unless self.uri.blank?\n self.uri = \"http://#{self.uri}\" unless URI.parse(self.uri).absolute? \n end\n rescue\n errors.add(:uri, \"malformed uri -- please check it\")\n end",
"def valid_uri?\n !self.contentable.blank? || !self.uri_path.blank?\n end",
"def is_resourc... | [
"0.6278455",
"0.6152992",
"0.5973217",
"0.5937367",
"0.5909034",
"0.58995324",
"0.589311",
"0.58857423",
"0.58768547",
"0.5851981",
"0.57891494",
"0.5778032",
"0.5773554",
"0.57326454",
"0.5732363",
"0.572513",
"0.57185817",
"0.57079214",
"0.5681624",
"0.56678855",
"0.5664241... | 0.68442744 | 0 |
process does all the heavy lifting adds any uncoded values discovered to the (global) uncoded_values_hash returns a hash with stats on coding | def process(uncoded_values_hash)
@uncoded = uncoded_values_hash
uncoded_encounters = find_uncoded_encounters()
uncoded_products = find_uncoded_products()
uncoded_problems = find_uncoded_problems()
uncoded_vital_results = find_uncoded_results("VitalSigns")
uncoded_test_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analysis\n hash = {}\n @array.each do |item|\n chars = item.chars.to_a - @used_chars\n\n chars.each do |char|\n if hash[char] == nil\n hash[char] = 1\n else\n hash[char] += 1\n end\n end\n end\n\n hash.sort_by { |_, v| -v... | [
"0.55653584",
"0.5561838",
"0.5543264",
"0.5535405",
"0.54895025",
"0.5467511",
"0.53762823",
"0.53375405",
"0.53164434",
"0.5315674",
"0.5291511",
"0.5252317",
"0.52290654",
"0.52205414",
"0.5196489",
"0.5189786",
"0.51835316",
"0.5161801",
"0.5158579",
"0.5117099",
"0.51115... | 0.7689453 | 0 |
Get Ship The user is prompted about the type of ship they want to pilot The user then names their ship and is given a rundown of it | def get_ship(ship_class_arg = nil, ship_name_arg=nil)
unless ship_class_arg && ship_name_arg
printf "FIRST MATE: Captain #{self.name}, what kind of ship is this?\n"
while self.ship == nil
printf "-- Please choose a class of ship from the following options.\n"
puts "| " + Ship.subclasses.join(' | ') +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_to_place(ship)\n\t\tputs \"\"\n\t\tputs \"Place your #{ship.name} (length: #{ship.length})...\"\n\t\tx, y = get_coordinate\n\t\tdirection = get_direction\n\t\treturn [{x: x, y: y}, direction]\n\tend",
"def get_ship_by_ship_id(ship_id_user)\n return UserShip.find_by(:ship_id => ship_id_user).ship... | [
"0.68076473",
"0.6481056",
"0.624608",
"0.61633563",
"0.6144363",
"0.60923386",
"0.60923386",
"0.60432434",
"0.58957744",
"0.5857203",
"0.58281213",
"0.5805428",
"0.57868016",
"0.57836396",
"0.5740101",
"0.5732825",
"0.57216907",
"0.5715721",
"0.56909066",
"0.5690762",
"0.565... | 0.7224335 | 0 |
GET /vicarages GET /vicarages.json | def index
@vicarages = Vicarage.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end",
"def index\n @cages = current_user.cages\n\n respond_to do |format|\n format.json { render json: @cages }\n end\n end",
"def index\n @vacancies = Vacancy.all_vacancies# current_user.vacanc... | [
"0.66836536",
"0.66616005",
"0.66490215",
"0.66050225",
"0.6453333",
"0.6431618",
"0.6334092",
"0.6291732",
"0.6291732",
"0.6287622",
"0.6238363",
"0.6232576",
"0.62299657",
"0.6198003",
"0.6190004",
"0.6184687",
"0.6144711",
"0.6120845",
"0.6109469",
"0.6091756",
"0.608947",... | 0.7630078 | 0 |
POST /vicarages POST /vicarages.json | def create
@vicarage = Vicarage.new(vicarage_params)
respond_to do |format|
if @vicarage.save
format.html { redirect_to @vicarage, success: 'La Vicaría fue <strong>registrada</strong> exitosamente.' }
format.json { render :show, status: :created, location: @vicarage }
else
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @vicarages = Vicarage.all\n end",
"def vicarage_params\n params.require(:vicarage).permit(:Name, :managers_id)\n end",
"def create\n @vestimentum = Vestimentum.new(vestimentum_params)\n\n respond_to do |format|\n if @vestimentum.save\n format.html { redirect_to @vestim... | [
"0.6139481",
"0.5851167",
"0.58339053",
"0.57551336",
"0.57540375",
"0.5737517",
"0.5734332",
"0.5733984",
"0.5679506",
"0.566419",
"0.56398666",
"0.5639556",
"0.5611052",
"0.56105006",
"0.5599188",
"0.5586084",
"0.5573076",
"0.55480474",
"0.55351573",
"0.5515732",
"0.551317"... | 0.6324902 | 0 |
PATCH/PUT /vicarages/1 PATCH/PUT /vicarages/1.json | def update
respond_to do |format|
if @vicarage.update(vicarage_params)
format.html { redirect_to @vicarage, success: 'La Vicaría fue <strong>modificada</strong> exitosamente.' }
format.json { render :show, status: :ok, location: @vicarage }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @api_v1_post_vote = PostVote.find(params[:id])\n\n res... | [
"0.62974554",
"0.62444955",
"0.6187228",
"0.618165",
"0.6171038",
"0.61633855",
"0.6161867",
"0.6106517",
"0.6105012",
"0.609331",
"0.609331",
"0.60928583",
"0.60643804",
"0.6047581",
"0.60459626",
"0.6043728",
"0.60352486",
"0.6026001",
"0.60226023",
"0.6021671",
"0.6006367"... | 0.6584362 | 0 |
Returns true for resources that behave like an array | def array?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array?\n false\n end",
"def returns_array?\n true\n end",
"def returns_array?\n true\n end",
"def returns_array?\n false\n end",
"def returns_array?\n false\n end",
"def returns_array?\n false\n end",
"def array?(item)\n ite... | [
"0.7287177",
"0.7043768",
"0.69712514",
"0.6965632",
"0.6965632",
"0.6913455",
"0.6846586",
"0.68010783",
"0.67592716",
"0.6724545",
"0.65788335",
"0.6558414",
"0.6540023",
"0.653822",
"0.6529569",
"0.65236795",
"0.643524",
"0.6390467",
"0.63739914",
"0.6365299",
"0.6315364",... | 0.7255584 | 1 |
Resources that don't include Fields or AssetFields return nil for fields | def fields
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_field_deserializers()\n return super.merge({\n \"resourceId\" => lambda {|n| @resource_id = n.get_string_value() },\n \"resourceName\" => lambda {|n| @resource_name = n.get_string_value() },\n \"resourceType\" => lambda {|n| @resource_... | [
"0.63337797",
"0.5906204",
"0.58706826",
"0.58599544",
"0.584018",
"0.5734528",
"0.5726361",
"0.5713535",
"0.5702535",
"0.5652184",
"0.5614438",
"0.5600042",
"0.5597079",
"0.55841076",
"0.55790764",
"0.5576986",
"0.5568455",
"0.5553374",
"0.5512703",
"0.5495264",
"0.5472933",... | 0.64128834 | 0 |
Returns the Environment ID | def environment_id
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def environment_id\n id\n end",
"def get_environment_id(client, name)\n\n self.info(\"Getting environment id from name '#{name}'\")\n \n message = { \"username\" => @resource[:connection]['username'], \"password\" => @resource[:connection]['password'], \"mainType\" => \"Environment\", ... | [
"0.88774675",
"0.7477829",
"0.70253795",
"0.6537735",
"0.65218514",
"0.6492551",
"0.6437663",
"0.63625264",
"0.6329534",
"0.6322968",
"0.62675273",
"0.6249405",
"0.6212033",
"0.6166963",
"0.61639905",
"0.6163196",
"0.6132946",
"0.60559934",
"0.60352176",
"0.60234153",
"0.5925... | 0.78839684 | 1 |
Get default_locale from client | def default_locale
client.default_locale
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_locale\n FastGettext.available_locales.first\n end",
"def default_locale\n @default_locale ||= self.languages.get_default.code.to_sym\n end",
"def default_locale\n return nil unless localized?\n u_lc = I18n.locale.to_sym\n available_locales.include?(u_lc) ? u_lc : avail... | [
"0.83433855",
"0.8173862",
"0.8166773",
"0.8095743",
"0.7869589",
"0.78432095",
"0.77822816",
"0.7604532",
"0.74338615",
"0.7410458",
"0.7392186",
"0.7349439",
"0.73442006",
"0.73125035",
"0.71855545",
"0.71363467",
"0.7124969",
"0.70983094",
"0.70591426",
"0.7023105",
"0.700... | 0.8771306 | 0 |
Ensure inherited classes pick up coercions | def update_coercions!
return if @coercions_updated
if superclass.respond_to? :property_coercions
@property_coercions = superclass.property_coercions.dup.merge(@property_coercions || {})
end
if superclass.respond_to? :sys_coercions
@sys_coercions = superc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coerce(other); end",
"def convert\n raise \"The convert method must be implemented by subclass!\"\n end",
"def strict_value_coercions; end",
"def inherited(klass); end",
"def inherited(klass); end",
"def inherited(subclass); end",
"def inherited(base); end",
"def inherited(subclass)\n... | [
"0.65102464",
"0.644977",
"0.6322858",
"0.6184876",
"0.6184876",
"0.6145347",
"0.6097982",
"0.59096855",
"0.5883548",
"0.5812501",
"0.5751588",
"0.5737549",
"0.5687527",
"0.56507003",
"0.56200624",
"0.5611901",
"0.56023496",
"0.56023496",
"0.55925745",
"0.5589005",
"0.5573787... | 0.6694255 | 0 |
Fetch the stack template | def stack_template_load(stack)
if(stack.persisted?)
result = request(
:endpoint => stack.custom.fetch(:manifest, stack.custom.get(:update, :manifest))
)
cache_template = stack.template = template_data_format(result[:body])
stack.custom = stack.cust... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_template(template); end",
"def get_template\n @template\n end",
"def fetch_template\n template_body = fetch_template_from_local_cache\n template_body ||= fetch_template_from_redis\n template_body ||= fetch_remote_template_and_store\n template_body ||= store_template_to_local_cache( self... | [
"0.7101934",
"0.70465076",
"0.68973947",
"0.6755051",
"0.6571939",
"0.655169",
"0.65463096",
"0.6540473",
"0.6535762",
"0.65352464",
"0.64819604",
"0.6416082",
"0.64151996",
"0.6405743",
"0.6394707",
"0.63887113",
"0.63826925",
"0.63473773",
"0.6345992",
"0.63356036",
"0.6303... | 0.73864704 | 0 |
Convert value to YAML if not string | def yamlize(value)
unless(value.is_a?(String))
if(value.is_a?(Hash) && value.respond_to?(:to_hash))
value = value.to_hash
end
value.to_yaml(:header => true)
else
value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode(value)\n value.to_yaml\n end",
"def encode(value)\n value.to_yaml\n end",
"def convert_value\n # Do nothing if value has not changed\n return true unless value_changed?\n # Cast the value and return success\n return parse_string_value(@uncast_value) if @uncast_value.is_a? String\... | [
"0.7177733",
"0.7177733",
"0.6996034",
"0.68543994",
"0.66615325",
"0.64646274",
"0.6410558",
"0.64088476",
"0.6400503",
"0.6400503",
"0.62958807",
"0.6258902",
"0.6179016",
"0.6161546",
"0.6064578",
"0.6059684",
"0.6043071",
"0.6043071",
"0.60403097",
"0.60242605",
"0.600048... | 0.72765696 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.