query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Never trust parameters from the scary internet, only allow the white list through. | def question_params
params.require(:question).permit(:title, :content,:question_id, :input, :output, :i_data,
:o_data, :question_level, :input_text, :output_text, :sample_input, :sample_output, :image, :for_contest)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Don't bother setting the global nav for requests with paths in GLOBAL_NAV_EXCLUSION_PATHS | def global_nav_required?
GLOBAL_NAV_EXCLUSION_PATHS.exclude?(request.path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disallowNavigation\n self.navigationAllowed = false\n end",
"def disallowNavigation\n self.navigationAllowed = false\n end",
"def disable_nav\n @disable_nav = true\n end",
"def disable_nav\n @disable_nav = true\n end",
"def nav_check\n @skip_nav = true\n end",
... | [
"0.63661104",
"0.63661104",
"0.6274898",
"0.6274898",
"0.6231092",
"0.60147476",
"0.5723562",
"0.56440014",
"0.5589143",
"0.55611134",
"0.55558586",
"0.5555002",
"0.5485673",
"0.5466116",
"0.54492694",
"0.54339266",
"0.54330736",
"0.53976405",
"0.53845394",
"0.5365566",
"0.53... | 0.8055565 | 0 |
Create a new entry. Takes +sandbox+ (currently an instance of Isolate::Sandbox), +name+ (as above), and any number of optional version requirements (generally strings). Options can be passed as a trailing hash. Wellknown keys: :args:: Commandline build arguments. Passed to the gem at installation time. :source:: An alternative RubyGems source for this gem. | def initialize sandbox, name, *requirements
@environments = []
@file = nil
@name = name
@options = {}
@requirement = Gem::Requirement.default
@sandbox = sandbox
if /\.gem$/ =~ @name && File.file?(@name)
@file = File.expand_path @name
@name = File.basename(@file, ".gem").
gsub(/-#{Gem::Version::VERSION_PATTERN}$/, "")
end
update(*requirements)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install\n old = Gem.sources.dup\n\n begin\n fire :installing, :installed do\n\n installer =\n Gem::DependencyInstaller.new(:development => false,\n :generate_rdoc => false,\n :generate_ri =>... | [
"0.5493991",
"0.52293444",
"0.52233887",
"0.5210027",
"0.5184256",
"0.5175381",
"0.5099611",
"0.50552714",
"0.50453615",
"0.5040255",
"0.5040084",
"0.5040084",
"0.5040084",
"0.5040084",
"0.5040084",
"0.5040084",
"0.5040084",
"0.5040084",
"0.5040084",
"0.5040084",
"0.5040084",... | 0.5944424 | 0 |
Activate this entry. Fires :activating and :activated. | def activate
fire :activating, :activated do
spec = self.specification
raise Gem::LoadError, "Couldn't resolve: #{self}" unless spec
spec.activate
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end",
"def activate\n\t\tupdate_attribute(:activated, true)\n\t\tupdate_attribute(:activated_at, Time.zone.now)\n\tend",
"def activate\n @activated = true\n sel... | [
"0.78803617",
"0.7857285",
"0.7788941",
"0.7788941",
"0.7788941",
"0.7788941",
"0.7788941",
"0.7788941",
"0.7788941",
"0.7788941",
"0.7788941",
"0.7788941",
"0.7788941",
"0.7788941",
"0.7788941",
"0.77790225",
"0.77152145",
"0.77152145",
"0.77152145",
"0.77152145",
"0.7715214... | 0.6616665 | 96 |
Install this entry in the sandbox. Fires :installing and :installed. | def install
old = Gem.sources.dup
begin
fire :installing, :installed do
installer =
Gem::DependencyInstaller.new(:development => false,
:generate_rdoc => false,
:generate_ri => false,
:install_dir => @sandbox.path)
Gem::Command.build_args = Array(options[:args]) if options[:args]
Gem.sources += Array(options[:source]) if options[:source]
installer.install @file || name, requirement
end
ensure
Gem.sources = old
Gem::Command.build_args = nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install(&block)\n @install = block\n end",
"def install!\n\t\t\t\treturn if @installed\n\t\t\t\t\n\t\t\t\t@mutex.synchronize do\n\t\t\t\t\treturn if @installed\n\t\t\t\t\t\n\t\t\t\t\tSignal.trap(@name, &self.method(:trigger))\n\t\t\t\t\t\n\t\t\t\t\t@installed = true\n\t\t\t\tend\n\t\t\t\t\n\t\t\t... | [
"0.67770857",
"0.67556924",
"0.67556924",
"0.66328865",
"0.65768015",
"0.6483277",
"0.6453046",
"0.6420984",
"0.6412345",
"0.63838315",
"0.63646144",
"0.63553125",
"0.632721",
"0.63172776",
"0.6257037",
"0.6203531",
"0.6203531",
"0.6168697",
"0.6162256",
"0.60951096",
"0.6095... | 0.6671931 | 3 |
Is this entry interested in +environment+? | def matches? environment
environments.empty? || environments.include?(environment)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env?(env)\n Merb.env == env.to_s\n end",
"def test_env?\n @test_environment\n end",
"def test?\n self.environment == ENV_TEST\n end",
"def gogrid_environment?(url = nil)\n url ||= self.url\n !!url.match(/cistages\\.fds/)\n end",
"def environment_valid?\n %w(test production d... | [
"0.6841977",
"0.68069774",
"0.6720004",
"0.6617754",
"0.65686756",
"0.6560758",
"0.64801556",
"0.6474634",
"0.64690423",
"0.6466501",
"0.6416938",
"0.64153177",
"0.6389145",
"0.63784873",
"0.6364847",
"0.6355383",
"0.6307896",
"0.6301594",
"0.6299013",
"0.62912697",
"0.628567... | 0.6908875 | 0 |
Is this entry satisfied by +spec+ (generally a Gem::Specification)? | def matches_spec? spec
name == spec.name and requirement.satisfied_by? spec.version
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matches_spec?(spec)\n return false unless name === spec.name\n return true if requirement.none?\n\n requirement.satisfied_by?(spec.version)\n end",
"def satisfied_by?(spec)\n return false unless requirement\n spec = ArtifactNamespace.to_hash(spec)\n hash = to_spec_hash\n ... | [
"0.8224392",
"0.8213441",
"0.81152993",
"0.78423816",
"0.74416727",
"0.7427321",
"0.7419791",
"0.74192053",
"0.74192053",
"0.73881775",
"0.7189265",
"0.7185206",
"0.7052977",
"0.7019704",
"0.7001798",
"0.69607556",
"0.6948839",
"0.69151646",
"0.69151646",
"0.69151646",
"0.691... | 0.8290276 | 0 |
The Gem::Specification for this entry or nil if it isn't resolveable. | def specification
Gem::Specification.find_by_name(name, requirement)
rescue Gem::LoadError
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem_spec\n if @gem_spec.nil?\n unless @gem_spec = Micro::Source.gem_spec(@name, @version_requirements.version)\n raise Micro::GemSpecMissingError, \"Unable to locate Gem::Specification for Gem::Dependency `#{self}'\"\n end\n end\n \n @gem_spec\n end",
"def spec\n... | [
"0.7456606",
"0.7203506",
"0.7182123",
"0.6577497",
"0.65375364",
"0.6515994",
"0.6513328",
"0.64430016",
"0.64202976",
"0.64128685",
"0.64122826",
"0.623607",
"0.6182502",
"0.6181073",
"0.61701053",
"0.60797703",
"0.60203403",
"0.601142",
"0.60063875",
"0.599895",
"0.5973525... | 0.8083931 | 0 |
Updates this entry's environments, options, and requirement. Environments and options are merged, requirement is replaced. Fires :updating and :updated. | def update *reqs
fire :updating, :updated do
@environments |= @sandbox.environments
@options.merge! reqs.pop if Hash === reqs.last
@requirement = Gem::Requirement.new reqs unless reqs.empty?
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @environments = args[:environments] if args.key?(:environments)\n end",
"def update!(**args)\n @modifications = args[:modifications] if args.key?(:modifications)\n end",
"def update!(*options)\n update(*options)\n save\n end",
"def upda... | [
"0.6328977",
"0.6056662",
"0.5895723",
"0.5833014",
"0.57868004",
"0.573948",
"0.5736595",
"0.57270336",
"0.5701579",
"0.5669315",
"0.56572574",
"0.56461823",
"0.5635436",
"0.56177765",
"0.5614591",
"0.55997086",
"0.55854017",
"0.55753374",
"0.55736995",
"0.5566315",
"0.55644... | 0.7560749 | 0 |
Tests Flow 3a > 3d > 4c > 4d4 Then sends same invoice again, with auth: 4c > 4d Then sends same invoice again with login | def test_send_invoice_flow_with_signup_and_no_sps
api_token, current_url, token_url = initiate_send_invoice('signup')
first_invoice = api_token.invoice
assert_not_nil first_invoice
current_user = nil
session_successfully_create_user(api_token, current_url) do |first_user|
current_user = first_user.current_user
assert_not_nil current_user
first_user.preview_invoice!
first_user.send_invoice!(true)
first_user.received_complete!(token_url)
end
reset!
assert_difference('Invoice.count') do
api_token, current_url, token_url = initiate_send_invoice('send_invoice', current_user.email)
end
second_invoice = api_token.invoice
assert_not_nil second_invoice
assert_not_equal first_invoice, second_invoice
first_invoice.reload
#assert_equal second_invoice, first_invoice.superceded_by
extended_session do |second_user|
second_user.get current_url
assert_equal current_user, second_user.current_user
second_user.redirect_to_new_delivery!
second_user.send_invoice!(true)
assert_last_delivery_had_no_errors
second_user.received_complete!(token_url)
end
reset!
assert_difference('Invoice.count') do
api_token, current_url, token_url = initiate_send_invoice('login')
end
third_invoice = api_token.invoice
second_invoice.reload
assert_not_equal second_invoice.id, third_invoice.id
assert_state(second_invoice, :sent)
assert_nil second_invoice.superceded_by
session_successfully_login(api_token, current_url, nil, current_user.email) do |third_user|
assert_equal current_user, third_user.current_user
second_invoice.reload
assert_state(second_invoice, :sent)
third_user.send_invoice!(true)
second_invoice.reload
assert_state(second_invoice, :superceded)
assert_equal second_invoice.superceded_by, third_invoice
assert_last_delivery_had_no_errors
third_user.received_complete!(token_url)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_send_invoice_flow_with_valid_auth_and_no_sps\n # make request without a start_status, should default to send_invoice\n api_token, current_url, token_url = initiate_send_invoice(nil, :authorized)\n extended_session do |user|\n user.get current_url\n user.redirect_to_new_delivery!\n ... | [
"0.69266635",
"0.654197",
"0.6450188",
"0.6285412",
"0.61220986",
"0.60673547",
"0.59640795",
"0.5876407",
"0.58623064",
"0.58457375",
"0.5843448",
"0.58026946",
"0.5768651",
"0.57596105",
"0.575189",
"0.57319343",
"0.5691063",
"0.5690724",
"0.5687766",
"0.56650615",
"0.56554... | 0.7579768 | 0 |
NOTE: the test named test_send_invoice_flow_with_login_and_no_sps was deleted because test_SA_login_clicks_complete_at_invoice_sent in send_invoice_browsal_status_test is identical. 4c > 4d | def test_send_invoice_flow_with_valid_auth_and_no_sps
# make request without a start_status, should default to send_invoice
api_token, current_url, token_url = initiate_send_invoice(nil, :authorized)
extended_session do |user|
user.get current_url
user.redirect_to_new_delivery!
reset_deliveries
user.send_invoice!(true)
assert_last_delivery_had_no_errors
user.received_complete!(token_url)
assert_equal [users(:basic_user).email], user.last_email.reply_to
assert_match(/To view this invoice/, user.email_text.body)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_send_invoice_flow_with_signup_and_no_sps\n api_token, current_url, token_url = initiate_send_invoice('signup')\n first_invoice = api_token.invoice\n assert_not_nil first_invoice\n current_user = nil\n session_successfully_create_user(api_token, current_url) do |first_user|\n current_us... | [
"0.7049857",
"0.65399927",
"0.63562113",
"0.6292715",
"0.6282795",
"0.62637544",
"0.62499183",
"0.62131",
"0.6205962",
"0.6205448",
"0.618778",
"0.6184838",
"0.6165371",
"0.61348385",
"0.6118332",
"0.61059356",
"0.6093111",
"0.6091437",
"0.60819185",
"0.6072734",
"0.6071886",... | 0.6677434 | 1 |
tests 3d>3f>4c with no change to payment settings, using back button on 3f | def test_send_invoice_flow_with_edit_gateways_than_back
api_token, current_url, token_url = initiate_send_invoice('signup')
session_successfully_create_user(api_token, current_url) do |user|
user.edit_user_gateways!
api_token.reload
assert_nil api_token.user.user_gateway
assert_nil api_token.user_gateway
user.assert_back_links
# should come back to 3d -- simulate back button
user.get "/users/#{ api_token.user_id }/thankyou"
user.assert_response :success
user.preview_invoice!
user.send_invoice!(true)
assert_last_delivery_had_no_errors
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def go_to_cart_wl\n @aux1 = $url[$url.length-2,$url.length].upcase\n if @aux1 == \"MX\"\n click_button 'AddToCart'\n sleep 2\n fill_in 'enter-zipcode-overlay-zipcode', :with => '06500'\n click_button 'Aceptar'\n sleep 5\n visit url_visit + '/checkout/finish/'\n elsif @aux1 == \"CL\... | [
"0.5877363",
"0.57812023",
"0.5559063",
"0.5525001",
"0.5525001",
"0.5512762",
"0.5479582",
"0.5442774",
"0.5407514",
"0.54052335",
"0.5404498",
"0.54035026",
"0.5366784",
"0.5350416",
"0.53430897",
"0.53354245",
"0.53333294",
"0.53275937",
"0.53200006",
"0.52754086",
"0.5266... | 0.54202574 | 8 |
tests 3d>3f>4c with adding payment settings. User starts with no payment gateway selected and enters one on 3f | def test_send_invoice_flow_with_edit_gateways_add_payment_credentials
api_token, current_url, token_url = initiate_send_invoice('signup')
session_successfully_create_user(api_token, current_url) do |user|
user.edit_user_gateways!
user.sign_up_for_beanstream!(api_token)
user.send_invoice_with_payment!(true, true, "brand_new_user@billingboss.com")
assert api_token.invoice.selected_payment_types.any?
assert_last_delivery_had_no_errors
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_success_cc_payment_page\r\n @u = users(:user_without_sps_gateway_settting)\r\n @user = watir_session.with(:user_without_sps_gateway_settting)\r\n @user.logs_in\r\n\r\n @invoice = invoices(:invoice_moneris_payment_cc)\r\n \r\n \r\n b = @user.b\r\n add_sps_cc_profile(:user_without_sp... | [
"0.65032077",
"0.64173716",
"0.61334395",
"0.6010661",
"0.60085",
"0.599742",
"0.59805626",
"0.5946549",
"0.59451085",
"0.5939947",
"0.5936757",
"0.5927241",
"0.5922605",
"0.59221274",
"0.5894891",
"0.5894891",
"0.5894891",
"0.5878936",
"0.58768463",
"0.58761984",
"0.58689564... | 0.6123471 | 3 |
tests 3d>3f>4c with change to payment settings. User starts with no paypal gateway selected and enters beanstream on 3f | def test_send_invoice_flow_with_edit_gateways_change_payment_credentials
api_token, current_url, token_url = initiate_send_invoice('signup', nil, :invoice => { :currency => 'USD' })
session_successfully_create_user(api_token, current_url) do |user|
user.edit_user_gateways!
api_token.reload
add_beanstream_gateway_to_user(api_token.user)
user.sign_up_for_sage_vcheck!(api_token)
user.send_invoice_with_payment!(true, true, "brand_new_user@billingboss.com")
assert api_token.invoice.selected_payment_types.any?
assert_last_delivery_had_no_errors
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rejected_cc_simulation\r\n @u = users(:user_without_sps_gateway_settting)\r\n @user = watir_session.with(:user_without_sps_gateway_settting)\r\n @user.logs_in\r\n \r\n \r\n b = @user.b\r\n @invoice = invoices(:invoice_moneris_payment_cc_two)\r\n add_sps_cc_profile(:user_without_sps... | [
"0.65342516",
"0.65298027",
"0.6499101",
"0.64509696",
"0.6320186",
"0.61985207",
"0.61650723",
"0.6136377",
"0.61332744",
"0.60900486",
"0.6071943",
"0.6060776",
"0.602617",
"0.6025798",
"0.6019812",
"0.6018679",
"0.5962872",
"0.5917329",
"0.5917202",
"0.58427244",
"0.584144... | 0.6077186 | 10 |
tests 3d>3f click go there to sign up now | def test_send_invoice_flow_with_click_go_there_now_link
api_token, current_url, token_url = initiate_send_invoice('signup', nil)
session_successfully_create_user(api_token, current_url) do |user|
user.edit_user_gateways!
html = Hpricot(user.response.body)
assert_not_nil html.at('#beanstream-go-there-now-link')
assert '/beanstream_help.html', html.at('#beanstream-go-there-now-link')['href']
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test02_D3LRT03\n\t\t$browser.goto($patch_login)\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_directory)\n\t\t$directory_title.fire_event(\"onclick\")\n\t\t\n\t\tsleep 2\n\t\tassert $browser.text.include? \"Directory Group\"\n\tend",
"def check_sign_up_button\n\n #page.should have_b... | [
"0.654613",
"0.6271919",
"0.6235223",
"0.620377",
"0.61789525",
"0.6039498",
"0.5993811",
"0.5991449",
"0.5939515",
"0.59243184",
"0.5881619",
"0.5864631",
"0.58220226",
"0.58028334",
"0.57753104",
"0.575362",
"0.5743798",
"0.5720679",
"0.5720679",
"0.5720679",
"0.5716431",
... | 0.0 | -1 |
Devise security improvements, used to invalidate old sessions on logout Taken from | def authenticatable_salt
"#{super}#{session_token}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_out_expired_session\n return unless current_user.present?\n return if current_user.last_sign_in_check.present? && current_user.last_sign_in_check <= 5.minutes.ago\n\n current_user.update last_sign_in_check: Time.now\n\n if UniversumSsoClient.signed_out?(current_user.uid)\n session[:user_i... | [
"0.7106362",
"0.69906163",
"0.6984609",
"0.6980861",
"0.6971168",
"0.6954659",
"0.69283247",
"0.69269115",
"0.6894049",
"0.6883636",
"0.68737674",
"0.687227",
"0.6851604",
"0.6843599",
"0.6830457",
"0.68123496",
"0.6804069",
"0.6768268",
"0.6768028",
"0.67539155",
"0.67502284... | 0.0 | -1 |
List of currently used countries | def set_countries
writer_arr = Writer.select("country_id").distinct.map{|c| c.country_id}
outlet_arr = Outlet.select("country_id").distinct.map{|c| c.country_id}
@current_countries = (outlet_arr + writer_arr).sort.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def country_list\n @countries ||= case kind\n when 'country' then\n zoneables\n when 'state' then\n zoneables.collect(&:country)\n when 'county'\n zone_member.zoneable.country_list\n ... | [
"0.79367137",
"0.78557867",
"0.7800376",
"0.77229315",
"0.76904136",
"0.76493895",
"0.7625632",
"0.76006067",
"0.7453087",
"0.74400085",
"0.73492897",
"0.73465765",
"0.7298082",
"0.7286302",
"0.7264752",
"0.7252554",
"0.72487926",
"0.72146595",
"0.7196246",
"0.71842396",
"0.7... | 0.61505747 | 81 |
These are the controllers methods that allow the user_name parameters to be passed through to the model, it inherits from the Devise class because that is the authentication system. I can create a user_name column, but I'm unable to sign in with my user name. I must still use the email. | def sign_up_params
params.require(:user).permit(:email, :user_name, :password,
:password_confirmation)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_name\n \"someone\"\n end",
"def set_user_name_field(user_name)\n end",
"def name\n username || email\n end",
"def name\n username || email\n end",
"def name\n \"#{self.class.name.titleize}: #{user.email rescue 'unknown user'}\"\n end",
"def username\n username = self.name + ... | [
"0.7208163",
"0.72059107",
"0.70668626",
"0.7066188",
"0.69949627",
"0.6929275",
"0.69061977",
"0.69061977",
"0.68849534",
"0.6860352",
"0.6860352",
"0.68514645",
"0.683826",
"0.6825366",
"0.6824719",
"0.6809585",
"0.6758542",
"0.6758542",
"0.67349035",
"0.6728368",
"0.672818... | 0.0 | -1 |
Creates a new object from data received from Aeries site. It creates a new empty object if no data is received. | def initialize(aeries_data = nil)
parse(aeries_data, @@aeries_attributes_list, @@setters_list) if aeries_data.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from data\n obj = new\n obj.decode data\n obj\n end",
"def new_from_response_data(response_data)\n object = StorageRoom.class_for_name(response_data['@type']).new.set_from_response_data(response_data)\n\n if object.is_a?(Entry) && !object.loaded? && !object.proxy?\n S... | [
"0.65906584",
"0.6582249",
"0.65168816",
"0.6496395",
"0.63993126",
"0.6338217",
"0.6338217",
"0.6338217",
"0.6338217",
"0.6338217",
"0.6338217",
"0.6338217",
"0.6338217",
"0.63131756",
"0.6305185",
"0.6289302",
"0.6279696",
"0.6194083",
"0.6181569",
"0.6117291",
"0.6112723",... | 0.57404864 | 63 |
Overrides 'inspect' method to show only created attributes | def inspect
model_inspect(@@setters_list)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect\n \"#<#{self.class} @attributes=#{@attributes.inspect}>\"\n end",
"def inspect\n att_info = []\n inspect_attributes.each do |att|\n next unless respond_to? att\n\n att_info << \"#{att}=#{send(att).inspect}\"\n end\n att_info << '..'\n \"\\#<#{self.class}... | [
"0.7465008",
"0.7320376",
"0.7073968",
"0.6957005",
"0.6917826",
"0.6906209",
"0.685819",
"0.6835383",
"0.68343353",
"0.683213",
"0.6802717",
"0.6800315",
"0.6797096",
"0.67068577",
"0.66899246",
"0.66649324",
"0.66423976",
"0.66324115",
"0.66097575",
"0.66049975",
"0.6596039... | 0.0 | -1 |
Returns a hash of attributes extracted from Aeries site | def attributes
model_attributes(@@setters_list)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def site_data_hash; end",
"def attributes_hash\n attributes_hash = section.attributes.to_hash\n attributes_hash.each { |k, attr| attributes_hash[k] = attr.value }\n end",
"def attributes\n scraper.attributes.keys + uri_response_attributes + [:feed]\n end",
"def extract_link_attributes(... | [
"0.6773042",
"0.6684836",
"0.66754043",
"0.6463395",
"0.6434525",
"0.6391793",
"0.6377733",
"0.6377733",
"0.6364287",
"0.63436544",
"0.63435435",
"0.63435435",
"0.6331658",
"0.6265466",
"0.6222941",
"0.62190455",
"0.6202684",
"0.6194643",
"0.619133",
"0.6108885",
"0.6097143",... | 0.0 | -1 |
Overrides parse to parse dates, create category object and standards array | def parse(aeries_data, aeries_attributes_list, setters_list)
super
self.date_assigned = DateTime.parse(date_assigned) unless date_assigned.nil?
self.date_due = DateTime.parse(date_due) unless date_due.nil?
self.due_time = DateTime.parse(due_time) unless due_time.nil?
category = assignment_category
self.assignment_category = AeriesNetApi::Models::AssignmentCategory.new(category)
standards_list = []
standards.each do |item|
standards_list << AeriesNetApi::Models::AssignmentStandard.new(item)
end
self.standards = standards_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_object_dates\n @ps_object.each_with_index do |object, i|\n object.each do |key, value|\n # here we are asking the format class if the value is a date in its\n # format. For Example, the json format class returns dates in the \n # following format: \"/Date(... | [
"0.6154791",
"0.6102863",
"0.6098249",
"0.60446066",
"0.602768",
"0.5969876",
"0.595933",
"0.5893325",
"0.586885",
"0.5841037",
"0.5821548",
"0.5819759",
"0.5797349",
"0.5793122",
"0.5791005",
"0.5650723",
"0.5646244",
"0.5624001",
"0.5566028",
"0.55369097",
"0.5522445",
"0... | 0.5741814 | 15 |
Returns a new QueryDigest Object | def initialize()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def digest\n query = Ox::Element.new(\"query\").tap do |element|\n element[:xmlns] = \"jabber:iq:auth\"\n\n digest_password = self.class.generate_digest(stream_id, password)\n\n element << (Ox::Element.new(\"username\") << jid.node)\n element << (Ox::Element.new(\"digest\... | [
"0.6708474",
"0.6687719",
"0.6362615",
"0.6100211",
"0.60800165",
"0.599919",
"0.59814525",
"0.59729415",
"0.5966838",
"0.59237504",
"0.5903189",
"0.58838224",
"0.57985723",
"0.5665922",
"0.5628386",
"0.56156886",
"0.5615546",
"0.5611955",
"0.5567925",
"0.55191356",
"0.551839... | 0.0 | -1 |
Will create the board nested array | def create_board(size, num_mines)
final_board = []
# Create outer loop
1.upto(size) do |row|
row_buffer = []
# Create inner loop
1.upto(size) do |column|
row_buffer << Square.new([column,((size+1)-row)], size)
end
# Once each row is composed add it to
# the final board.
final_board << row_buffer
end
set_mines(final_board, num_mines) # Now that we have the board, lets add some mines
final_board
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_board\n cols = Array.new(7) { Array.new(6, 0) }\n cols\n end",
"def nest_array(board)\n nested_board = []\n 9.times { nested_board << board.slice!(0..8)}\n return nested_board\nend",
"def make_board\n board = Array.new(8) { Array.new(8) { Array.new(2) } }\n board.each_with_index do |... | [
"0.80120015",
"0.7994644",
"0.77444977",
"0.7677119",
"0.7664886",
"0.7623185",
"0.7555054",
"0.7517799",
"0.7517799",
"0.7499501",
"0.7453332",
"0.7446112",
"0.7391639",
"0.73898077",
"0.7377826",
"0.7327349",
"0.72910446",
"0.71876216",
"0.71539754",
"0.714405",
"0.71174777... | 0.6594099 | 81 |
Add some mines to the board | def set_mines(board, num_mines)
until num_mines == 0
selection = board.sample.sample
if selection.mine # If the selection is already a mine
redo
else # If the selection isn't a mine
selection.make_mine # then make it a mine
num_mines -= 1 # and decrement the number of mines left.
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_surrounding_mines\n\t\t@board.flatten.each do |square|\n\t\t\tmine_count = 0\n\t\t\tsquare.adjacent_squares.each do |adj_square|\n\t\t\t\tmine_count += 1 if get_square(adj_square).mine == true\n\t\t\tend\n\t\t\tsquare.surrounding_mines=(mine_count)\n\t\tend\n\tend",
"def placing_mines\n @count = 0\n ... | [
"0.72081035",
"0.6992805",
"0.69526833",
"0.69088006",
"0.68011427",
"0.6715947",
"0.6599398",
"0.64726716",
"0.642475",
"0.6413336",
"0.6363244",
"0.6344933",
"0.63122606",
"0.6280877",
"0.6243498",
"0.6217338",
"0.61759204",
"0.6173044",
"0.61543846",
"0.6143455",
"0.613028... | 0.64386755 | 8 |
Add the surrounding_mines variable to each Square instance | def add_surrounding_mines
@board.flatten.each do |square|
mine_count = 0
square.adjacent_squares.each do |adj_square|
mine_count += 1 if get_square(adj_square).mine == true
end
square.surrounding_mines=(mine_count)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_mines\n\t\tall_mines = []\n\t\t@board.flatten.each do |square|\n\t\t\tall_mines << square.coords if square.mine == true\n\t\tend\n\t\tall_mines\n\tend",
"def place_mines\n\t\t(0...@size).to_a.shuffle.slice(0,@total_mines).each do |rand|\n\t\t\tmine_row = rand / @width\n\t\t\tmine_col = rand % @width\... | [
"0.6077322",
"0.5969409",
"0.5944503",
"0.5905075",
"0.5873179",
"0.5869076",
"0.57990235",
"0.57427883",
"0.57385933",
"0.5727091",
"0.5650625",
"0.56154406",
"0.5580207",
"0.55067986",
"0.54206395",
"0.54163694",
"0.53926605",
"0.5361666",
"0.535425",
"0.5348643",
"0.534646... | 0.82213503 | 0 |
Return a square object based on the coordinates | def get_square(test_coords)
@board.flatten.each do |square|
return square if square.coords == test_coords
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def square_at(y, x, color = COLORS[x % 2][y % 2])\n x_pos = x * SQUARE_SIZE\n y_pos = y * SQUARE_SIZE\n Square.new(\n x: x_pos, y: y_pos,\n size: SQUARE_SIZE,\n color: color,\n z: SQUARE_Z_DIM\n )\n end",
"def to_square x, y, anchor_x = 0.5, anchor_y = nil\n GTK::Geometry.to_s... | [
"0.7070403",
"0.67884946",
"0.6574736",
"0.6563138",
"0.6551677",
"0.6485631",
"0.6417857",
"0.6309483",
"0.62570155",
"0.6238675",
"0.62349623",
"0.622647",
"0.61679673",
"0.6077528",
"0.6065494",
"0.601292",
"0.60061014",
"0.59950274",
"0.5935193",
"0.59271514",
"0.5917665"... | 0.6500676 | 5 |
Add or remove a flag | def switch_flag(coords)
square = get_square(coords)
if square.flag == false # If Square isn't flagged already
square.switch_flag
@flags_remaining -= 1
elsif square.flag == true # If Square is flagged already
square.switch_flag
@flags_remaining += 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flag!(flaggable, flag)\n check_flaggable(flaggable, flag)\n if flagged?(flaggable, flag)\n raise MakeFlaggable::Exceptions::AlreadyFlaggedError.new\n end\n\n new_flag = flaggings.build(:flaggable_id => flaggable.id, :flaggable_type => flaggable.class.name)\n new_flag.send :write_attribut... | [
"0.7084229",
"0.682617",
"0.68184245",
"0.6692848",
"0.6543517",
"0.65046334",
"0.64527124",
"0.6420947",
"0.6415595",
"0.64152443",
"0.6407158",
"0.6396663",
"0.635972",
"0.62982553",
"0.62439495",
"0.622836",
"0.62228024",
"0.6194855",
"0.615784",
"0.61561435",
"0.6154812",... | 0.53292286 | 80 |
Get coords of all mines | def get_all_mines
all_mines = []
@board.flatten.each do |square|
all_mines << square.coords if square.mine == true
end
all_mines
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mines(positions)\n positions.select { |pos| mine?(pos) }\n end",
"def add_mines(coord_lst)\n coord_lst.each do |coord|\n add_mine(coord)\n end\n end",
"def get_random_mines(num_mines)\n mine_list = []\n coord_list = get_coord_list.shuffle\n until num_mines =... | [
"0.67818815",
"0.6479486",
"0.63827795",
"0.6382755",
"0.6272128",
"0.6193732",
"0.6111437",
"0.6068974",
"0.60050476",
"0.5998758",
"0.59846896",
"0.59846896",
"0.59325254",
"0.5912776",
"0.5901643",
"0.5880153",
"0.5799883",
"0.5766344",
"0.5749812",
"0.5747152",
"0.5746725... | 0.78046525 | 0 |
Render the actual board | def render
clear
output = "MINESWEEPER\n-----------\n#{@flags_remaining} Flags Remaining\n-----------\n"
# This will iterate through each row
# on the board.
@board.each_with_index do |row, index|
index == 0 ? output << "#{@size - index} | " : output << "#{@size - index} | "
# This will iterate over each square
row.each do |square|
if square.displayed == false && square.flag == false
output << "O"
elsif square.displayed == false && square.flag == true
output << "F".green
elsif square.displayed == true && square.mine == true && square.flag == true
output << "F".green
elsif square.displayed == true && square.mine == true
output << "M".red
elsif square.displayed == true
if square.surrounding_mines == 0
output << "_"
elsif square.surrounding_mines == 1
output << "1".blue
elsif square.surrounding_mines == 2
output << "2".green
elsif square.surrounding_mines == 3
output << "3".red
else
output << square.surrounding_mines.to_s.blue
end
end
end
output << "\n"
end
output << " ___________\n"
output << " 12345678910\n"
print output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_board\n i = 0\n while i < board.dimension\n puts \"\"\"\n #{render_row(i)} \"\"\"\n i += 1\n end\n end",
"def render\n print \"\\n\"\n @board.each do |row|\n row.each do |col|\n print \"#{col.nil? ? '.' : col} \"\n end\n print \"\\n\"\n end\n ... | [
"0.8242721",
"0.81465816",
"0.8110736",
"0.8093503",
"0.8071333",
"0.8011881",
"0.79196936",
"0.784231",
"0.78187144",
"0.77588874",
"0.770255",
"0.76907384",
"0.7670698",
"0.7643345",
"0.7627335",
"0.7627066",
"0.7583291",
"0.74880385",
"0.741826",
"0.74080276",
"0.74052185"... | 0.0 | -1 |
Initalize ennemy_array and Players | def initialize
puts " -----------------------------------------------"
puts "| |"
puts "| Bienvenue sur 'ILS VEULENT TOUS MA POO' ! |"
puts "| |"
puts "|-----------------------------------------------|"
puts "| |"
puts "|Le but du jeu est d'être le dernier survivant !|"
puts "| |"
puts " -----------------------------------------------"
puts "Nom du joueur?"
player1_input=gets.chomp
puts "\n"
@player1=HumanPlayer.new(player1_input)
@players_left=10
@enemies_in_sight=[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(human_player_name)\n\n @human_player = HumanPlayer.new(human_player_name)\n\n\n ennemy_1 = Player.new(\"Josiane\")\n ennemy_2 = Player.new(\"José\")\n ennemy_3 = Player.new(\"Jacky\")\n ennemy_4 = Player.new(\"Janine\")\n\n @ennemies = [ennemy_1, ennemy_2, ennemy_3, ennemy_4]\n en... | [
"0.72438014",
"0.70709497",
"0.68404186",
"0.67734367",
"0.6638017",
"0.6544512",
"0.6543602",
"0.65249383",
"0.65147823",
"0.64933914",
"0.64723",
"0.6472153",
"0.6466398",
"0.64154977",
"0.6391774",
"0.6379252",
"0.635592",
"0.63553697",
"0.6349254",
"0.6283452",
"0.6248447... | 0.59222096 | 49 |
Sentence when game instance created | def launch_battle
puts "\n"
puts "Que le combat commence!"
puts "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def begin_game\n\t\t#Does this need really to be stored in a variable?\n\t\tg = Game.new(@name)\n\tend",
"def game_setup\n end",
"def new # the input\n @game = Game.new\n @game.new_game\n end",
"def beginning_of_game\n\tputs \"------------------------------------------------------------\"\n\tputs \... | [
"0.73175776",
"0.7042063",
"0.67557085",
"0.6633065",
"0.65541506",
"0.65541506",
"0.65541506",
"0.65541506",
"0.65541506",
"0.65535945",
"0.65535945",
"0.65507954",
"0.65498644",
"0.65456223",
"0.6541112",
"0.6513948",
"0.6502688",
"0.6490467",
"0.64750034",
"0.64749414",
"0... | 0.0 | -1 |
Condition for while loop (any players left?) | def is_still_ongoing?
if player1.life_point>0 #&& enemies_in_sight.size>0
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_over\n remaining_player.count == 1\n end",
"def game_over?\n remaining_players == 1\n end",
"def keep_playing\n until @player_1_score == @player_victory or @player_2_score == @player_victory \n set_weapon_p1(choose_weapons)\n set_weapon_p2(choose_weapons)\n display_winner_one... | [
"0.77120316",
"0.757639",
"0.70810217",
"0.7046516",
"0.7045393",
"0.70055777",
"0.69088644",
"0.6878973",
"0.6855392",
"0.6846184",
"0.6844",
"0.6838776",
"0.676205",
"0.67497385",
"0.672835",
"0.6715464",
"0.6704869",
"0.6701325",
"0.6698386",
"0.6687904",
"0.66611594",
"... | 0.6550411 | 27 |
Remove enemy with no HP from enemies_in_sight | def kill_player(input_user)
@enemies_in_sight.delete(input_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_enemy(enemy)\n # stop except if enemy event code is to be executed or enemy is erased\n return if enemy.execute || enemy.erased\n # start event code if there is some\n enemy.start if enemy.trigger == BlizzABS::CETDeath\n # remove except if code needs to be executed\n $game_... | [
"0.65727836",
"0.63622767",
"0.6328982",
"0.63272333",
"0.62592447",
"0.6128415",
"0.60810506",
"0.6074872",
"0.6035321",
"0.6002138",
"0.5996266",
"0.5955956",
"0.59414834",
"0.59239453",
"0.5904437",
"0.5877572",
"0.5854343",
"0.578713",
"0.57825166",
"0.5719224",
"0.570383... | 0.6163717 | 5 |
Give status of players still in game | def show_players
puts "Il reste #{players_left} enemies"
player1.show_state
puts "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_status\n @player = Player.find(params[:id])\n\n # unless @player.is_boss?\n # redirect_to :root, :notice => \"Sorry, the game is closed right now. Please try again later.\"\n # return false\n # end\n end",
"def status\n result = \"online\"\n if Current.room.ready? && Current.r... | [
"0.7332347",
"0.7284809",
"0.7259944",
"0.7232608",
"0.7205647",
"0.7015709",
"0.7003126",
"0.7000417",
"0.6996216",
"0.69526905",
"0.6895627",
"0.68475026",
"0.6823446",
"0.6809252",
"0.6781697",
"0.67685896",
"0.6749036",
"0.67479014",
"0.6741616",
"0.67358536",
"0.6735674"... | 0.6792903 | 14 |
Text for actions choices | def menu
puts "Quelle action souhaites-tu effectuer : "
puts "a - chercher une meilleure arme"
puts "s - chercher à se soigner "
i=0
puts "Qui souhaites-tu attaquer?"
enemies_in_sight.each do |enemy|
puts "#{i} - #{enemies_in_sight[i].name} qui a #{enemies_in_sight[i].life_point} points de vie"
i=i+1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_possible_actions(options={})\n\t\t@operator.choose do |menu|\n\t\t\toptions.each do |key, value|\n\t\t\t\tmenu.choice(key) { send(*value) if value }\n\t\t\tend\n\t\tend\n\tend",
"def tool_action_text(tool_action)\n tool_action\n end",
"def human_action_name(action, options = {})\n defaults ... | [
"0.6987519",
"0.6952994",
"0.68094933",
"0.679591",
"0.6697373",
"0.66934574",
"0.6641114",
"0.6598535",
"0.65983653",
"0.6572553",
"0.6511052",
"0.6451628",
"0.6442516",
"0.6415699",
"0.64098847",
"0.6407567",
"0.639657",
"0.63878",
"0.63544166",
"0.6285228",
"0.625572",
"... | 0.0 | -1 |
All enemy attack the user | def enemy_attack
if enemies_in_sight.size!=0
puts "Les autres joueurs t'attaquent !"
puts "\n"
end
enemies_in_sight.each do |enemy| enemy.attack(player1)
gets.chomp
end
#player1.show_state
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enemies_attack\r\n puts \"Les ennemies vous attaquent\"\r\n @enemies.each{|player| player.attacks(@human_player)}\r\n end",
"def enemies_attack\n @enemies.each do |mechant| #player contient Josiane et José\n if mechant.life_points > 0\n mechant.attacks(@human_player)\n ... | [
"0.8199561",
"0.7956131",
"0.7638746",
"0.752217",
"0.70064384",
"0.68826354",
"0.6872883",
"0.6819057",
"0.6819057",
"0.68075114",
"0.6793516",
"0.6766488",
"0.67363596",
"0.6731136",
"0.6676038",
"0.6671981",
"0.6643844",
"0.6625956",
"0.6619767",
"0.6602483",
"0.66012883",... | 0.736727 | 4 |
End of game, define if win or loose | def win?
if enemies_in_sight.size==0
puts " -----------------------------------------------"
puts "| |"
puts "| |"
puts "| |"
puts "|-------------Vous avez gagné!------------------|"
puts "| |"
puts "| |"
puts "| |"
puts " -----------------------------------------------"
else
puts " -----------------------------------------------"
puts "| |"
puts "| |"
puts "| |"
puts "|-------------Vous avez perdu!------------------|"
puts "| |"
puts "| |"
puts "| |"
puts " -----------------------------------------------"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_game\r\n @game_over = true\r\n end",
"def end_game\n if @guess_count == 0 && @blanks != @new_word\n puts \"The game is over, Better luck next time :(\"\n @is_over = true\n elsif @blanks == @new_word\n puts \"Congrats you guessed the secret word! :)\"\n @is_over = true\n e... | [
"0.81493366",
"0.80231327",
"0.80174637",
"0.7872186",
"0.7824568",
"0.78078216",
"0.7782246",
"0.77780896",
"0.77325994",
"0.7702922",
"0.76339614",
"0.7616492",
"0.76069057",
"0.75881875",
"0.75865376",
"0.75330377",
"0.7530514",
"0.7525043",
"0.7511266",
"0.7505485",
"0.75... | 0.0 | -1 |
Override Blacklight's has_search_parameters to handle our additional datasources | def has_search_parameters?
# Blacklight's logic, covers Catalog, AC, LWeb
return true unless params[:q].blank?
return true unless params[:f].blank?
return true unless params[:search_field].blank?
# Consider the empty-query to be an active search param as well.
# (just "q=", meaning, retrieve ALL documents of this datasource)
return true if params[:q]
# Summon params are different...
# (although we're trying to remove 's.q' from params.)
return true unless params['s.q'].blank?
return true unless params['s.fq'].blank?
return true unless params['s.ff'].blank?
# No, we found no search parameters
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_custom_search_params; end",
"def add_custom_search_filters(search); end",
"def setup_search_options\n @original_search_parameter = params[:search]\n params[:search] ||= \"\"\n params.keys.each do |param|\n if param =~ /(\\w+)_id$/\n unless params[param].blank?\n query = ... | [
"0.7004828",
"0.673499",
"0.670346",
"0.66472894",
"0.64143634",
"0.63781446",
"0.6312218",
"0.629363",
"0.6292023",
"0.62903255",
"0.6261192",
"0.6248428",
"0.6201254",
"0.61976194",
"0.61885417",
"0.61640644",
"0.6114267",
"0.6110703",
"0.6088828",
"0.6088018",
"0.6083834",... | 0.6018003 | 29 |
Show invalid properties with the reasons. Usually used together with valid? | def list_invalid_properties
invalid_properties = Array.new
return invalid_properties
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.... | [
"0.7648174",
"0.7648174",
"0.7648174",
"0.7648174",
"0.7636107",
"0.7636107",
"0.7636107",
"0.7636107",
"0.7636107",
"0.7636107",
"0.7636107",
"0.7636107",
"0.735483",
"0.7334006",
"0.7266755",
"0.7237471",
"0.7230518",
"0.7224262",
"0.72067326",
"0.7175052",
"0.71689266",
... | 0.0 | -1 |
Check to see if the all the properties in the model are valid | def valid?
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_properties\n true\n end",
"def validate_properties\n true\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :... | [
"0.78992486",
"0.78992486",
"0.70971805",
"0.70782334",
"0.7032205",
"0.7031276",
"0.69510347",
"0.6869891",
"0.6858077",
"0.6858077",
"0.68287027",
"0.6823878",
"0.6820306",
"0.68144894",
"0.6794656",
"0.6752167",
"0.66843414",
"0.6676546",
"0.6667755",
"0.66296124",
"0.6618... | 0.0 | -1 |
Checks equality by comparing each attribute. | def ==(o)
return true if self.equal?(o)
self.class == o.class &&
allow_privilege_escalation == o.allow_privilege_escalation &&
capabilities == o.capabilities &&
privileged == o.privileged &&
proc_mount == o.proc_mount &&
read_only_root_filesystem == o.read_only_root_filesystem &&
run_as_group == o.run_as_group &&
run_as_non_root == o.run_as_non_root &&
run_as_user == o.run_as_user &&
se_linux_options == o.se_linux_options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n attributes == other.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en... | [
"0.7291717",
"0.7188103",
"0.70395297",
"0.7007927",
"0.68874705",
"0.6861532",
"0.6707156",
"0.6660597",
"0.66147524",
"0.658478",
"0.6584619",
"0.6580019",
"0.65543133",
"0.6543933",
"0.65068495",
"0.6479513",
"0.6456241",
"0.6415999",
"0.6412208",
"0.6412208",
"0.6412208",... | 0.0 | -1 |
Calculates hash code according to all attributes. | def hash
[allow_privilege_escalation, capabilities, privileged, proc_mount, read_only_root_filesystem, run_as_group, run_as_non_root, run_as_user, se_linux_options].hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ... | [
"0.7120726",
"0.7038658",
"0.7038658",
"0.7038658",
"0.7038658",
"0.7038658",
"0.7038658",
"0.7038658",
"0.6894208",
"0.6783233",
"0.670583",
"0.66984636",
"0.6687399",
"0.6668047",
"0.64878535",
"0.6460521",
"0.6460521",
"0.6443962",
"0.641047",
"0.63965374",
"0.63888764",
... | 0.0 | -1 |
Builds the object from hash | def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end",
"def build_from_hash(attributes)\n\n end",
"def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically ... | [
"0.8011074",
"0.7470833",
"0.7457607",
"0.7256629",
"0.72455454",
"0.70060325",
"0.6973257",
"0.6955014",
"0.69459796",
"0.69398683",
"0.69363195",
"0.6917627",
"0.6872358",
"0.6796184",
"0.6783521",
"0.67575246",
"0.67575246",
"0.67560464",
"0.67514306",
"0.67136854",
"0.666... | 0.0 | -1 |
Deserializes the data based on type | def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
temp_model = Kubernetes.const_get(type).new
temp_model.build_from_hash(value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s... | [
"0.7330926",
"0.7274019",
"0.72504056",
"0.7245751",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
... | 0.0 | -1 |
Returns the string representation of the object | def to_s
to_hash.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @object.to_s\n end",
"def to_s\n object.to_s\n end",
"def serialize(object)\n object.to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"de... | [
"0.901024",
"0.89506465",
"0.84703195",
"0.83409667",
"0.8337169",
"0.8337169",
"0.8332247",
"0.82546586",
"0.8145818",
"0.8144667",
"0.81357557",
"0.812714",
"0.8093436",
"0.8086725",
"0.8073356",
"0.8039774",
"0.80308646",
"0.80064154",
"0.80064154",
"0.80064154",
"0.800641... | 0.0 | -1 |
to_body is an alias to to_hash (backward compatibility) | def to_body
to_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_body\r\n to_hash\r\n end",
"def to_body\n to_hash\nend",
"def to_body\n to_hash\nend"
] | [
"0.8428728",
"0.83457416",
"0.83457416"
] | 0.0 | -1 |
Returns the object in the form of hash | def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n object\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n to_a.hash\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n return to_s.hash\n end",
"def hash\n @hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n ... | [
"0.8269",
"0.7876941",
"0.7872708",
"0.7801793",
"0.7789242",
"0.7780622",
"0.777597",
"0.77676195",
"0.77603126",
"0.77603126",
"0.7756104",
"0.7731049",
"0.7712994",
"0.7712994",
"0.7712994",
"0.7712994",
"0.7712994",
"0.7712994",
"0.7712994",
"0.7712994",
"0.7712994",
"0... | 0.0 | -1 |
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value | def _to_hash(value)
if value.is_a?(Array)
value.compact.map{ |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n value.hash\n end",
"def hash\n @value.hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def to_hash\n @value\n end",
"def to_hash\n @va... | [
"0.6719518",
"0.6719518",
"0.666832",
"0.66565555",
"0.6586841",
"0.6452931",
"0.6414911",
"0.6414911",
"0.6382046",
"0.6346188",
"0.6302933",
"0.62237245",
"0.6151989",
"0.6101756",
"0.60795677",
"0.60795677",
"0.60717124",
"0.6035991",
"0.6021168",
"0.5936472",
"0.5903488",... | 0.0 | -1 |
Converts this color into an array which may be splatted into Cairo::Contextset_source_rgba. | def to_cairo
[r, g, b, a]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_array\n\t\t\tm_color = self.color.delete(' ')\n\t\t\tm_color.delete!('hsl(')\n\t\t\tm_color.delete!(')')\n\n\t\t\tm_color = m_color.split(',')\n\t\t\tm_color[0] = m_color[0].to_i \n\t\t\tm_color[1] = m_color[1].to_f / 100 \n\t\t\tm_color[2] = m_color[2].to_f / 100\n\t\t\tm_color \n\t\tend",
"def to_array\... | [
"0.7284998",
"0.71843696",
"0.70576245",
"0.6787618",
"0.6760662",
"0.64947116",
"0.62895787",
"0.59748936",
"0.59721833",
"0.5927725",
"0.58050317",
"0.5792917",
"0.57405823",
"0.57405823",
"0.57344705",
"0.5727403",
"0.5720121",
"0.56806767",
"0.56498104",
"0.56103104",
"0.... | 0.61815256 | 7 |
Adds an index on the field specified. Options can be :unique => true or :unique => false. It will default to the latter. | def index(name, options = { :unique => false })
collection.create_index(name, options[:unique])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_on( field, opts={} )\n opts = Gnash.new( opts )\n design_document(true).add!( opts.merge!(:name => field) )\n unless indexes.include?( field )\n indexes << field.to_sym \n indexes << field.to_s \n end \n self \n ... | [
"0.8025571",
"0.77144396",
"0.7318643",
"0.7241203",
"0.708493",
"0.7060759",
"0.69880205",
"0.67281413",
"0.6679158",
"0.6525245",
"0.6508914",
"0.65065986",
"0.65065986",
"0.6477314",
"0.64261645",
"0.639567",
"0.6342715",
"0.62438804",
"0.62011373",
"0.6183631",
"0.6107862... | 0.7105805 | 4 |
sort by: doc class (ITU, ISO, IEC, other standard (not DOI &c), other then standard class (docid class other than DOI &c) then alphanumeric doc id (not DOI &c) then title | def sort_biblio_key(bib)
pubclass = pub_class(bib)
num = bib&.at("./docnumber")&.text
id = bib&.at("./docidentifier[not(@type = 'DOI' or "\
"@type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN')]")
metaid = bib&.at("./docidentifier[@type = 'metanorma']")&.text
abbrid = metaid unless /^\[\d+\]$/.match(metaid)
type = id['type'] if id
title = bib&.at("./title[@type = 'main']")&.text ||
bib&.at("./title")&.text || bib&.at("./formattedref")&.text
"#{pubclass} :: #{type} :: #{id&.text || metaid} :: #{title}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_sort_with_docs_last\n case name\n when /^doc|^guide|guide$/i\n \"ZZ-#{name}\"\n else\n \"AA-#{name}\"\n end\n end",
"def sort_schemas_by_category(schemas)\n sorted_schemas=[]\n categories = {\n documents: %w(document invoice credit_note order estimate payment_reminder recurri... | [
"0.61755353",
"0.6136662",
"0.6011905",
"0.5947052",
"0.5778891",
"0.5729723",
"0.5700364",
"0.5697261",
"0.5585201",
"0.5551124",
"0.5524766",
"0.5515494",
"0.5515494",
"0.5465165",
"0.54510397",
"0.54444456",
"0.5435525",
"0.539569",
"0.5377495",
"0.53751385",
"0.53568894",... | 0.57895374 | 4 |
Replace with Players page of your league | def login_espn(username, password)
click_link('Log In') # Comment this line out if your ESPN league is private
sleep 3
within_frame 'disneyid-iframe' do
find('input[type="email"]').set(username)
find('input[type="password"]').set(password)
click_button('Log In')
page.should_not have_css('.loading-indicator')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def players\n\t\t@content_title = \"Players\"\n\tend",
"def get_players\n Team.all.each do |team|\n loc = team.home_url.index('/_/')\n url = team.home_url.insert(loc, '/roster')\n doc = Nokogiri::HTML(open(url))\n players = doc.css('div.mod-content tr.oddrow, div.mod-content tr.evenrow')\n... | [
"0.6648129",
"0.6150445",
"0.6090236",
"0.6044884",
"0.60366386",
"0.6032408",
"0.5946479",
"0.59358823",
"0.59325105",
"0.59219694",
"0.59103876",
"0.5894244",
"0.5888338",
"0.58821005",
"0.58490974",
"0.581706",
"0.5796561",
"0.5796561",
"0.5796561",
"0.5796561",
"0.5796561... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def game_params
params.require(:game).permit(:winner_id, :winner_score, :loser_id, :loser_score)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Add a security signal to an incident. | def add_security_monitoring_signal_to_incident(signal_id, body, opts = {})
data, _status_code, _headers = add_security_monitoring_signal_to_incident_with_http_info(signal_id, body, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_security_monitoring_signal_to_incident_with_http_info(signal_id, body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.add_security_monitoring_signal_to_incident ...'\n end\n # verify the required parameter 'signal_i... | [
"0.6015035",
"0.5130338",
"0.5099278",
"0.50873244",
"0.5059097",
"0.5037743",
"0.50317454",
"0.49522677",
"0.49420625",
"0.4933133",
"0.48988265",
"0.48293307",
"0.48217356",
"0.48011035",
"0.4761583",
"0.47297472",
"0.47136402",
"0.47098455",
"0.47082895",
"0.47048557",
"0.... | 0.7634022 | 0 |
Add a security signal to an incident. Add a security signal to an incident. This makes it possible to search for signals by incident within the signal explorer and to view the signals on the incident timeline. | def add_security_monitoring_signal_to_incident_with_http_info(signal_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.add_security_monitoring_signal_to_incident ...'
end
# verify the required parameter 'signal_id' is set
if @api_client.config.client_side_validation && signal_id.nil?
fail ArgumentError, "Missing the required parameter 'signal_id' when calling SecurityMonitoringAPI.add_security_monitoring_signal_to_incident"
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling SecurityMonitoringAPI.add_security_monitoring_signal_to_incident"
end
# resource path
local_var_path = '/api/v1/security_analytics/signals/{signal_id}/add_to_incident'.sub('{signal_id}', CGI.escape(signal_id.to_s).gsub('%2F', '/'))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
# return_type
return_type = opts[:debug_return_type] || 'SuccessfulSignalUpdateResponse'
# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]
new_options = opts.merge(
:operation => :add_security_monitoring_signal_to_incident,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V1"
)
data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: SecurityMonitoringAPI#add_security_monitoring_signal_to_incident\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_security_monitoring_signal_to_incident(signal_id, body, opts = {})\n data, _status_code, _headers = add_security_monitoring_signal_to_incident_with_http_info(signal_id, body, opts)\n data\n end",
"def cmsSendSignal(access_token, sessionId, signal)\n url = \"#{@base_url}/rest/1/Session... | [
"0.7600201",
"0.53493756",
"0.5283075",
"0.52592176",
"0.49051586",
"0.4866179",
"0.4838483",
"0.4822816",
"0.4817199",
"0.47975916",
"0.47918665",
"0.47742736",
"0.47720915",
"0.47488666",
"0.47465608",
"0.4745634",
"0.47133133",
"0.46687654",
"0.4663791",
"0.46270424",
"0.4... | 0.616297 | 1 |
Modify the triage assignee of a security signal. | def edit_security_monitoring_signal_assignee(signal_id, body, opts = {})
data, _status_code, _headers = edit_security_monitoring_signal_assignee_with_http_info(signal_id, body, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_to(new_owner)\n if new_owner != \"congress\"\n @assigned_to = new_owner\n end\n end",
"def replace_assignee(old_assignee, new_assignee)\n remove_assignee old_assignee unless old_assignee.nil? || old_assignee.empty?\n add_assignee new_assignee unless new_assignee.nil? || new_assignee.... | [
"0.6139285",
"0.59289634",
"0.58836555",
"0.5861718",
"0.582136",
"0.582136",
"0.5794581",
"0.57603586",
"0.572013",
"0.5676017",
"0.56425405",
"0.55523556",
"0.55122906",
"0.54889214",
"0.5386174",
"0.5372151",
"0.532047",
"0.5316288",
"0.5296519",
"0.5244329",
"0.5235955",
... | 0.62472916 | 0 |
Modify the triage assignee of a security signal. Modify the triage assignee of a security signal. | def edit_security_monitoring_signal_assignee_with_http_info(signal_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.edit_security_monitoring_signal_assignee ...'
end
# verify the required parameter 'signal_id' is set
if @api_client.config.client_side_validation && signal_id.nil?
fail ArgumentError, "Missing the required parameter 'signal_id' when calling SecurityMonitoringAPI.edit_security_monitoring_signal_assignee"
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling SecurityMonitoringAPI.edit_security_monitoring_signal_assignee"
end
# resource path
local_var_path = '/api/v1/security_analytics/signals/{signal_id}/assignee'.sub('{signal_id}', CGI.escape(signal_id.to_s).gsub('%2F', '/'))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
# return_type
return_type = opts[:debug_return_type] || 'SuccessfulSignalUpdateResponse'
# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]
new_options = opts.merge(
:operation => :edit_security_monitoring_signal_assignee,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V1"
)
data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: SecurityMonitoringAPI#edit_security_monitoring_signal_assignee\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_security_monitoring_signal_assignee(signal_id, body, opts = {})\n data, _status_code, _headers = edit_security_monitoring_signal_assignee_with_http_info(signal_id, body, opts)\n data\n end",
"def replace_assignee(old_assignee, new_assignee)\n remove_assignee old_assignee unless old_assig... | [
"0.6114934",
"0.5930637",
"0.5869052",
"0.57409626",
"0.57409626",
"0.572643",
"0.5651711",
"0.5641871",
"0.5577132",
"0.55381525",
"0.55380934",
"0.54565054",
"0.54076415",
"0.54008067",
"0.53836095",
"0.536146",
"0.534615",
"0.52702326",
"0.5182521",
"0.5162969",
"0.5158942... | 0.48425618 | 49 |
Change the triage state of a security signal. | def edit_security_monitoring_signal_state(signal_id, body, opts = {})
data, _status_code, _headers = edit_security_monitoring_signal_state_with_http_info(signal_id, body, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def switch_state(state)\n node.switch_state(state)\n end",
"def transit_state(signal)\n permitted_transitions = transitions[signal.to_sym]\n unless permitted_transitions.nil?\n next_state = permitted_transitions[state]\n\n # if current state is not explicitly permitted, is any state (refe... | [
"0.5542363",
"0.5449203",
"0.5435223",
"0.5429013",
"0.54162955",
"0.53867894",
"0.5380018",
"0.52667516",
"0.5257699",
"0.5241958",
"0.5077731",
"0.5043292",
"0.50098467",
"0.4991843",
"0.4981733",
"0.49594873",
"0.49538925",
"0.4949999",
"0.4929263",
"0.49193415",
"0.490471... | 0.0 | -1 |
Change the triage state of a security signal. Change the triage state of a security signal. | def edit_security_monitoring_signal_state_with_http_info(signal_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.edit_security_monitoring_signal_state ...'
end
# verify the required parameter 'signal_id' is set
if @api_client.config.client_side_validation && signal_id.nil?
fail ArgumentError, "Missing the required parameter 'signal_id' when calling SecurityMonitoringAPI.edit_security_monitoring_signal_state"
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling SecurityMonitoringAPI.edit_security_monitoring_signal_state"
end
# resource path
local_var_path = '/api/v1/security_analytics/signals/{signal_id}/state'.sub('{signal_id}', CGI.escape(signal_id.to_s).gsub('%2F', '/'))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
# return_type
return_type = opts[:debug_return_type] || 'SuccessfulSignalUpdateResponse'
# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]
new_options = opts.merge(
:operation => :edit_security_monitoring_signal_state,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V1"
)
data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: SecurityMonitoringAPI#edit_security_monitoring_signal_state\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def switch_state(state)\n node.switch_state(state)\n end",
"def change_state!(_ctx, user:, **)\n role(user).activate!\n end",
"def change_state!(_ctx, user:, **)\n role(user).update!(state: 'active')\n end",
"def check_for_triage\n if stimulus_triage_id = session.delete(:... | [
"0.5437616",
"0.5323974",
"0.5312601",
"0.51814973",
"0.51759905",
"0.5135185",
"0.5068915",
"0.50431514",
"0.5039695",
"0.50387394",
"0.49352917",
"0.4924039",
"0.48957568",
"0.4850261",
"0.48244318",
"0.47754762",
"0.47547582",
"0.47342443",
"0.4727553",
"0.4702206",
"0.470... | 0.0 | -1 |
Uncomment the following if you are using restful_open_id_authentication skip_before_filter :verify_authenticity_token | def request_token
@token=current_client_application.create_request_token
if @token
render :text=>@token.to_query
else
render :nothing => true, :status => 401
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_rodauth\n rails_verify_authenticity_token\n super\n end",
"def verify_authenticity_token; end",
"def request_authenticity_tokens; end",
"def form_authenticity_param; end",
"def verify_authenticity_token\n super unless request_comes_from_facebook?\n end",
"def form_authenticity... | [
"0.7655797",
"0.7280841",
"0.72561175",
"0.6759227",
"0.6719318",
"0.66709197",
"0.6659311",
"0.6628159",
"0.6627647",
"0.6605463",
"0.65635943",
"0.64695036",
"0.64695036",
"0.6397832",
"0.6397274",
"0.6352675",
"0.6329889",
"0.62537843",
"0.62329763",
"0.62284374",
"0.62228... | 0.0 | -1 |
Define this method if you want the production name to be different from the default, directory name. def name return !PRODUCTION_NAME! end Hook 1. Called when the production is newly created, before any loading has been done. This is a good place to require needed files and instantiate objects in the busines layer. | def production_opening
$: << File.expand_path(File.dirname(__FILE__) + "/lib")
$USE_SERVER = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n @name ||= config(\"name\", \"WorkshopDash\")\n end",
"def production_named(name)\n productions_by_name[name]\n end",
"def name\n @name ||= Rails.application.class.parent_name.underscore\n end",
"def default_population\n self.name = self.name.downcase\n self.deployment... | [
"0.6654518",
"0.6459814",
"0.63977605",
"0.63169056",
"0.61474085",
"0.613969",
"0.6058307",
"0.60489994",
"0.60451615",
"0.60217",
"0.59878767",
"0.5967911",
"0.59532696",
"0.5935206",
"0.58964866",
"0.5876721",
"0.587427",
"0.5869487",
"0.58616865",
"0.58452666",
"0.5842803... | 0.0 | -1 |
=begin :type tweet_name: String :type time: Integer :rtype: Void =end | def record_tweet(tweet_name, time)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def record_tweet(tweet_name, time)\n @tweets[tweet_name] = [] unless @tweets.key?(tweet_name)\n @tweets[tweet_name].push(time)\n end",
"def record_tweet(tweet_name, time)\n @hash[tweet_name] ||= []\n i = @hash[tweet_name].bsearch_index { |ele| ele >= time } || @hash[tweet_name].size\n @hash... | [
"0.70501447",
"0.70338225",
"0.6156762",
"0.60743064",
"0.606803",
"0.60349786",
"0.60315984",
"0.5977855",
"0.59431064",
"0.5942926",
"0.5920541",
"0.588511",
"0.58307046",
"0.5817245",
"0.5805221",
"0.57964724",
"0.57878816",
"0.57432836",
"0.5686558",
"0.5666005",
"0.56598... | 0.7864438 | 0 |
=begin :type freq: String :type tweet_name: String :type start_time: Integer :type end_time: Integer :rtype: Integer[] =end | def get_tweet_counts_per_frequency(freq, tweet_name, start_time, end_time)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tweet_counts_per_frequency(freq, tweet_name, start_time, end_time)\n s = @hash[tweet_name].bsearch_index { |ele| ele >= start_time }\n arr = (0..(end_time - start_time)/FREQ[freq]).map { 0 }\n return arr if s.nil?\n t = (@hash[tweet_name].bsearch_index { |ele| ele > end_time } || @hash[tweet_na... | [
"0.77286303",
"0.7621519",
"0.6264583",
"0.58935845",
"0.58348304",
"0.5633109",
"0.53804725",
"0.5374237",
"0.5259138",
"0.52337885",
"0.52258986",
"0.5211731",
"0.52066535",
"0.5202441",
"0.5192467",
"0.5188813",
"0.5182679",
"0.51811206",
"0.51792836",
"0.5179023",
"0.5158... | 0.7541138 | 2 |
Query the choice option for a specific field | def choice(id, account: nil)
get account, "field/#{id}/choice", {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def options_field\n load_resource\n\n col = @grid.get_column(params[:field])\n if col\n render :json => col.get_opts_for_select(@resource)\n else\n render :json => { status: \"ERROR\" }, status: :not_found\n end\n end",
"def select_from_dropdown(field, value)\n sleep 3\n found... | [
"0.6853918",
"0.6613312",
"0.65604514",
"0.6498157",
"0.6443427",
"0.6199687",
"0.61901736",
"0.6175549",
"0.61715424",
"0.6102252",
"0.6089787",
"0.6053415",
"0.6008046",
"0.59707093",
"0.5965648",
"0.593041",
"0.5897959",
"0.58755475",
"0.5872959",
"0.5867019",
"0.5856568",... | 0.66684103 | 1 |
Create a new custom field | def create(name:, application_type:, string_id: nil, account: nil)
params = { name: name, application_type: application_type }
params[:string_id] = string_id if string_id
post account, 'field', params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @custom_field = CustomField.new(custom_field_params)\n\n respond_to do |format|\n if @custom_field.save\n format.html { redirect_to @custom_field, notice: 'Custom field was successfully created.' }\n format.json { render :show, status: :created, location: @custom_field }\n ... | [
"0.77506375",
"0.7712246",
"0.7489419",
"0.7455082",
"0.737172",
"0.71557415",
"0.7146405",
"0.70688117",
"0.69566655",
"0.68699616",
"0.6838906",
"0.6796094",
"0.67421234",
"0.67197937",
"0.6718613",
"0.6707746",
"0.6696105",
"0.6653547",
"0.6649346",
"0.6631934",
"0.6623063... | 0.0 | -1 |
GET /external_supplieds GET /external_supplieds.json | def index
is_admin=current_user.roles[:user_roles][:administration]
if is_admin=="1" || current_user.staff.unit_id
@search = ExternalSupplied.search_by_role(is_admin, current_user.staff_id).search(params[:q])
@external_supplieds = @search.result
end
respond_to do |format|
if is_admin=="1" || current_user.staff.unit_id
format.html
format.csv { send_data @external_supplieds.to_csv }
format.xls { send_data @external_supplieds.to_csv(col_sep: "\t") }
else
format.html {redirect_to root_path, notice: (t 'external_supplieds.title')+(t 'users.staff_required')}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_external_supplied\n @external_supplied = ExternalSupplied.find(params[:id])\n end",
"def create\n @external_supplied = ExternalSupplied.new(external_supplied_params)\n\n respond_to do |format|\n if @external_supplied.save\n format.html { redirect_to @external_supplied, notice: '... | [
"0.6360906",
"0.5995538",
"0.5945708",
"0.5827253",
"0.55954427",
"0.55133945",
"0.5505099",
"0.5492728",
"0.54661614",
"0.5436544",
"0.54124105",
"0.5410555",
"0.53471065",
"0.5344821",
"0.533439",
"0.53040266",
"0.5295646",
"0.52908015",
"0.5290758",
"0.526373",
"0.5250206"... | 0.0 | -1 |
GET /external_supplieds/1 GET /external_supplieds/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_external_supplied\n @external_supplied = ExternalSupplied.find(params[:id])\n end",
"def create\n @external_supplied = ExternalSupplied.new(external_supplied_params)\n\n respond_to do |format|\n if @external_supplied.save\n format.html { redirect_to @external_supplied, notice: '... | [
"0.6540598",
"0.61727446",
"0.598273",
"0.5941142",
"0.5719001",
"0.56773657",
"0.56045365",
"0.55028117",
"0.54871905",
"0.5387447",
"0.53817344",
"0.53620076",
"0.5302918",
"0.528797",
"0.52838236",
"0.528252",
"0.5259252",
"0.5254317",
"0.5244173",
"0.52415913",
"0.5240279... | 0.0 | -1 |
POST /external_supplieds POST /external_supplieds.json | def create
@external_supplied = ExternalSupplied.new(external_supplied_params)
respond_to do |format|
if @external_supplied.save
format.html { redirect_to @external_supplied, notice: 'External supplied was successfully created.' }
format.json { render action: 'show', status: :created, location: @external_supplied }
else
format.html { render action: 'new' }
format.json { render json: @external_supplied.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def external_supplied_params\n params.require(:external_supplied).permit(:unit_fuel_id, :fuel_type_id, :unit_type_id, :quantity, :source)\n end",
"def set_external_supplied\n @external_supplied = ExternalSupplied.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @exter... | [
"0.6985386",
"0.6449899",
"0.5687936",
"0.54025054",
"0.5325343",
"0.51400656",
"0.50944805",
"0.50907236",
"0.5075489",
"0.4998396",
"0.4970019",
"0.49688995",
"0.49462324",
"0.49356794",
"0.49025318",
"0.48711103",
"0.4845385",
"0.48365188",
"0.48282537",
"0.48150402",
"0.4... | 0.71207356 | 0 |
PATCH/PUT /external_supplieds/1 PATCH/PUT /external_supplieds/1.json | def update
respond_to do |format|
if @external_supplied.update(external_supplied_params)
format.html { redirect_to @external_supplied, notice: 'External supplied was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @external_supplied.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @external = External.find(params[:id])\n\n respond_to do |format|\n if @external.update_attributes(params[:external])\n format.html { redirect_to @external, notice: 'External was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { ren... | [
"0.63253933",
"0.6059394",
"0.5930328",
"0.5930328",
"0.592055",
"0.5823687",
"0.581195",
"0.5756571",
"0.57205164",
"0.57194537",
"0.57011724",
"0.5694712",
"0.56879807",
"0.56794554",
"0.5656226",
"0.56510556",
"0.56482065",
"0.5645579",
"0.56390595",
"0.56375337",
"0.56219... | 0.71822315 | 0 |
DELETE /external_supplieds/1 DELETE /external_supplieds/1.json | def destroy
@external_supplied.destroy
respond_to do |format|
format.html { redirect_to external_supplieds_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @external = External.find(params[:id])\n @external.destroy\n\n respond_to do |format|\n format.html { redirect_to externals_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\... | [
"0.6997482",
"0.6468594",
"0.6437248",
"0.64028215",
"0.64010954",
"0.6367596",
"0.6330155",
"0.6324015",
"0.63125634",
"0.63008046",
"0.6292781",
"0.62830275",
"0.6279979",
"0.6257149",
"0.62354094",
"0.62107676",
"0.6209225",
"0.6208772",
"0.6191833",
"0.61908734",
"0.61890... | 0.7747423 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_external_supplied
@external_supplied = ExternalSupplied.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def external_supplied_params
params.require(:external_supplied).permit(:unit_fuel_id, :fuel_type_id, :unit_type_id, :quantity, :source)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Monkey patch this on to create the Rolesets from the Initializer config | def create_default_roles
# Create the default Rolesets
Jak.rolesets.each do |role_set|
my_role = roles.find_or_create_by(name: role_set.role_name, key: role_set.role_name.parameterize, company: self)
my_role.permission_ids = role_set.permission_ids
my_role.save!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [Role.find_by_name(\"User\").id] \n end\n end",
"def create_roles\n Role.create_roles(self)\n end",
"def setup_role\n \tif self.role_ids.empty?\n \t self.role_ids = [3]\n \tend\n end",
"def setup_role \n if self.role_ids... | [
"0.6510596",
"0.6420943",
"0.64138335",
"0.6359044",
"0.6359044",
"0.6359044",
"0.6335805",
"0.63276595",
"0.61884713",
"0.6060684",
"0.5987963",
"0.5958094",
"0.5957912",
"0.58520037",
"0.5849449",
"0.5808704",
"0.5754742",
"0.55962044",
"0.556159",
"0.5557852",
"0.5473027",... | 0.68600416 | 0 |
same as 'unmangle', but catches all exceptions and returns original name if can not unmangle | def safe_unmangle name, *args
unmangle name, *args
rescue
name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unmangle src, args = {}\n # all Borland mangled names start with '@' character.\n return src if !src || src.empty? || src[0] != '@'\n\n # check for Microsoft compatible fastcall names, which are of the form:\n # @funcName@<one or more digits indicating size of all parameters>\n return src if src... | [
"0.7030646",
"0.6707189",
"0.64892405",
"0.6350419",
"0.6216544",
"0.59764147",
"0.59476644",
"0.5925662",
"0.5887095",
"0.57034135",
"0.5619579",
"0.56177926",
"0.5594222",
"0.5542255",
"0.5505025",
"0.5483694",
"0.5483694",
"0.5474775",
"0.5474646",
"0.5413973",
"0.54115665... | 0.8685182 | 0 |
POST /problem_submissions POST /problem_submissions.json | def create
parameters = problem_submission_params
parameters[:when] = DateTime.now
parameters[:user_id] = current_user.id
@problem_submission = ProblemSubmission.new(parameters)
respond_to do |format|
if @problem_submission.save
@problem_submission.create_source_files
@problem_submission.compile
format.html { redirect_to '/problem_submissions', notice: 'Problem submission was successfully created.' }
format.json { render :index, status: :created, location: @problem_submission }
else
format.html { render :new }
format.json { render json: @problem_submission.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @problem = Problem.new(problem_params)\n\n if @problem.save\n render json: @problem, status: :created, location: @problem\n else\n render json: @problem.errors, status: :unprocessable_entity\n end\n end",
"def problem_submission_params\n params.require(:problem_submission... | [
"0.6807434",
"0.6792642",
"0.67257774",
"0.6652546",
"0.6453194",
"0.6407596",
"0.63846636",
"0.63582164",
"0.63421845",
"0.6341801",
"0.623823",
"0.6233506",
"0.6221461",
"0.6207427",
"0.619141",
"0.6165776",
"0.6164699",
"0.6157892",
"0.609893",
"0.609043",
"0.6090086",
"... | 0.64046156 | 6 |
Use callbacks to share common setup or constraints between actions. | def set_problem_submission
@problem_submission = ProblemSubmission.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def problem_submission_params
params.require(:problem_submission).permit(:code, :problem_id, :user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
According to R5RS, car and cdr of the EmptyList result in errors (as opposed to other Lisp dialects where they return the EmptyList itself) Note that null? is different from Ruby's nil? | def null?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nil?() end",
"def nil?() end",
"def nil?() true; end",
"def nil?\n\t\t\tempty?\n\t\tend",
"def nil?; false; end",
"def null?; @null; end",
"def nil?\n none?\n end",
"def nil?\n true\n end",
"def nil?\n true\n end",
"def null?; false end",
"def null?(s... | [
"0.7347551",
"0.7347551",
"0.71027076",
"0.6791966",
"0.6746074",
"0.6716936",
"0.6694719",
"0.65284866",
"0.65284866",
"0.6524162",
"0.65075386",
"0.6499882",
"0.64518404",
"0.644609",
"0.6442325",
"0.6430672",
"0.64283967",
"0.64283967",
"0.6427676",
"0.6427676",
"0.6419446... | 0.66360456 | 7 |
Only works if is proper list | def to_a
raise ArgumentError, "#{self.inspect} is not a list" unless list?
a = [car] + (cdr.null? ? [] : cdr.to_a)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_list; end",
"def parse_list; end",
"def run(list); end",
"def format_list(items); end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def list?; return stype == :list; end",
"def saw_end_list(list); end",
"def safelist; end",
"def ad... | [
"0.6828873",
"0.6828873",
"0.6639778",
"0.65927017",
"0.6588061",
"0.6588061",
"0.6588061",
"0.64802283",
"0.6450941",
"0.6424243",
"0.64096564",
"0.64096564",
"0.64096564",
"0.63769335",
"0.63769335",
"0.63769335",
"0.63058853",
"0.6261108",
"0.6211544",
"0.6120611",
"0.6116... | 0.0 | -1 |
These methods are overriden by Cons | def list?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def overrides; end",
"def implementation; end",
"def implementation; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def custom; end",
"def custom; end",
"def schubert; end",
"def extra; end",
"def refutal()\n e... | [
"0.7046811",
"0.6536479",
"0.638341",
"0.6338895",
"0.6338895",
"0.62892765",
"0.62892765",
"0.62892765",
"0.62892765",
"0.6163163",
"0.6163163",
"0.60567594",
"0.60076666",
"0.59729415",
"0.5927546",
"0.59177595",
"0.59177595",
"0.59048355",
"0.5884807",
"0.58760834",
"0.583... | 0.0 | -1 |
These methods are overriden by Cons | def pair?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def overrides; end",
"def implementation; end",
"def implementation; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def custom; end",
"def custom; end",
"def schubert; end",
"def extra; end",
"def refutal()\n e... | [
"0.7046811",
"0.6536479",
"0.638341",
"0.6338895",
"0.6338895",
"0.62892765",
"0.62892765",
"0.62892765",
"0.62892765",
"0.6163163",
"0.6163163",
"0.60567594",
"0.60076666",
"0.59729415",
"0.5927546",
"0.59177595",
"0.59177595",
"0.59048355",
"0.5884807",
"0.58760834",
"0.583... | 0.0 | -1 |
Note that Ruby's +nil+ is considered an atom and NOT null | def atom?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nil?() end",
"def nil?() end",
"def nil?() true; end",
"def null?; @null; end",
"def nil?; false; end",
"def null?; false end",
"def null?\n false\n end",
"def null?\n false\n end",
"def null?\n true\n end",
"def null?\n true\n end",
"def null?\n ... | [
"0.7873661",
"0.7873661",
"0.7725001",
"0.76264733",
"0.7589366",
"0.75163186",
"0.7186373",
"0.7186373",
"0.71369636",
"0.7020035",
"0.70189685",
"0.70189685",
"0.6998357",
"0.6973564",
"0.6973564",
"0.6932374",
"0.6928406",
"0.69180506",
"0.689484",
"0.68676823",
"0.6833557... | 0.59982306 | 91 |
Note that Ruby's +nil+ is considered an atom and NOT null | def null?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nil?() end",
"def nil?() end",
"def nil?() true; end",
"def null?; @null; end",
"def nil?; false; end",
"def null?; false end",
"def null?\n true\n end",
"def null?\n true\n end",
"def null?\n false\n end",
"def null?\n false\n end",
"def ni... | [
"0.7873661",
"0.7873661",
"0.7725001",
"0.76264733",
"0.7589366",
"0.75163186",
"0.71369636",
"0.7020035",
"0.70189685",
"0.70189685",
"0.6998357",
"0.6973564",
"0.6973564",
"0.6932374",
"0.6928406",
"0.69180506",
"0.689484",
"0.68676823",
"0.68335575",
"0.6827125",
"0.681912... | 0.7186373 | 7 |
Override and set to false for things like OmniAuth that technically run through Authentication (user_set) very often, which would normally reset CSRF data in the session | def clean_up_csrf?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_up_csrf?\n false\n end",
"def disable_request_forgery_protection=(_arg0); end",
"def disable_request_forgery_protection; end",
"def clean_up_csrf?\n false\n end",
"def clean_up_csrf?; end",
"def clean_up_csrf?; end",
"def protect_against_forgery?\n false\n ... | [
"0.7258636",
"0.7227078",
"0.721149",
"0.7203392",
"0.6988634",
"0.6988634",
"0.6914867",
"0.6914867",
"0.68904257",
"0.6876968",
"0.6857561",
"0.68558735",
"0.68558735",
"0.68558735",
"0.68558735",
"0.68558735",
"0.68558735",
"0.68440884",
"0.68329394",
"0.67773277",
"0.6716... | 0.7048803 | 5 |
Receives a resource and check if it is valid by calling valid_for_authentication? A block that will be triggered while validating can be optionally given as parameter. Check Devise::Models::Authenticatable.valid_for_authentication? for more information. In case the resource can't be validated, it will fail with the given unauthenticated_message. | def validate(resource, &block)
result = resource && resource.valid_for_authentication?(&block)
if result
true
else
if resource
fail!(resource.unauthenticated_message)
end
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(resource, &block)\n result = resource && resource.valid_for_authentication?(&block)\n\n case result\n when Symbol, String\n fail!(result)\n else\n result\n end\n end",
"def valid_for_authentication?; end",
"def valid_for_authentication?; en... | [
"0.79408824",
"0.68102366",
"0.68102366",
"0.677354",
"0.6739502",
"0.66768545",
"0.6508573",
"0.6431805",
"0.6381864",
"0.63817114",
"0.6244094",
"0.6208391",
"0.62026525",
"0.6107812",
"0.6083741",
"0.6072518",
"0.60515165",
"0.60446966",
"0.6010392",
"0.60058486",
"0.60042... | 0.812746 | 0 |
Get values from params and set in the resource. | def remember_me(resource)
resource.remember_me = remember_me? if resource.respond_to?(:remember_me=)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(params = {})\n self.params.merge!(params)\n end",
"def set_parameters_value\n @parameters_value = ParametersValue.find(params[:id])\n end",
"def params=(value); end",
"def set_params(params)\n @params = params\n end",
"def get_params\n @set_params\n end",
"def setP... | [
"0.6884596",
"0.6641156",
"0.6620034",
"0.65520865",
"0.6476975",
"0.6396696",
"0.6381128",
"0.6334079",
"0.63332117",
"0.6313626",
"0.62483543",
"0.6216462",
"0.612743",
"0.60907155",
"0.605777",
"0.60200197",
"0.60200197",
"0.60145146",
"0.601157",
"0.60106844",
"0.59927636... | 0.0 | -1 |
Should this resource be marked to be remembered? | def remember_me?
valid_params? && Devise::TRUE_VALUES.include?(params_auth_hash[:remember_me])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_yet?\n !!@resource_lock.synchronize { defined? @resource }\n end",
"def sharded?; false; end",
"def remember_me(resource); end",
"def remember_me(resource); end",
"def sharded?; true; end",
"def remember_me(resource)\n resource.remember_me = remember_me? if resource.respond_to?(:re... | [
"0.69277906",
"0.6365016",
"0.6307765",
"0.6307765",
"0.62755936",
"0.6248216",
"0.6205566",
"0.61589825",
"0.6148719",
"0.6042898",
"0.59730446",
"0.59712315",
"0.5971109",
"0.5947988",
"0.59439045",
"0.5930067",
"0.592266",
"0.5908768",
"0.59012026",
"0.5898487",
"0.5890777... | 0.0 | -1 |
Check if this is a valid strategy for http authentication by: Validating if the model allows http authentication; If any of the authorization headers were sent; If all authentication keys are present; | def valid_for_http_auth?
http_authenticatable? && request.authorization && with_authentication_hash(:http_auth, http_auth_hash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_for_http_auth?; end",
"def valid_http_auth?\n controller.authenticate_with_http_basic do |login, password|\n if !login.blank? && !password.blank?\n send(\"#{login_field}=\", login)\n send(\"#{password_field}=\", password)\n return valid?\n end\n... | [
"0.7622451",
"0.7100605",
"0.703929",
"0.7019496",
"0.689575",
"0.6807194",
"0.67929953",
"0.6781355",
"0.67357737",
"0.6709317",
"0.66945547",
"0.6540251",
"0.6509839",
"0.65043676",
"0.64725435",
"0.6470242",
"0.64343655",
"0.64343655",
"0.6373756",
"0.637057",
"0.63640124"... | 0.78486514 | 1 |
Check if this is a valid strategy for params authentication by: Validating if the model allows params authentication; If the request hits the sessions controller through POST; If the params[scope] returns a hash with credentials; If all authentication keys are present; | def valid_for_params_auth?
params_authenticatable? && valid_params_request? &&
valid_params? && with_authentication_hash(:params_auth, params_auth_hash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_for_params_auth?; end",
"def allow_params_authentication!; end",
"def params_authenticatable?; end",
"def valid_params?\n params_auth_hash.is_a?(Hash)\n end",
"def params_auth_hash\n if params[scope].kind_of?(Hash) && params[scope].has_key?(authentication_keys.first)\n ... | [
"0.7624689",
"0.7148034",
"0.6933884",
"0.69001937",
"0.6870821",
"0.6734168",
"0.6549793",
"0.6501615",
"0.6501615",
"0.6453723",
"0.641685",
"0.63757676",
"0.63523275",
"0.63065875",
"0.6259411",
"0.62164545",
"0.62164545",
"0.61229515",
"0.6116092",
"0.6067845",
"0.6065969... | 0.77165085 | 0 |
Check if the model accepts this strategy as http authenticatable. | def http_authenticatable?
mapping.to.http_authenticatable?(authenticatable_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_for_http_auth?\n http_authenticatable? && request.authorization && with_authentication_hash(:http_auth, http_auth_hash)\n end",
"def valid_for_http_auth?\n http_authenticatable? && request.authorization && with_authentication_hash(:http_auth, http_auth_hash)\n end",
"def http_... | [
"0.76391476",
"0.76391476",
"0.73212653",
"0.70800316",
"0.7060141",
"0.69898593",
"0.69652367",
"0.69633436",
"0.68729013",
"0.6622564",
"0.6620191",
"0.66069347",
"0.6598023",
"0.6566828",
"0.6423243",
"0.6374509",
"0.6340211",
"0.63322663",
"0.6297294",
"0.62967116",
"0.62... | 0.7715769 | 1 |
Check if the model accepts this strategy as params authenticatable. | def params_authenticatable?
mapping.to.params_authenticatable?(authenticatable_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_for_params_auth?\n params_authenticatable? && valid_params_request? &&\n valid_params? && with_authentication_hash(:params_auth, params_auth_hash)\n end",
"def params_authenticatable?\n User.params_authenticatable?(authenticatable_name)\n end",
"def params_authenticat... | [
"0.7836849",
"0.77546215",
"0.7278116",
"0.71536815",
"0.6826106",
"0.67646426",
"0.6626609",
"0.6623919",
"0.6623919",
"0.64371586",
"0.63885635",
"0.6361963",
"0.6361963",
"0.6333921",
"0.6325837",
"0.6301266",
"0.6250271",
"0.62488216",
"0.62441736",
"0.6226775",
"0.618562... | 0.7761732 | 1 |
Extract the appropriate subhash for authentication from params. | def params_auth_hash
params[scope]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def params_auth_hash; end",
"def hash_decoder\n hash_params = current_resource.info['rep:password'].match(\n /^\\{(?<algo>.+)\\}(?<salt>\\w+)-(?<iter>(\\d+)-)?(?<hash>\\w+)$/\n )\n\n raise('Unsupported hash format!') unless hash_params\n\n hash_params\n end",
"def auth... | [
"0.6586294",
"0.63237065",
"0.61930805",
"0.6123942",
"0.6100498",
"0.5861367",
"0.5834452",
"0.5774602",
"0.5709013",
"0.5666867",
"0.5653268",
"0.56371367",
"0.56244916",
"0.557255",
"0.55688244",
"0.5560976",
"0.5549687",
"0.5538597",
"0.55057347",
"0.54670393",
"0.5408404... | 0.59384394 | 6 |
Extract a hash with attributes:values from the http params. | def http_auth_hash
keys = [http_authentication_key, :password]
Hash[*keys.zip(decode_credentials).flatten]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_params()\n param = extract_params_pm()\n param[:dureeCours] = @dureeCours\n param[:dureeTP] = @dureeTP\n param[:quadri] = @quadri\n param[:professeur] = @professeur\n return param\n end",
"def parse_params\n params_str.empty? ? BLANK_HASH : CGI::par... | [
"0.7051614",
"0.683512",
"0.6695132",
"0.6652226",
"0.66396755",
"0.6594364",
"0.65888596",
"0.6579352",
"0.65299356",
"0.6515736",
"0.65060556",
"0.6504913",
"0.64791137",
"0.6474815",
"0.64655983",
"0.64636093",
"0.6456251",
"0.6451185",
"0.64160585",
"0.6389305",
"0.638783... | 0.0 | -1 |
By default, a request is valid if the controller set the proper env variable. | def valid_params_request?
!!env["devise.allow_params_authentication"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?(request_env)\n\t\t\treturn false unless valid_fields?(request_env)\n\t\t\ttrue\n\t\tend",
"def valid_params_request?\n true\n end",
"def valid_params_request?\n true\n end",
"def validate_env!\n raise Kiwi::NotAcceptable,\n \"Invalid request format `#{@env['kiwi.mim... | [
"0.6936437",
"0.68189234",
"0.68189234",
"0.6759104",
"0.6476615",
"0.64348406",
"0.64010954",
"0.6393112",
"0.6386592",
"0.62601554",
"0.61945695",
"0.60900617",
"0.60415083",
"0.5990487",
"0.5982435",
"0.59753615",
"0.59435743",
"0.59320474",
"0.5908536",
"0.59063834",
"0.5... | 0.6555884 | 4 |
If the request is valid, finally check if params_auth_hash returns a hash. | def valid_params?
params_auth_hash.is_a?(Hash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_for_params_auth?\n params_authenticatable? && valid_params_request? &&\n valid_params? && with_authentication_hash(:params_auth, params_auth_hash)\n end",
"def valid_for_params_auth?; end",
"def validate\n return false unless @digest_parts.any? # RUBY\n\n a2 = @... | [
"0.7555826",
"0.75540906",
"0.72095865",
"0.7000449",
"0.6994335",
"0.6788698",
"0.6733211",
"0.6662692",
"0.6662692",
"0.6659102",
"0.6556198",
"0.6549325",
"0.65296745",
"0.652681",
"0.65201956",
"0.65176326",
"0.64945126",
"0.6456508",
"0.6454708",
"0.6450115",
"0.6450115"... | 0.8050584 | 0 |
Note: unlike `Model.valid_password?`, this method does not actually ensure that the password in the params matches the password stored in the database. It only checks if the password is present. Do not rely on this method for validating that a given password is correct. | def valid_password?
password.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def valid_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def valid_password?(password)\n true\n end",
"def valid_password?(password)... | [
"0.81458515",
"0.81458515",
"0.8142006",
"0.81207436",
"0.80404407",
"0.79253155",
"0.7899238",
"0.78958327",
"0.78697693",
"0.7865424",
"0.7865424",
"0.78611094",
"0.78420544",
"0.7826964",
"0.77966654",
"0.7791724",
"0.7711961",
"0.7694863",
"0.7694863",
"0.7686585",
"0.768... | 0.80749893 | 5 |
Helper to decode credentials from HTTP. | def decode_credentials
return [] unless request.authorization && request.authorization =~ /^Basic (.*)/mi
Base64.decode64($1).split(/:/, 2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_credentials; end",
"def decoded_auth_token\n @decoded_auth_token ||= AuthToken.decode(http_auth_token)\n end",
"def decoded_auth_token\n @decoded_auth_token ||= AuthToken.decode(http_auth_token)\n end",
"def http_auth_hash\n keys = [http_authentication_key, :password]\n H... | [
"0.8011187",
"0.6808816",
"0.6777914",
"0.67625374",
"0.67625374",
"0.67155063",
"0.6542234",
"0.6541335",
"0.645908",
"0.6373773",
"0.6353915",
"0.6327821",
"0.62952524",
"0.62778616",
"0.6265877",
"0.62600034",
"0.6246668",
"0.623094",
"0.62234783",
"0.6213022",
"0.60942304... | 0.74963605 | 2 |
Sets the authentication hash and the password from params_auth_hash or http_auth_hash. | def with_authentication_hash(auth_type, auth_values)
self.authentication_hash, self.authentication_type = {}, auth_type
self.password = auth_values[:password]
parse_authentication_key_values(auth_values, authentication_keys) &&
parse_authentication_key_values(request_values, request_keys)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def with_authentication_hash(hash)\n self.authentication_hash = {:email => hash[:username]}\n self.password = hash[:password]\n end",
"def auth=(auth_hash)\n # symbolize the keys\n new_auth_hash = {}\n auth_hash.each {|k, v| new_auth_hash[k.to_sym] = v}\n auth_hash = new_au... | [
"0.7674392",
"0.7192587",
"0.6785731",
"0.6748603",
"0.6748603",
"0.66515297",
"0.6562083",
"0.6539746",
"0.6536916",
"0.65076005",
"0.6495456",
"0.64401335",
"0.63349193",
"0.62485725",
"0.6238485",
"0.6237414",
"0.62320054",
"0.62320054",
"0.61891544",
"0.6180193",
"0.61676... | 0.73476255 | 1 |
Holds the authenticatable name for this class. Devise::Strategies::DatabaseAuthenticatable becomes simply :database. | def authenticatable_name
@authenticatable_name ||=
ActiveSupport::Inflector.underscore(self.class.name.split("::").last).
sub("_authenticatable", "").to_sym
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticatable_name\n @authenticatable_name ||=\n self.class.name.split(\"::\").last.underscore.sub(\"_authenticatable\", \"\").to_sym\n end",
"def authenticatable_name; end",
"def authenticate_name\n super\n end",
"def name\n authentications.first.name\n end",
"def au... | [
"0.8432515",
"0.78310585",
"0.6147053",
"0.60580015",
"0.6053553",
"0.5980646",
"0.5980646",
"0.59507537",
"0.59507537",
"0.5854053",
"0.58349305",
"0.5814047",
"0.57591015",
"0.57142425",
"0.55934906",
"0.5565982",
"0.5565982",
"0.5563177",
"0.55443376",
"0.5483437",
"0.5477... | 0.83210254 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.