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 |
|---|---|---|---|---|---|---|
Generate the HTML report for the Scan | def html_report
begin
require 'ruport'
rescue LoadError
abort("Couldn't load ruport, suggest that gem install ruport should help")
end
unless @options.report_file
html_report_file_name = 'Kismet-Wireless-Report-' + Time.now.to_s + '.html'
end
unless @options.report_file =~ /html$/
html_report_file_name = @options.report_file + '.html'
end
@report = File.new(html_report_file_name,'w+')
html_report_header
html_report_stats
if @options.create_map
@report << '<hr /><br /><br />'
html_report_map_body
end
@report << '<hr /><br /><br />'
html_report_inf
@report << '<hr /><br /><br />'
html_report_adhoc
@report << '<hr /><br /><br />'
html_report_probe
@report << "</body>"
@report << "</html>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_scan_report\n freshclam_stderr = IO.read($config[\"freshclam_stderr\"])\n freshclam_stdout = @freshclam_stdout\n template = IO.read(\"views/clamav.html.erb\")\n output = ERB.new(template).result(binding)\n File.open(\"clamav.html\", \"w\") {|file| file.write(output)}\nend",
"def output_report\n... | [
"0.74271506",
"0.7393127",
"0.7189573",
"0.7033436",
"0.7022559",
"0.7022559",
"0.7022559",
"0.7022559",
"0.7022559",
"0.69930935",
"0.6981009",
"0.696098",
"0.6942693",
"0.6930092",
"0.6929381",
"0.6885061",
"0.6865236",
"0.67651916",
"0.6759264",
"0.6730457",
"0.6719262",
... | 0.7743368 | 0 |
Sets up the HTML report header. CSS and Javascript for the Google Maps Option | def html_report_header
@report << '
<html>
<head>
<title> Kismet Wireless Report</title>
<style>
body {
font: normal 11px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
color: #4f6b72;
background: #E6EAE9;
}
#report-header {
font-weight: bold;
font-size: 24px;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
color: #4f6b72;
}
#sub-header {
font-weight: italic;
font-size: 10px;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
color: #4f6b72;
}
#title {
font-weight: bold;
font-size: 16px;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
color: #4f6b72;
}
th {
font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
color: #4f6b72;
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
border-top: 1px solid #C1DAD7;
letter-spacing: 2px;
text-transform: uppercase;
text-align: left;
padding: 6px 6px 6px 12px;
}
td {
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
background: #fff;
padding: 6px 6px 6px 12px;
color: #4f6b72;
}
td.alt {
background: #F5FAFA;
color: #797268;
}
</style>
'
if @options.create_map
@report << %Q!
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(#{@map_centre['lat']}, #{@map_centre['long']});
var myOptions = {
zoom: 14,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
!
#Yugh this is a hack
@options.gps_data.each do |bssid,point|
netname = bssid.gsub(':','')
if @nets_by_bssid[bssid]
#Next line is present to strip any single quotes from SSID's before putting them into the marker as that causes problems :)
content_ssid = @nets_by_bssid[bssid]['ssid'].gsub(/['<>]/,'')
@log.debug("About to add " + content_ssid) if content_ssid
@report << %Q!
var contentString#{netname} = '<b>SSID: </b> #{content_ssid} <br />' +
'<b>BSSID: </b> #{bssid}<br />' +
'<b>Channel: </b> #{@nets_by_bssid[bssid]['channel']} <br />' +
'<b>Ciphers: </b> #{@nets_by_bssid[bssid]['cipher']} <br />' +
'<b>Cloaked?: </b> #{@nets_by_bssid[bssid]['cloaked']} <br />';
var infowindow#{netname} = new google.maps.InfoWindow({
content: contentString#{netname}
});
!
end
@report << %Q!
var latlng#{netname} = new google.maps.LatLng(#{point['lat']}, #{point['lon']});
var marker#{netname} = new google.maps.Marker({
position: latlng#{netname},
map: map
});
!
if @nets_by_bssid[bssid]
@report << %Q!
google.maps.event.addListener(marker#{netname}, 'click', function() {
infowindow#{netname}.open(map,marker#{netname});
});
!
end
end
@report << %Q!
}
</script>
!
end
@report << '</head>'
if @options.create_map
@report << '<body onload="initialize()">'
else
@report << '<body>'
end
@report << '<div id="report-header">Kismet Wireless Report</div> <br /> <div id="sub-header"> Report Generated at ' + Time.now.to_s + '<br />'
@report << 'Files analysed ' + @options.file_names.join(',<br />') + '<br /> <br /></div>'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header()\n if @api_key\n \"<script src=\\\"http://maps.google.com/maps?file=api&v=2&key=#{@api_key}\\\" type=\\\"text/javascript\\\"></script>\"\n else\n \"<!-- Google Map Header requires a valid api. Please add the api key to the relevant code calls. -->\"\n end\n end",... | [
"0.643799",
"0.61146224",
"0.60882235",
"0.60864824",
"0.59782887",
"0.5968217",
"0.59363127",
"0.5921589",
"0.5841794",
"0.58338255",
"0.57765985",
"0.57697207",
"0.57680744",
"0.57494533",
"0.5705583",
"0.56978935",
"0.5579585",
"0.55414575",
"0.553895",
"0.5527923",
"0.551... | 0.78838706 | 0 |
Sets up the statistics table | def html_report_stats
@report << '<div id="title"> General Statistics</div>'
stat_tab = Ruport::Data::Table(%w[Stat Value])
stat_tab << ['Number of servers Seen', @num_servers]
stat_tab << ['Number of clients Seen', @num_clients]
@num_by_cipher.each do |cipher, num|
stat_tab << ['Encryption: ' + cipher, num]
end
@report << stat_tab.to_html
@report << '<br /><br />'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n current_user = options[:currentuser]\n all_flag = options[:allflag]\n if current_user.percentcompleteenabled\n table = Table([:description, :goaltype_label, :datecompleted, :created_date, :last_updated_date, :percentcomplete]) do |t|\n if all_flag\n current_user.goals.fin... | [
"0.65140104",
"0.64707506",
"0.64000475",
"0.6295648",
"0.6223087",
"0.6158427",
"0.613459",
"0.6117456",
"0.6061865",
"0.60543615",
"0.60543615",
"0.60543615",
"0.60543615",
"0.60543615",
"0.60543615",
"0.60543615",
"0.60543615",
"0.60543615",
"0.60543615",
"0.60543615",
"0.... | 0.0 | -1 |
creates the report section for Infrastructure Networks | def html_report_inf
@report << '<div id="title">Infrastructure Networks</div><br /><br />'
@log.debug("Starting reporting Infrastructure networks there were " + @infrastructure_networks.length.to_s + " networks to list")
@infrastructure_networks.each do |ssid,bssid|
tab = Ruport::Data::Table(%w[bssid num_clients channel cipher cloaked? manufacturer first_seen last_seen max_signal_dbm])
ssid = "Hidden or Blank" if ssid.length < 1
@report << '<div id="title">SSID: ' + ssid + ' </div>'
bssid.each do |net,info|
if @options.gps_data[net]
point = net
@log.debug("attempting to add link")
link_info = '+(' + ssid + ' | Ciphers: ' + info['cipher'] + ' | Channel: ' + info['channel'] + ')'
url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s + link_info
net = '<a href="' + url + '">' + point + '</a>'
end
tab << [net, info['clients'].length.to_s, info['channel'], info['cipher'], info['cloaked'], info['manufacturer'], info['first_seen'], info['last_seen'], info['max_signal_dbm']]
end
@report << tab.to_html
@report << "<br /> <br />"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def network_report\n get_resource_list('network', 'v2.0/networks', 'networks')\n @network_csv_array = []\n @network_print_array = []\n @resource_id_list.each do |networkid|\n network = rest_get(\"#{@resource_url}/v2.0/networks/#{networkid}\", @token_id)\n network_array = JSON.parse(network)['... | [
"0.70572907",
"0.6266153",
"0.5928026",
"0.58000946",
"0.57995605",
"0.55592734",
"0.55405647",
"0.5443282",
"0.5390088",
"0.53755814",
"0.5340762",
"0.53404087",
"0.5275468",
"0.5241324",
"0.52379274",
"0.5229627",
"0.52271503",
"0.52072716",
"0.52032423",
"0.51805854",
"0.5... | 0.7079021 | 0 |
Sets up the HTML report for AdHoc Networks | def html_report_adhoc
@log.debug("Starting to report ad-hoc networks, there were " + @adhoc_networks.length.to_s + "to report")
@report << '<div id="title">Adhoc Networks</div><br /><br />'
@adhoc_networks.each do |ssid,bssid|
tab = Ruport::Data::Table(%w[bssid channel cipher cloaked? manufacturer first_seen last_seen max_signal_dbm])
ssid = "Hidden or Blank" if ssid.length < 1
@report << '<div id="title">SSID: ' + ssid + ' </div>'
bssid.each do |net,info|
if @options.gps_data[net]
point = net
@log.debug("attempting to add link")
link_info = '+(' + ssid + ' | Ciphers: ' + info['cipher'] + ' | Channel: ' + info['channel'] + ')'
url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s + link_info
net = '<a href="' + url + '">' + point + '</a>'
end
tab << [net, info['channel'], info['cipher'], info['cloaked'], info['manufacturer'], info['first_seen'], info['last_seen'], info['max_signal_dbm']]
end
@report << tab.to_html
@report << "<br /> <br />"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_report_inf\n @report << '<div id=\"title\">Infrastructure Networks</div><br /><br />'\n @log.debug(\"Starting reporting Infrastructure networks there were \" + @infrastructure_networks.length.to_s + \" networks to list\")\n @infrastructure_networks.each do |ssid,bssid|\n tab = Ruport::Data::... | [
"0.7459221",
"0.7118371",
"0.67816055",
"0.66127026",
"0.65719134",
"0.6269927",
"0.61325306",
"0.59784055",
"0.59327596",
"0.590996",
"0.58450633",
"0.58182484",
"0.5807827",
"0.5747814",
"0.57115436",
"0.5679135",
"0.5674424",
"0.56657",
"0.565188",
"0.565188",
"0.565188",
... | 0.7710169 | 0 |
Sets up the report for Probe Networks | def html_report_probe
@log.debug("Starting to report probe networks, there were " + @probe_networks.length.to_s + " to report")
@report << '<div id="title">Probe Networks</div><br /><br />'
@probe_tab = Ruport::Data::Table(%w[bssid manufacturer])
@probe_networks.each do |probe,info|
if @options.gps_data[probe]
point = probe
@log.debug("attempting to add link")
url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s
probe = '<a href="' + url + '">' + point + '</a>'
end
@probe_tab << [probe, info['manufacturer']]
end
@report << @probe_tab.to_html
@report << "<br /><br />"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_report_inf\n @report << '<div id=\"title\">Infrastructure Networks</div><br /><br />'\n @log.debug(\"Starting reporting Infrastructure networks there were \" + @infrastructure_networks.length.to_s + \" networks to list\")\n @infrastructure_networks.each do |ssid,bssid|\n tab = Ruport::Data::... | [
"0.6425803",
"0.6419864",
"0.5954142",
"0.5897921",
"0.581064",
"0.5745984",
"0.56856745",
"0.56772435",
"0.5655869",
"0.5655869",
"0.5655869",
"0.5655869",
"0.5655869",
"0.5594677",
"0.5581363",
"0.55392957",
"0.5489171",
"0.5442158",
"0.5414202",
"0.54055125",
"0.53828084",... | 0.7133374 | 0 |
GET /time_gliders/1 GET /time_gliders/1.xml | def show
@time_glider = TimeGlider.find(params[:id])
respond_to do |format|
format.html # show.html.erb
# we do not want to use this
# format.json { render :json => @time_glider }
# because we want to change the json output of a few fields
format.json # show.json.erb
format.xml { render :xml => @time_glider }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @time_glider = TimeGlider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_glider }\n end\n end",
"def stats\n @stats = time_data Gig.all\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render ... | [
"0.64867616",
"0.5644373",
"0.55338675",
"0.5528827",
"0.5517569",
"0.5443626",
"0.5425797",
"0.5420775",
"0.53689706",
"0.53624874",
"0.5358312",
"0.5348056",
"0.5347751",
"0.53411824",
"0.5337852",
"0.53374267",
"0.5333507",
"0.53092635",
"0.5306529",
"0.5298561",
"0.528250... | 0.59750324 | 1 |
GET /time_gliders/new GET /time_gliders/new.xml | def new
@time_glider = TimeGlider.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @time_glider }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @time_glider = TimeGlider.new(params[:time_glider])\n\n respond_to do |format|\n if @time_glider.save\n format.html { redirect_to(@time_glider, :notice => 'Time glider was successfully created.') }\n format.xml { render :xml => @time_glider, :status => :created, :location => ... | [
"0.6850216",
"0.67855483",
"0.6704627",
"0.6657454",
"0.66228974",
"0.6522187",
"0.6490332",
"0.64871544",
"0.64809793",
"0.64335716",
"0.64267844",
"0.6410622",
"0.6407993",
"0.6407993",
"0.6391954",
"0.63864774",
"0.63755167",
"0.6365471",
"0.6358798",
"0.63340455",
"0.6331... | 0.76628387 | 0 |
POST /time_gliders POST /time_gliders.xml | def create
@time_glider = TimeGlider.new(params[:time_glider])
respond_to do |format|
if @time_glider.save
format.html { redirect_to(@time_glider, :notice => 'Time glider was successfully created.') }
format.xml { render :xml => @time_glider, :status => :created, :location => @time_glider }
else
format.html { render :action => "new" }
format.xml { render :xml => @time_glider.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @time_glider = TimeGlider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_glider }\n end\n end",
"def update\n @time_glider = TimeGlider.find(params[:id])\n\n respond_to do |format|\n if @time_glider.update_attributes(param... | [
"0.5996065",
"0.5393736",
"0.5320517",
"0.51162815",
"0.51122725",
"0.5108098",
"0.50843936",
"0.50840205",
"0.5058225",
"0.4985661",
"0.4940659",
"0.49380693",
"0.49276495",
"0.49202567",
"0.48934117",
"0.48835707",
"0.4879454",
"0.48536125",
"0.48367503",
"0.4827365",
"0.48... | 0.6775461 | 0 |
PUT /time_gliders/1 PUT /time_gliders/1.xml | def update
@time_glider = TimeGlider.find(params[:id])
respond_to do |format|
if @time_glider.update_attributes(params[:time_glider])
format.html { redirect_to(@time_glider, :notice => 'Time glider was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @time_glider.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @time_glider = TimeGlider.new(params[:time_glider])\n\n respond_to do |format|\n if @time_glider.save\n format.html { redirect_to(@time_glider, :notice => 'Time glider was successfully created.') }\n format.xml { render :xml => @time_glider, :status => :created, :location => ... | [
"0.6031941",
"0.5655149",
"0.5546752",
"0.553929",
"0.55168533",
"0.5471335",
"0.54589915",
"0.5418488",
"0.54001623",
"0.5378956",
"0.5320338",
"0.5287878",
"0.52556497",
"0.52540624",
"0.524614",
"0.5237099",
"0.5237099",
"0.5237099",
"0.5223671",
"0.52046907",
"0.5201099",... | 0.6973037 | 0 |
DELETE /time_gliders/1 DELETE /time_gliders/1.xml | def destroy
@time_glider = TimeGlider.find(params[:id])
@time_glider.destroy
respond_to do |format|
format.html { redirect_to(time_gliders_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @daily_grr = DailyGrr.find(params[:id])\n @daily_grr.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_daily_grrs_url) }\n format.xml { head :ok }\n end\n end... | [
"0.6471717",
"0.6219426",
"0.6209912",
"0.6202102",
"0.6158696",
"0.6150239",
"0.6057133",
"0.6049501",
"0.60351384",
"0.6016927",
"0.6010317",
"0.59923416",
"0.5958226",
"0.5954747",
"0.59516615",
"0.5942058",
"0.5929864",
"0.59114844",
"0.590835",
"0.59064096",
"0.58981824"... | 0.6922482 | 0 |
TODO: Account linking. Example, if a user has signed in via twitter using a login and then signs in via Facebook with the same id, we should link these 2 accounts. Since, we already have Authentication model in place, user should be asked for login credentials and then teh new authentication should be linked. (Gautam) | def create
omniauth = request.env['omniauth.auth']
authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])
if authentication
flash[:notice] = "Signed in successfully"
sign_in_and_redirect(:user, authentication.user)
else
user = User.new
user.apply_omniauth(omniauth)
user.login = omniauth['info'] && omniauth['info']['nickname']
if user.save
flash[:notice] = "Successfully registered"
sign_in_and_redirect(:user, user)
else
session[:omniauth] = omniauth.except('extra')
session[:omniauth_login] = user.login
# Check if login already taken. If so, ask user to link_accounts
if user.errors[:login][0] =~ /has already been taken/ # omniauth? TBD
# fetch the user with this login id!
user = User.find_by_login(user.login)
return redirect_to link_accounts_url(user.id)
end
redirect_to new_user_registration_url
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth_link\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"provider=#{provider}\",\n \"\" ] if browse_everything_... | [
"0.6548322",
"0.6419949",
"0.62457544",
"0.61796516",
"0.6037554",
"0.6034536",
"0.5963462",
"0.59040344",
"0.5897377",
"0.5874491",
"0.58699167",
"0.58399075",
"0.58369225",
"0.58104926",
"0.57875293",
"0.5787419",
"0.57679725",
"0.576345",
"0.57521915",
"0.5714858",
"0.5697... | 0.585085 | 11 |
Using a private method to encapsulate the permissible parameters is just a good pattern since you'll be able to reuse the same permit list between create and update. Also, you can specialize this method with peruser checking of permissible attributes. | def user_params
params.require(:user).permit(:login)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permitted_params\n policy(resource || resource_class.new).send(\"permitted_#{action_name}_attributes\")\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) ... | [
"0.702188",
"0.70113266",
"0.6843018",
"0.68114007",
"0.66923416",
"0.66889375",
"0.6683361",
"0.66692215",
"0.663379",
"0.66196746",
"0.66162926",
"0.66047096",
"0.6590888",
"0.6575546",
"0.6571579",
"0.65325445",
"0.6526505",
"0.65232456",
"0.65171915",
"0.65104216",
"0.647... | 0.0 | -1 |
Use email as a search term to set the delegate_user | def find_email
val = @email
return if val.nil?
val = LdapQuery::Scanner.search(val).as_user_attributes[:email]
if val.nil?
errors.add :base, 'Email address not found'
return false
end
@email = val
xdelegate = User.find_by_email(val.to_s)
if xdelegate.nil?
errors.add :base, 'Email does not have an account on this website'
return false
else
self.delegate_user_id = xdelegate.id
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_email(email = nil, email_selector = nil, ldap_lookup = nil)\n self.email = email || []\n if email_selector\n # Get the primary email address from the address list\n self.primary_email = email_selector.email(self.email)\n # Get the username from the primary... | [
"0.69874704",
"0.66270804",
"0.66270804",
"0.618256",
"0.6155082",
"0.6143417",
"0.6138992",
"0.61259073",
"0.6120344",
"0.6106986",
"0.6105193",
"0.6094031",
"0.6037938",
"0.601037",
"0.6009788",
"0.5985284",
"0.5985284",
"0.59808785",
"0.5973629",
"0.594316",
"0.594316",
... | 0.6881379 | 1 |
Overrides auth_handler= so if the authentication changes, the session cookie is cleared. | def auth_handler=(handler)
@session_cookie = nil
return super(handler)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_logout\n reset_session\n end",
"def handle_unverified_request\n super # call the default behaviour which resets the session\n cookies.delete(:remember_token)\n redirect_to :login\n end",
"def unobtrusively_authenticate_user!\n if cookies[:user_uid]\n set_user_session_from_c... | [
"0.66596895",
"0.6402066",
"0.63947856",
"0.63805807",
"0.6358268",
"0.63407105",
"0.6339492",
"0.6312544",
"0.63111037",
"0.63054043",
"0.6297264",
"0.6264113",
"0.6238354",
"0.621536",
"0.6194207",
"0.6162307",
"0.61618036",
"0.61444145",
"0.61423296",
"0.61218655",
"0.6108... | 0.86241615 | 0 |
Overrides make_request to handle 302 redirects with a session cookie. | def make_request(method, url, body = '', retries = 4)
response = super(method, url, body)
if response.status_code == 302 and retries > 0
@session_cookie = response.headers['set-cookie']
return self.make_request(method, url, body,
retries - 1)
else
return response
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_to(url)\n unless already_built_response?\n @res[\"location\"] = url\n @res.status = 302\n @already_built_response = true\n else\n fail\n end\n session.store_session(res)\n end",
"def redirect_to(url)\n self.res.status = 302\n #how would I know about location\n ... | [
"0.6412441",
"0.6408488",
"0.63788223",
"0.63478845",
"0.63209844",
"0.63020784",
"0.61808676",
"0.61748534",
"0.6166617",
"0.6151097",
"0.61457163",
"0.6100367",
"0.6086163",
"0.60827416",
"0.60687",
"0.6057229",
"0.6051553",
"0.6028398",
"0.6012906",
"0.5994556",
"0.5976894... | 0.74002177 | 0 |
Custom prepare_headers to include the session cookie if it exists | def prepare_headers
if @session_cookie
@headers['cookie'] = @session_cookie
end
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_to_headers\n unless @session.nil?\n response.headers['sid'] = @session.id\n response.headers['utoken'] = @session.utoken\n end\n end",
"def set_headers! session = nil\n response.headers['sid'] = session.id\n response.headers['utoken'] = session.utoken\n end",
"def request_heade... | [
"0.71643215",
"0.7054277",
"0.6570502",
"0.6477382",
"0.64709556",
"0.6415803",
"0.6275893",
"0.62065095",
"0.6184406",
"0.6075642",
"0.5982159",
"0.58962125",
"0.5852985",
"0.5823074",
"0.5819162",
"0.5806698",
"0.5806698",
"0.5801525",
"0.57906514",
"0.57838815",
"0.5775405... | 0.8758742 | 0 |
Run this as one before action on any controller that requires a paid, logged in user. | def check_active_user
if !current_user.active?
current_user.plan = nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user_required\n\t\t# Have to add \".filter(self)\" when not in before_filter line.\n\t\tCASClient::Frameworks::Rails::Filter.filter(self)\n\tend",
"def before_filter\n if current_user\n true\n end\n end",
"def setup \n @user = current_user\n end",
"def before_request\n ... | [
"0.7031892",
"0.6540167",
"0.6490533",
"0.6321686",
"0.63136125",
"0.62753975",
"0.618046",
"0.61487734",
"0.61371857",
"0.61359954",
"0.6123202",
"0.6118476",
"0.6094004",
"0.60747874",
"0.60459995",
"0.6045566",
"0.60415816",
"0.6040817",
"0.603951",
"0.603837",
"0.6033335"... | 0.0 | -1 |
Method that test the dark roast class | def test_dark_roast
beverage = DarkRoast.new
beverage = Milk.new(beverage)
beverage = Mocha.new(beverage)
beverage = Mocha.new(beverage)
beverage = Whip.new(beverage)
assert_equal("Dark Roast Coffee, Milk, Mocha, Mocha, Whip",
beverage.description)
assert_equal(1.59, beverage.cost)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dark_roast\n beverage = DarkRoast.new\n beverage = Milk.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Whip.new(beverage)\n assert_equal(\"Dark Roast Coffee, Milk, Mocha, Mocha, Whip\", \n beverage.... | [
"0.6940778",
"0.69158936",
"0.6380528",
"0.63674176",
"0.628433",
"0.6283115",
"0.62816167",
"0.62688184",
"0.6238262",
"0.6223462",
"0.62120193",
"0.6193525",
"0.61556214",
"0.61370224",
"0.61171836",
"0.6112152",
"0.61099803",
"0.607291",
"0.60441893",
"0.5992969",
"0.59918... | 0.69537795 | 0 |
Method that test the house blend class | def test_house_blend
beverage = HouseBlend.new
beverage = Soy.new(beverage)
beverage = Mocha.new(beverage)
beverage = Whip.new(beverage)
assert_equal("House Blend Coffee, Soy, Mocha, Whip",
beverage.description)
assert_equal(1.34, beverage.cost)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_house_blend\n beverage = HouseBlend.new\n beverage = Soy.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Whip.new(beverage)\n assert_equal(\"House Blend Coffee, Soy, Mocha, Whip\", \n beverage.description)\n assert_equal(1.34, bever... | [
"0.7500098",
"0.74448866",
"0.62738144",
"0.62115896",
"0.6183764",
"0.6183764",
"0.6019236",
"0.59566027",
"0.591663",
"0.59158957",
"0.58785987",
"0.5853097",
"0.58238006",
"0.57870084",
"0.5742406",
"0.5681121",
"0.56789",
"0.56710964",
"0.5643395",
"0.5639998",
"0.5627904... | 0.7451167 | 1 |
Problem Write a method that takes an Array of integers as input, multiplies all the numbers together, divides the result by the number of entries in the Array, and then prints the result rounded to 3 decimal places. Assume the array is nonempty. Examples / Test Cases show_multiplicative_average([3, 5]) The result is 7.500 show_multiplicative_average([6]) The result is 6.000 show_multiplicative_average([2, 5, 7, 11, 13, 17]) The result is 28361.667 Data Structure array, integer Algorithm define a method named 'show_multiplicative_average' which takes an 'array' as an argument use .reduce(:) on the array and save the result in a variable called 'multipled' Divide 'multipled' by array.size and save this in a variable called 'average' use sprintf to format the output to 3 decimal places. Code | def show_multiplicative_average(array)
multiplied = array.reduce(:*)
average = multiplied / array.size.to_f
average.round(3)
#sprintf('%.3f', average )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_multiplicative_average(array)\n puts \"The result is #{format(\"%.3f\", array.reduce(:*)/array.size.to_f)}\"\nend",
"def show_multiplicative_average(array)\n result = (array.reduce(:*)) / array.size.to_f\n puts \"The result is #{format('%.3f' , result)}\"\nend",
"def show_multiplicative_average(arr... | [
"0.87578464",
"0.87400395",
"0.87395257",
"0.8719481",
"0.86959255",
"0.8692669",
"0.8691379",
"0.8682652",
"0.8658637",
"0.86493474",
"0.86429405",
"0.8636765",
"0.86268735",
"0.86236095",
"0.86151755",
"0.8614212",
"0.85903275",
"0.8578553",
"0.85757315",
"0.85649025",
"0.8... | 0.88321674 | 0 |
Legg bruker uid til gruppe groupId | def addUserToGroup(uid, groupId)
uri = sprintf("/api/v1/groups/%d/memberships", groupId)
$canvas.post(uri, {'user_id' => uid})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_uid\n if self.id && !self.uid\n self.uid = \"cld-#{self.id}\"\n Group.update_all({uid:self.uid}, {id: self.id})\n end\n return true\n end",
"def account_gid; account.gid end",
"def gid\n \"##{id}\"\n end",
"def check_group_exists(doc, group, uid, gid)\n ... | [
"0.7082153",
"0.6631695",
"0.6588505",
"0.648164",
"0.6458812",
"0.6456437",
"0.6440437",
"0.64222264",
"0.64203024",
"0.63957125",
"0.6391444",
"0.638188",
"0.6369305",
"0.6342881",
"0.6321457",
"0.6285423",
"0.6200832",
"0.6196351",
"0.6177491",
"0.6142895",
"0.61238474",
... | 0.61505795 | 20 |
Opprett gruppe med navn groupName i gruppesettet gid. | def createGroup(groupName, gid)
uri = sprintf("/api/v1/group_categories/%d/groups", gid)
dbg("POST #{uri}")
dbg("name=#{groupName}")
newGroup = $canvas.post(uri, {'name' => groupName})
dbg(newGroup)
return newGroup
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group(gid)\n\t\t\t@group_name=GROUPS[gid.to_s]\n\t\tend",
"def gid() end",
"def gid\n \"##{id}\"\n end",
"def gid=(p0) end",
"def gid=(p0) end",
"def gid(*) end",
"def gid(*) end",
"def change_group(gid_text)\n gid = Etc.getgrnam((gid_text+\"\").untaint).gid\n Process::Sys.s... | [
"0.72792417",
"0.6986214",
"0.6985399",
"0.68672955",
"0.68672955",
"0.670072",
"0.670072",
"0.66125256",
"0.6451193",
"0.62536806",
"0.62536806",
"0.6248367",
"0.62369865",
"0.61624235",
"0.6114538",
"0.6114538",
"0.6076447",
"0.6061301",
"0.60563195",
"0.5986026",
"0.598602... | 0.5709606 | 55 |
Returner enrollment type for en seksjon s | def getEnrollmentType(s)
# //The enrollment type. One of 'StudentEnrollment', 'TeacherEnrollment',
# //'TaEnrollment', 'DesignerEnrollment', 'ObserverEnrollment'.
# "type": "StudentEnrollment",
type = ""
case s["type"]
when "StudentEnrollment"
type = "student"
when "TeacherEnrollment"
type = "teacher"
end
return type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enrollment_class\n (params[:enrollment].blank? || params[:enrollment][:type].blank? ? 'Enrollment' : params[:enrollment][:type]).constantize\n end",
"def enrollment_code_for(subject)\n Enrollment.find(:first, :conditions => {\n :user_id => self.id, :school_id => subject.school.id\n }).enrollme... | [
"0.7187711",
"0.63840365",
"0.6271871",
"0.6170893",
"0.6142005",
"0.6110634",
"0.6069084",
"0.5920033",
"0.5822918",
"0.5783087",
"0.5783087",
"0.5761107",
"0.5754447",
"0.5754272",
"0.57431734",
"0.5708474",
"0.5702752",
"0.5690099",
"0.5678745",
"0.5657737",
"0.5630255",
... | 0.7800354 | 1 |
Returner profilen til bruker uid | def getUserProfile(uid)
uri = sprintf("/api/v1/users/%d/profile",uid)
dbg(uri)
profile = $canvas.get(uri)
return profile
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile(username = nil, uid = nil)\n\n end",
"def set_profil\n @profil = User.find(params[:id])\n end",
"def get_user_profile(uid,fields)\n begin\n @user_details = graph.get_object(\"#{uid}\",\"fields\" => \"#{fields}\")\n rescue Exception => e\n error(\"get_user_prof... | [
"0.65837926",
"0.6424646",
"0.64178884",
"0.6325406",
"0.6152612",
"0.6114431",
"0.6104619",
"0.60216403",
"0.6008795",
"0.6005325",
"0.5903057",
"0.5898193",
"0.5898193",
"0.5887711",
"0.5837347",
"0.58332264",
"0.5824",
"0.5824",
"0.5812176",
"0.58094543",
"0.57953525",
"... | 0.56258386 | 39 |
Returner de to siste karakterene i seksjonsnavnet. Tanken er at seksjonene er nummerert "Seksjon 01" etc. | def getSectionNo(section)
return section["name"][-2,2]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kode_dan_kecamatan\n \"#{kode} - #{nama}\"\n end",
"def to_s()\n return \"Zug Laenge=#{self.count()}: [#@lok]\"\n end",
"def cobranca_interna_formatada\n\t\t\t\tcobranca_interna = { '21' => '21 – Cobrança Interna Com Registro', '22' => '22 – Cobrança Interna sem registro' }\n\t\t\t\tcobranca_... | [
"0.6044955",
"0.58080757",
"0.58067816",
"0.5711201",
"0.5602375",
"0.55556387",
"0.5525738",
"0.54859585",
"0.54441977",
"0.54247004",
"0.5416871",
"0.5413902",
"0.53696316",
"0.5330677",
"0.53247166",
"0.53054297",
"0.5293399",
"0.5292284",
"0.52873963",
"0.528502",
"0.5284... | 0.0 | -1 |
Returner en liste av kommentarer. | def getComments(list)
comments = ""
dbg("Kommentarer:")
list.each { |s|
dbg("Kommentar:")
dbg(s)
dbg(s["comment"])
comments = comments + "<p>" + s["author_name"] + ":" + s["comment"] + "</p>"
dbg(s["comment"])
}
return comments
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def liste()\n puts(\"LISTE DES ORDRES\\n\");\n printf(\"%8s %8s %5s %10s\\n\",\n \"ID\", \"DEBUT\", \"DUREE\", \"PRIX\")\n printf(\"%8s %8s %5s %10s\\n\",\n \"--------\", \"-------\", \"-----\", \"----------\")\n @listOrdre = @listOrdre.sort{ |a,b| a.debut <=> b.deb... | [
"0.65208894",
"0.6497185",
"0.64436233",
"0.63333046",
"0.62906855",
"0.62906855",
"0.62906855",
"0.62155735",
"0.6199007",
"0.6176992",
"0.615173",
"0.61489713",
"0.6137061",
"0.608948",
"0.60541594",
"0.6036336",
"0.6027775",
"0.6027775",
"0.6027775",
"0.6027775",
"0.602777... | 0.63654304 | 4 |
Returner en liste av enrollments i seksjon sid. | def getEnrollmentsInSection(sid)
uri = sprintf("/api/v1/sections/%d/enrollments?type[]=StudentEnrollment&per_page=999", sid)
enrollments = $canvas.get(uri)
return enrollments
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n set_enrolment\n if @enrolment\n @student_ids = @enrolment.student_ids\n else\n @student_ids = StudentId.all\n @notice = \"Displaying All Ids\"\n end\n end",
"def lasids\n render json: Student.all.pluck(:local_id) # not just active students\n end",
"def lasids\n re... | [
"0.64046454",
"0.6375124",
"0.6124821",
"0.5792812",
"0.570467",
"0.5677944",
"0.566025",
"0.5618372",
"0.5605166",
"0.55899096",
"0.5575739",
"0.55582684",
"0.55582684",
"0.5548243",
"0.55336076",
"0.55238193",
"0.55145574",
"0.55104864",
"0.55036575",
"0.5492298",
"0.547550... | 0.66680396 | 1 |
Create all screenshots for the Scrollytelling. | def create_all!
if title_card_path.exist?
Dir
.glob(story.screenshots.join("*page*.png"))
.sort_by { |path| path.scan(/\d+/).first.to_i }
.each do |path|
path.slice! File.extname(path) # drop the extension
@paths[:pages] << absolute(path) # store the result in the index
end
return
end
FileUtils.mkdir_p story.screenshots
browser.add_script_tag content: <<~JS
pageflow.ready.then(function() {
$('.multimedia_alert').remove()
})
JS
# Grab all navigable pages.
browser.goto story.url
sleep 10
pages = browser.css('#scrollytelling-navigation a')
puts "#{pages.length} screenshots in #{story.screenshots}"
pages.each_with_index do |link, index|
perma_id = link.attribute('href')[/#(\d*)\z/, 1]
url = [story.url, link.attribute('href')].join
filename = [story.slug, 'page', index + 1, "#{perma_id}.png"].join('-')
next if File.exist?(story.screenshots.join(filename))
print "#{url} "
browser.goto url
sleep 3
until browser.at_css('body').attribute('class').include? 'finished-loading'
sleep 1
end
browser.screenshot(path: story.screenshots.join(filename))
@paths[:pages] << absolute(story.screenshots.join(filename))
puts "✅ #{filename}"
end
# Grab the opening page; when this exists, all screens are complete.
browser.goto story.url
sleep 10
browser.screenshot(full: true, path: title_card_path)
@paths[:title] = absolute(title_card_path)
browser.quit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_screenshot\n Logbook.step('Taking a screenshot of a result page')\n @browser.save_screenshot(\"screenshots/screenshot - #{Time.now.strftime('%Y-%m-%d %H-%M-%S')}.png\")\n end",
"def screenshots(num_thumbnail_imgs)\n puts \"transcoded_movie thumbnail generation\"\n\t puts \"number of thumbna... | [
"0.66667306",
"0.6413551",
"0.6410283",
"0.64075047",
"0.6378417",
"0.6340471",
"0.63272524",
"0.62717605",
"0.62142974",
"0.619407",
"0.6190998",
"0.61683434",
"0.6149247",
"0.6093941",
"0.6066227",
"0.6037011",
"0.6013504",
"0.60011125",
"0.5875355",
"0.58747476",
"0.587082... | 0.6589683 | 1 |
Submit the given details to the corresponding site | def submit!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_site_save\n active_submit.click\n end",
"def business_details_page_enter_business_or_organisation_details_manual_postcode_and_submit(companyName: 'Test Company',\n houseNumber: '12', line1: 'Deanery Road',\n line2: 'EA Building', townCity: 'Bristol', postcode: 'BS1 5AH')\n\n click_link '... | [
"0.68700993",
"0.6760053",
"0.6658083",
"0.63189256",
"0.6288458",
"0.6239724",
"0.6138803",
"0.60807294",
"0.60247386",
"0.5938117",
"0.59216416",
"0.59060216",
"0.58959854",
"0.588559",
"0.58542174",
"0.58542174",
"0.58417416",
"0.5839324",
"0.58237475",
"0.5820666",
"0.581... | 0.5596549 | 36 |
Login and check if you are in the right page after login. | def login
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_login!\n u = check_and_get_user\n redirect to('/signin.html') unless u\n u\n end",
"def check_login\n unless is_logged_in?\n # all cool\n redirect_to new_session_path\n end\n end",
"def check_login\n user = current_user\n if user.nil?\n if params[:c... | [
"0.7686792",
"0.76410437",
"0.761621",
"0.7457306",
"0.7447662",
"0.74339515",
"0.7430516",
"0.7417327",
"0.7412209",
"0.7403839",
"0.74036705",
"0.73398906",
"0.7338175",
"0.72981834",
"0.7297586",
"0.7297157",
"0.7275036",
"0.7264337",
"0.72558486",
"0.7234226",
"0.7234126"... | 0.0 | -1 |
Constructor > Get the listing details to be submitted in the given site | def initialize(listingDetails, site_url,login_details)
@site_details = listingDetails
@login_details = login_details
@site_url = site_url
@browser = Watir::Browser.new :chrome
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(name = \"\", url = \"\")\n @name = name\n @url = url\n @details = details\n scrape_details\n end",
"def fetch_listing\n districts = district_name_and_permalink_hash \n district_permalink = districts.fetch(district.name) { \n raise \"Whoa, cannot fetch listing,-- #{district.... | [
"0.6319154",
"0.6185045",
"0.61180764",
"0.60874146",
"0.60528314",
"0.6025864",
"0.59889686",
"0.5944641",
"0.5940689",
"0.5903633",
"0.58727425",
"0.5871586",
"0.5868298",
"0.5848401",
"0.5848401",
"0.5848401",
"0.5848401",
"0.57953566",
"0.5791074",
"0.57460856",
"0.574608... | 0.64471674 | 0 |
The expected data in the collection as an outcome after running an operation. | def collection_data
@collection && @collection['data']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_collection_data(actual_collection_data)\n expected_collection_data = test_instance.outcome_collection_data\n if expected_collection_data.nil?\n expect(actual_collection_data).to be nil\n elsif expected_collection_data.empty?\n expect(actual_collection_data).to be_e... | [
"0.67487836",
"0.61592734",
"0.60574317",
"0.60065913",
"0.5812745",
"0.5790149",
"0.57858497",
"0.5731475",
"0.5697186",
"0.5618413",
"0.5594963",
"0.5578598",
"0.5553732",
"0.55398107",
"0.5523077",
"0.5507436",
"0.5506675",
"0.5500891",
"0.54976034",
"0.5479272",
"0.542975... | 0.5392902 | 23 |
Delivers this payload to CrashLog Captures any exceptions and logs them. | def deliver!
deliver
rescue Exception => e
error('Failed to deliver notification to CrashLog collector')
log_exception(e)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def processCrash; raise \"Abstract Exception: AbstractBeezwaxCrashProcessor.processCrash must be extended\"; end",
"def call(env)\n super\n rescue\n logger.error do\n \"#{$!.class.name} - #{$!.message} (#{$!.backtrace.first})\"\n end\n raise\n end",
"def rescuer\n... | [
"0.60967845",
"0.53365004",
"0.52355564",
"0.5174961",
"0.5152744",
"0.51387566",
"0.5121802",
"0.511532",
"0.51037663",
"0.5096618",
"0.5059202",
"0.5047573",
"0.5032194",
"0.50313455",
"0.49913314",
"0.4985346",
"0.49847648",
"0.49829665",
"0.49736038",
"0.49377817",
"0.493... | 0.607135 | 1 |
The canonical time this exception occurred. Other notifiers leave this to the collector to set, we however take time more seriously and use this figure internally to detect processing time irregularities. Returns UNIX UTC timestamp integer. | def timestamp
Time.now.utc.to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canonical_time\n Time.parse(timestamp).utc.iso8601\n end",
"def timestamp\n Time.at((self[:tsh].to_i << 32 | self[:tsl].to_i) * ts_resol)\n end",
"def timestamp\n Time.at((self.tsh << 32 | self.tsl) * ts_resol)\n end",
"def timestamp\n _timestamp.as_time\n end"... | [
"0.6385008",
"0.61927515",
"0.6068136",
"0.6032304",
"0.5980395",
"0.59446514",
"0.57899314",
"0.5763626",
"0.5758183",
"0.5752457",
"0.5751187",
"0.5744088",
"0.5741157",
"0.56950486",
"0.5692983",
"0.5680432",
"0.56763273",
"0.5672918",
"0.5667088",
"0.5637004",
"0.56356496... | 0.5996415 | 4 |
Various meta data about this notifier gem | def notifier
{
:name => "crashlog",
:version => CrashLog::VERSION,
:language => 'Ruby'
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Email delivery (rfc6037) for CalDAV scheduling',\n 'link' => 'http://sabre.io/dav/scheduling/'\n }\n end",
"def metadata\n msg['metadata']||{}\n end",
"def notification_m... | [
"0.66314024",
"0.64211375",
"0.63781476",
"0.6167987",
"0.61629486",
"0.61572576",
"0.61572576",
"0.61572576",
"0.61572576",
"0.61572576",
"0.61572576",
"0.61572576",
"0.61546105",
"0.6125259",
"0.61089736",
"0.61089736",
"0.6091981",
"0.6071879",
"0.6067872",
"0.60361326",
"... | 0.6367681 | 3 |
Write a `guessing_game` method. The computer should choose a number between 1 and 100. Prompt the user to `guess a number`. Each time through a play loop, get a guess from the user. Print the number guessed and whether it was `too high` or `too low`. Track the number of guesses the player takes. When the player guesses the number, print out what the number was and how many guesses the player needed. | def guessing_game
computer_number = rand(1..100)
guesses = 0
while true
guesses += 1
puts "guess a number"
user_number = gets.chomp.to_i
puts user_number
#finish loop when the user's name and computer's number is same
break if computer_number == user_number
status = computer_number > user_number ? "low" : "high"
puts "too #{status}"
end
puts "#{guesses}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guessing_game\n\tputs \"Guess a number between 1 and 100\"\n\tcorrect = Random.new.rand(1..100)\n\tnum_guesses = 1\n\tcurrent_guess = gets.chomp.to_i\n\n\twhile current_guess != correct\n\t\tif current_guess > correct \n\t\t\tputs \"The number is lower than #{current_guess}. Guess again\"\n\t\telsif current_gu... | [
"0.830622",
"0.8221844",
"0.8044226",
"0.8008212",
"0.7981089",
"0.7833231",
"0.7823104",
"0.7723602",
"0.7723475",
"0.7697836",
"0.7669743",
"0.7581475",
"0.7558235",
"0.75367606",
"0.7511483",
"0.750588",
"0.748702",
"0.7436092",
"0.7408859",
"0.7381138",
"0.7375729",
"0.... | 0.7762621 | 7 |
Returns a redirect reason or nil, if no redirect should be made | def redirect_reason(community:, host:, no_communities:, app_domain:)
community = Maybe(community).map { |c| DataTypes.create_community(c) }.or_else(nil)
if no_communities
:no_marketplaces
elsif community.nil? && !no_communities
:not_found
elsif community && community[:deleted]
:deleted
elsif community && community[:hold]
:hold
elsif community && community[:closed]
:closed
elsif community && community[:domain].present? && community[:use_domain] && host != community[:domain]
:use_domain
elsif community && community[:domain].present? && !community[:use_domain] && host == community[:domain]
:use_ident
elsif community && host == "www.#{community[:ident]}.#{app_domain}"
:www_ident
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_location\n http_redirect? ? @get_resp.header['location'] : nil\n end",
"def redirect_location\n http_redirect? ? @get_resp.header['location'] : nil\n end",
"def redirect?; end",
"def redirection(url = nil)\n url ||= @uri.to_s\n response = Browser.get(url)\n\n if respons... | [
"0.6895225",
"0.6895225",
"0.6726091",
"0.6564734",
"0.6498567",
"0.6478452",
"0.6462942",
"0.6355987",
"0.6348015",
"0.6329971",
"0.6264436",
"0.62597823",
"0.62513363",
"0.62364215",
"0.62364215",
"0.61893225",
"0.61503",
"0.61458004",
"0.6144887",
"0.6141719",
"0.6141632",... | 0.0 | -1 |
Takes an ActionDispatch::Request or Rack::Request Returns a Hash in a form that MarketplaceRouter expects | def request_hash(request)
{
host: request.host,
protocol: (request.respond_to?(:protocol) ? request.protocol : "#{request.scheme}://"),
fullpath: request.fullpath,
port_string: (request.respond_to?(:port_string) ? request.port_string : ":#{request.port}"),
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n 'method' => method.to_s,\n 'url' => url,\n }).map { ... | [
"0.6889009",
"0.6881015",
"0.6881015",
"0.6881015",
"0.6881015",
"0.6829947",
"0.6508731",
"0.65080804",
"0.65015936",
"0.63562757",
"0.63558084",
"0.6326002",
"0.6300092",
"0.6285011",
"0.6269501",
"0.626325",
"0.6258031",
"0.623763",
"0.62334824",
"0.6201284",
"0.61872953",... | 0.6276314 | 14 |
Takes a Community model and Plan entity. Returns a Hash in a form that MarketplaceRouter expects | def community_hash(community, plan)
Maybe(community).map { |c|
{
ident: c.ident,
domain: c.domain,
deleted: c.deleted?,
use_domain: c.use_domain?,
closed: Maybe(plan)[:closed].or_else(false),
hold: Maybe(plan)[:hold].or_else(false),
}
}.or_else(nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plan_params plan\n {\n name: plan.name,\n plan_id: plan.id,\n status: plan.status,\n chargebee_data: {\n price: plan.price,\n period: plan.period,\n period_unit: plan.period_unit,\n trial_period: plan.trial_period,\n trial_period_unit: plan.trial_period... | [
"0.6311829",
"0.5731611",
"0.5377128",
"0.5279702",
"0.5257567",
"0.52156913",
"0.5193629",
"0.51771855",
"0.5172494",
"0.5156871",
"0.5121325",
"0.5119473",
"0.511445",
"0.5104381",
"0.5090695",
"0.50836575",
"0.506335",
"0.50598586",
"0.50523263",
"0.5048519",
"0.5013052",
... | 0.64264363 | 0 |
GET /private_album_images GET /private_album_images.json | def index
@private_album_images = PrivateAlbumImage.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end",
"def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n ... | [
"0.7502345",
"0.7087396",
"0.7041099",
"0.69735765",
"0.69724345",
"0.69284165",
"0.69117075",
"0.68325365",
"0.68223506",
"0.67660177",
"0.6761047",
"0.67549884",
"0.6751878",
"0.6743444",
"0.6694305",
"0.6693801",
"0.66898006",
"0.66894794",
"0.6686694",
"0.6685078",
"0.667... | 0.7814888 | 0 |
GET /private_album_images/1 GET /private_album_images/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @private_album_images = PrivateAlbumImage.all\n end",
"def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end",
"def index\n @pictures = @album.pictures #JRD11... | [
"0.7581941",
"0.7577814",
"0.73701257",
"0.7290138",
"0.7189115",
"0.71506715",
"0.7049646",
"0.6952008",
"0.69163704",
"0.6889026",
"0.6867494",
"0.68494093",
"0.6815739",
"0.6788014",
"0.6750914",
"0.6743128",
"0.6717514",
"0.671082",
"0.6708647",
"0.6700362",
"0.6681717",
... | 0.0 | -1 |
POST /private_album_images POST /private_album_images.json | def create
@private_album_image = PrivateAlbumImage.new(private_album_image_params)
respond_to do |format|
if @private_album_image.save
format.html { redirect_to @private_album_image, notice: 'Private album image was successfully created.' }
format.json { render action: 'show', status: :created, location: @private_album_image }
else
format.html { render action: 'new' }
format.json { render json: @private_album_image.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @album = Album.new(params[:album])\n \n respond_to do |format|\n images = [params[:images]].flatten\n @album.images << Image.find(images) unless images[0].nil?\n \n if @album.save\n format.html { redirect_to(albums_path, :notice => 'Album was successfully created.')... | [
"0.70358884",
"0.6958725",
"0.68498844",
"0.68260425",
"0.6766401",
"0.6743341",
"0.661099",
"0.6588316",
"0.6468611",
"0.6462717",
"0.6452367",
"0.64280766",
"0.64179707",
"0.64128506",
"0.6407221",
"0.64051026",
"0.639881",
"0.63375807",
"0.6289237",
"0.62540025",
"0.623817... | 0.70301104 | 1 |
PATCH/PUT /private_album_images/1 PATCH/PUT /private_album_images/1.json | def update
respond_to do |format|
if @private_album_image.update(private_album_image_params)
format.html { redirect_to @private_album_image, notice: 'Private album image was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @private_album_image.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @album = Album.find(params[:id])\n \n respond_to do |format|\n if @album.update_attributes(params[:album])\n @album.images.clear\n @album.images << Image.find([params[:images]].flatten)\n @album.save!\n format.html { redirect_to(albums_path, :notice => 'Album ... | [
"0.73571384",
"0.7031816",
"0.69092375",
"0.6908788",
"0.687213",
"0.6820628",
"0.6749838",
"0.6691485",
"0.6640333",
"0.66399324",
"0.6630723",
"0.662082",
"0.66140354",
"0.6613091",
"0.6589555",
"0.6547795",
"0.65395373",
"0.6498759",
"0.6474465",
"0.6465543",
"0.6448792",
... | 0.72819173 | 1 |
DELETE /private_album_images/1 DELETE /private_album_images/1.json | def destroy
@private_album_image.destroy
respond_to do |format|
format.html { redirect_to private_album_images_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n \t@album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @private_album.destroy\n respond_to do |form... | [
"0.75851434",
"0.7518786",
"0.7511975",
"0.75039047",
"0.7412196",
"0.7358814",
"0.7337884",
"0.7320177",
"0.73031056",
"0.7298864",
"0.7291708",
"0.72791886",
"0.7259161",
"0.7238636",
"0.7218582",
"0.7206611",
"0.7185427",
"0.71839875",
"0.7149847",
"0.7126101",
"0.7126075"... | 0.8040722 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_private_album_image
@private_album_image = PrivateAlbumImage.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 private_album_image_params
params.require(:private_album_image).permit(:ImageID, :AlbumID)
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 |
Show invalid properties with the reasons. Usually used together with valid? | def list_invalid_properties
invalid_properties = Array.new
if !@name.nil? && @name.to_s.length > 250
invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 250.')
end
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.76497203",
"0.76497203",
"0.76497203",
"0.76497203",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7356452",
"0.7334807",
"0.72685325",
"0.7238964",
"0.7231359",
"0.72258264",
"0.7208294",
"0.71760833",
"0.717024... | 0.0 | -1 |
Check to see if the all the properties in the model are valid | def valid?
return false if !@name.nil? && @name.to_s.length > 250
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 |
Custom attribute writer method with validation | def name=(name)
if !name.nil? && name.to_s.length > 250
fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 250.'
end
@name = name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Checks equality by comparing each attribute. | def ==(o)
return true if self.equal?(o)
self.class == o.class &&
click_rate_formatted == o.click_rate_formatted &&
created_dts == o.created_dts &&
deleted == o.deleted &&
email_campaign_uuid == o.email_campaign_uuid &&
email_communication_sequence_uuid == o.email_communication_sequence_uuid &&
end_once_customer_purchases == o.end_once_customer_purchases &&
end_once_customer_purchases_anywhere == o.end_once_customer_purchases_anywhere &&
esp_campaign_folder_uuid == o.esp_campaign_folder_uuid &&
esp_domain_user == o.esp_domain_user &&
esp_domain_uuid == o.esp_domain_uuid &&
esp_friendly_name == o.esp_friendly_name &&
library_item_oid == o.library_item_oid &&
memberships == o.memberships &&
merchant_id == o.merchant_id &&
name == o.name &&
open_rate_formatted == o.open_rate_formatted &&
prevent_sending_due_to_spam == o.prevent_sending_due_to_spam &&
revenue_formatted == o.revenue_formatted &&
revenue_per_customer_formatted == o.revenue_per_customer_formatted &&
scheduled_dts == o.scheduled_dts &&
screenshot_large_full_url == o.screenshot_large_full_url &&
sms_esp_twilio_uuid == o.sms_esp_twilio_uuid &&
sms_phone_number == o.sms_phone_number &&
status == o.status &&
status_dts == o.status_dts &&
storefront_oid == o.storefront_oid
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
[click_rate_formatted, created_dts, deleted, email_campaign_uuid, email_communication_sequence_uuid, end_once_customer_purchases, end_once_customer_purchases_anywhere, esp_campaign_folder_uuid, esp_domain_user, esp_domain_uuid, esp_friendly_name, library_item_oid, memberships, merchant_id, name, open_rate_formatted, prevent_sending_due_to_spam, revenue_formatted, revenue_per_customer_formatted, scheduled_dts, screenshot_large_full_url, sms_esp_twilio_uuid, sms_phone_number, status, status_dts, storefront_oid].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.7118691",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.68960655",
"0.67847186",
"0.6707762",
"0.670052",
"0.6688737",
"0.66705376",
"0.6489735",
"0.6462376",
"0.6462376",
"0.64444333",
"0.6413127",
"0.6395483",
"0.638... | 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 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 = UltracartClient.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.7218884",
"0.7213926",
"0.71909",
"0.7183136",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71... | 0.72291344 | 19 |
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.84283537",
"0.8347048",
"0.8347048"
] | 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.8270299",
"0.78767854",
"0.78726953",
"0.7802364",
"0.7789188",
"0.77806795",
"0.7775915",
"0.7767511",
"0.7760525",
"0.7760525",
"0.77559966",
"0.7731286",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",... | 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.6720587",
"0.6720587",
"0.66691047",
"0.66568977",
"0.6587778",
"0.6452369",
"0.64156955",
"0.64156955",
"0.6382176",
"0.6345186",
"0.63019073",
"0.62231636",
"0.61526376",
"0.61023515",
"0.60785437",
"0.60785437",
"0.6071557",
"0.60354906",
"0.60190517",
"0.59378713",
"0.... | 0.0 | -1 |
Takes in a function to call and executes it | def run_job(func, *args)
if self.method(func).arity > 1
self.send(func, *args)
else
self.send(func, args)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_function(param)\n param.call\n end",
"def run(function, arguments)\n\t\t\t\taction = function[0]\n\t\t\t\tfunction = function_for(function)\n\n\t\t\t\tself.send(action, function, *arguments)\n\t\t\tend",
"def call(fun, *args)\n call2(nil, fun, *args)\n end",
"def call() end",
"def ca... | [
"0.6921226",
"0.6853608",
"0.6740197",
"0.6728484",
"0.6723412",
"0.668689",
"0.668689",
"0.6657126",
"0.66467553",
"0.661642",
"0.66163963",
"0.65471727",
"0.64883435",
"0.6475767",
"0.64192724",
"0.63902783",
"0.637054",
"0.6366736",
"0.6359319",
"0.6344167",
"0.6313561",
... | 0.60196495 | 50 |
add your functions here | def add(a,b)
puts "Adding these numbers #{a}, #{b}"
a + b
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def functions\n\n end",
"def set_functions\n super\n end",
"def custom; end",
"def custom; end",
"def methods() end",
"def add_actions; end",
"def operations; end",
"def operations; end",
"def set_functions\n super\n # Current Item Functions - Pass a (1-based) numerical position ... | [
"0.7900806",
"0.6795439",
"0.66568875",
"0.66568875",
"0.6592703",
"0.6510823",
"0.6509568",
"0.6509568",
"0.62289584",
"0.62212217",
"0.62212217",
"0.62212217",
"0.62193656",
"0.62193656",
"0.62193656",
"0.62193656",
"0.6132636",
"0.6132636",
"0.61001045",
"0.60548663",
"0.6... | 0.0 | -1 |
Internal: Determine what clock to use for the machine we are one. We want the highest resolution clock possible, which should be nanosecond resolution. Get the resolution of each clock id and then return the higest resolution id from the list Returns the clock id to use on this ruby | def determine_clock_id
ids_and_resolutions = potential_clock_ids.map { |clock_id|
[clock_id, Process.clock_getres(clock_id)]
}
# Sort them by the resolution - we want the smallest one first
ids_and_resolutions.sort_by! { |pair| pair[1] }
return ids_and_resolutions.first[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clock24_to_clock_sec(clock)\n check_pre((clock.clock24?))\n ClockSec[(clock.hour*HOUR_IN_SEC) + (clock.min*MIN_IN_SEC) + clock.sec]\nend",
"def parent_clock\n buffer = \"\\0\" * SIZEOF_LONG_LONG\n FMOD.invoke(:ChannelGroup_GetDSPClock, self, nil, buffer)\n buffer.unpack1('Q')\n end",
... | [
"0.5930892",
"0.5863771",
"0.58601826",
"0.5806299",
"0.5741912",
"0.57043856",
"0.5542434",
"0.5510987",
"0.5494828",
"0.54886955",
"0.5431437",
"0.5416595",
"0.5387152",
"0.5268263",
"0.5256649",
"0.5221533",
"0.52164114",
"0.51807314",
"0.5171924",
"0.5111444",
"0.509691",... | 0.8332264 | 0 |
public instance methods ................................................... | def initialize
super
@fbnr074p_records = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def implementation; end",
"def implementation; end",
"def initialize\n\t\t\n\tend",
"def instance; end",
"def instance; end",
"def instance; end",
"def internal; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize\n \n end"... | [
"0.8471986",
"0.75887525",
"0.75887525",
"0.7408363",
"0.7389037",
"0.7389037",
"0.7389037",
"0.733222",
"0.7306463",
"0.7306463",
"0.7306463",
"0.7306463",
"0.72930485",
"0.7246825",
"0.71916157",
"0.71916157",
"0.7188285",
"0.7188285",
"0.7188285",
"0.7188285",
"0.71772283"... | 0.0 | -1 |
overridden from parent class .............................................. | def parse(report_file, options_trailer = nil)
file = File.open(report_file,'r')
build_records_from_file file.readlines
file.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def overrides; end",
"def custom; end",
"def custom; end",
"def special\n override\n end",
"def implementation; end",
"def implementation; end",
"def super_class; end",
"def super_class; end",
"def super_method; end",
"def superclass() end",
"def tag; raise 'Override t... | [
"0.78555334",
"0.75938576",
"0.73337984",
"0.73337984",
"0.71052116",
"0.7047717",
"0.7047717",
"0.6990317",
"0.6990317",
"0.69891036",
"0.69674724",
"0.69476146",
"0.6947545",
"0.6892643",
"0.68331325",
"0.68123925",
"0.68123925",
"0.68123925",
"0.6777674",
"0.6774636",
"0.6... | 0.0 | -1 |
out the current state. | def display_board(board)
#Do stuff fool
puts build_row(board[0..2])
print_separator
puts build_row(board[3..5])
print_separator
puts build_row(board[6..8])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_state; end",
"def write_state; end",
"def state_out(path:)\n add option: \"-state-out=#{path}\"\n end",
"def pop_state\t\n\t\t\t@state_buffer = Proc.new do\n\t\t\t\t@objs2 = []\n\t\t\t\t@current_state = @states.pop\n\t\t\tend\n\t\tend",
"def final_state(state)\n final_states(state)\n ... | [
"0.72624224",
"0.72624224",
"0.67279774",
"0.6647568",
"0.6577878",
"0.6515",
"0.6501546",
"0.6501546",
"0.64870685",
"0.64463556",
"0.64091253",
"0.63802713",
"0.6377393",
"0.6373034",
"0.6373034",
"0.6373034",
"0.6373034",
"0.6373034",
"0.6373034",
"0.6373034",
"0.6373034",... | 0.0 | -1 |
Create an inbox ruleset Create a new inbox rule for forwarding, blocking, and allowing emails when sending and receiving | def create_new_inbox_ruleset(create_inbox_ruleset_options, opts = {})
data, _status_code, _headers = create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_inbox_ruleset(inbox_id, create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts)\n data\n end",
"def test_new_inbox_ruleset(test_new_inbox_ruleset_options, opts = {})\n data, _status_co... | [
"0.61950773",
"0.5751447",
"0.5678452",
"0.5643247",
"0.54154164",
"0.53206235",
"0.52772284",
"0.52740157",
"0.52516335",
"0.525135",
"0.5231989",
"0.5219381",
"0.5214958",
"0.51981",
"0.51866287",
"0.514604",
"0.5103869",
"0.50939095",
"0.50881296",
"0.50880677",
"0.5080491... | 0.6304485 | 0 |
Create an inbox ruleset Create a new inbox rule for forwarding, blocking, and allowing emails when sending and receiving | def create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.create_new_inbox_ruleset ...'
end
# verify the required parameter 'create_inbox_ruleset_options' is set
if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?
fail ArgumentError, "Missing the required parameter 'create_inbox_ruleset_options' when calling InboxRulesetControllerApi.create_new_inbox_ruleset"
end
# resource path
local_var_path = '/rulesets'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
# 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[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options)
# return_type
return_type = opts[:return_type] || 'InboxRulesetDto'
# auth_names
auth_names = opts[:auth_names] || ['API_KEY']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: InboxRulesetControllerApi#create_new_inbox_ruleset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_new_inbox_ruleset(create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts)\n data\n end",
"def create_inbox_ruleset(inbox_id, create_inbox_ruleset_options, opts = {})\n data, _status_code, _h... | [
"0.63034475",
"0.61941344",
"0.5750968",
"0.56765753",
"0.5641073",
"0.5414884",
"0.5320021",
"0.52764016",
"0.5271975",
"0.5251907",
"0.5250316",
"0.5232335",
"0.52176464",
"0.5196002",
"0.51865673",
"0.5144872",
"0.51033604",
"0.5094446",
"0.5088191",
"0.5085173",
"0.508033... | 0.5213975 | 13 |
Delete an inbox ruleset Delete inbox ruleset | def delete_inbox_ruleset(id, opts = {})
delete_inbox_ruleset_with_http_info(id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_inbox_rulesets(opts = {})\n delete_inbox_rulesets_with_http_info(opts)\n nil\n end",
"def destroy\n @rule_set = RuleSet.find(params[:id])\n @rule_set.destroy\n\n respond_to do |format|\n format.html { redirect_to rule_sets_url }\n format.json { head :ok }\n end\n en... | [
"0.7691972",
"0.66032934",
"0.65967035",
"0.63888776",
"0.6176017",
"0.61702317",
"0.59798986",
"0.59178627",
"0.5816386",
"0.57613325",
"0.57417184",
"0.5738284",
"0.5737985",
"0.57039267",
"0.56656593",
"0.56450397",
"0.5606443",
"0.5570346",
"0.55576843",
"0.55542505",
"0.... | 0.6839362 | 1 |
Delete an inbox ruleset Delete inbox ruleset | def delete_inbox_ruleset_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.delete_inbox_ruleset ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling InboxRulesetControllerApi.delete_inbox_ruleset"
end
# resource path
local_var_path = '/rulesets/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type]
# auth_names
auth_names = opts[:auth_names] || ['API_KEY']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: InboxRulesetControllerApi#delete_inbox_ruleset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_inbox_rulesets(opts = {})\n delete_inbox_rulesets_with_http_info(opts)\n nil\n end",
"def delete_inbox_ruleset(id, opts = {})\n delete_inbox_ruleset_with_http_info(id, opts)\n nil\n end",
"def destroy\n @rule_set = RuleSet.find(params[:id])\n @rule_set.destroy\n\n ... | [
"0.7691972",
"0.6839362",
"0.66032934",
"0.65967035",
"0.63888776",
"0.6176017",
"0.61702317",
"0.59798986",
"0.59178627",
"0.5816386",
"0.57613325",
"0.5738284",
"0.5737985",
"0.57039267",
"0.56656593",
"0.56450397",
"0.5606443",
"0.5570346",
"0.55576843",
"0.55542505",
"0.5... | 0.57417184 | 11 |
Delete inbox rulesets Delete inbox rulesets. Accepts optional inboxId filter. | def delete_inbox_rulesets(opts = {})
delete_inbox_rulesets_with_http_info(opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_inbox_ruleset(id, opts = {})\n delete_inbox_ruleset_with_http_info(id, opts)\n nil\n end",
"def delete_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.delete_inbox_rulesets ...... | [
"0.7091587",
"0.68988985",
"0.6226191",
"0.59654415",
"0.5943421",
"0.5937195",
"0.56038946",
"0.54905397",
"0.54545236",
"0.54135305",
"0.5299187",
"0.5285349",
"0.5271623",
"0.5268008",
"0.5263276",
"0.52274543",
"0.51354396",
"0.51113975",
"0.51058125",
"0.50943893",
"0.50... | 0.8147999 | 0 |
Delete inbox rulesets Delete inbox rulesets. Accepts optional inboxId filter. | def delete_inbox_rulesets_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.delete_inbox_rulesets ...'
end
# resource path
local_var_path = '/rulesets'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
# header parameters
header_params = opts[:header_params] || {}
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type]
# auth_names
auth_names = opts[:auth_names] || ['API_KEY']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: InboxRulesetControllerApi#delete_inbox_rulesets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_inbox_rulesets(opts = {})\n delete_inbox_rulesets_with_http_info(opts)\n nil\n end",
"def delete_inbox_ruleset(id, opts = {})\n delete_inbox_ruleset_with_http_info(id, opts)\n nil\n end",
"def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n ... | [
"0.8147999",
"0.7091587",
"0.6226191",
"0.59654415",
"0.5943421",
"0.5937195",
"0.56038946",
"0.54905397",
"0.54545236",
"0.54135305",
"0.5299187",
"0.5285349",
"0.5271623",
"0.5268008",
"0.5263276",
"0.52274543",
"0.51354396",
"0.51113975",
"0.51058125",
"0.50943893",
"0.509... | 0.68988985 | 2 |
Get an inbox ruleset Get inbox ruleset | def get_inbox_ruleset(id, opts = {})
data, _status_code, _headers = get_inbox_ruleset_with_http_info(id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end",
"def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end",
"def test_inbox_ru... | [
"0.7306557",
"0.66872704",
"0.6485104",
"0.6325704",
"0.61333424",
"0.60435486",
"0.58460385",
"0.57955986",
"0.57066685",
"0.5694549",
"0.55562836",
"0.55260766",
"0.54777145",
"0.54563564",
"0.54500496",
"0.5356801",
"0.5356801",
"0.5356363",
"0.52597237",
"0.5253154",
"0.5... | 0.660201 | 2 |
Get an inbox ruleset Get inbox ruleset | def get_inbox_ruleset_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_ruleset ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling InboxRulesetControllerApi.get_inbox_ruleset"
end
# resource path
local_var_path = '/rulesets/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# 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(['*/*'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'InboxRulesetDto'
# auth_names
auth_names = opts[:auth_names] || ['API_KEY']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: InboxRulesetControllerApi#get_inbox_ruleset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end",
"def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end",
"def get_inbox_rul... | [
"0.7306557",
"0.66872704",
"0.660201",
"0.6485104",
"0.6325704",
"0.61333424",
"0.60435486",
"0.58460385",
"0.57955986",
"0.57066685",
"0.5694549",
"0.55562836",
"0.55260766",
"0.54777145",
"0.54500496",
"0.5356801",
"0.5356801",
"0.5356363",
"0.52597237",
"0.5253154",
"0.523... | 0.54563564 | 14 |
List inbox rulesets List all rulesets attached to an inbox | def get_inbox_rulesets(opts = {})
data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end",
"def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n ... | [
"0.76426435",
"0.7247974",
"0.6769916",
"0.64807636",
"0.61858845",
"0.6144545",
"0.612242",
"0.60838485",
"0.60390484",
"0.60120493",
"0.59073216",
"0.58550584",
"0.57910347",
"0.57639754",
"0.5679666",
"0.5676389",
"0.5623009",
"0.55354303",
"0.55354303",
"0.5493309",
"0.54... | 0.7625467 | 1 |
List inbox rulesets List all rulesets attached to an inbox | def get_inbox_rulesets_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_rulesets ...'
end
allowable_values = ["ASC", "DESC"]
if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/rulesets'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil?
query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'PageInboxRulesetDto'
# auth_names
auth_names = opts[:auth_names] || ['API_KEY']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: InboxRulesetControllerApi#get_inbox_rulesets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end",
"def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end",
"def ruleset_rules... | [
"0.76426435",
"0.7625467",
"0.7247974",
"0.6769916",
"0.64807636",
"0.61858845",
"0.6144545",
"0.612242",
"0.60838485",
"0.60390484",
"0.60120493",
"0.59073216",
"0.57910347",
"0.57639754",
"0.5679666",
"0.5676389",
"0.5623009",
"0.55354303",
"0.55354303",
"0.5493309",
"0.548... | 0.58550584 | 12 |
Test an inbox ruleset Test an inbox ruleset | def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})
data, _status_code, _headers = test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end",
"def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_o... | [
"0.68785197",
"0.6313421",
"0.59523785",
"0.58934397",
"0.5879393",
"0.56199455",
"0.55669504",
"0.5560386",
"0.5536923",
"0.55095834",
"0.5430169",
"0.5301235",
"0.5293016",
"0.52534896",
"0.52376497",
"0.5207789",
"0.51600164",
"0.51548076",
"0.51447135",
"0.5132889",
"0.51... | 0.6450755 | 1 |
Test an inbox ruleset Test an inbox ruleset | def test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_ruleset ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling InboxRulesetControllerApi.test_inbox_ruleset"
end
# verify the required parameter 'inbox_ruleset_test_options' is set
if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?
fail ArgumentError, "Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_ruleset"
end
# resource path
local_var_path = '/rulesets/{id}/test'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# 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(['*/*'])
# 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[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options)
# return_type
return_type = opts[:return_type] || 'InboxRulesetTestResult'
# auth_names
auth_names = opts[:auth_names] || ['API_KEY']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: InboxRulesetControllerApi#test_inbox_ruleset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end",
"def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})\n data, ... | [
"0.68785197",
"0.6450755",
"0.6313421",
"0.59523785",
"0.58934397",
"0.5879393",
"0.55669504",
"0.5560386",
"0.5536923",
"0.55095834",
"0.5430169",
"0.5301235",
"0.5293016",
"0.52534896",
"0.52376497",
"0.5207789",
"0.51600164",
"0.51548076",
"0.51447135",
"0.5132889",
"0.512... | 0.56199455 | 6 |
Test inbox rulesets for inbox Test inbox rulesets for inbox | def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})
data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...'\n end\n # verify the required parameter 'inbox_id' i... | [
"0.6427489",
"0.6315927",
"0.60893935",
"0.58721715",
"0.5780896",
"0.5497661",
"0.5484492",
"0.5480035",
"0.5434681",
"0.54239094",
"0.53774464",
"0.53744745",
"0.5336081",
"0.51936847",
"0.51283765",
"0.51251245",
"0.5080757",
"0.50705403",
"0.5008124",
"0.49881157",
"0.498... | 0.72629654 | 0 |
Test inbox rulesets for inbox Test inbox rulesets for inbox | def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...'
end
# verify the required parameter 'inbox_id' is set
if @api_client.config.client_side_validation && inbox_id.nil?
fail ArgumentError, "Missing the required parameter 'inbox_id' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox"
end
# verify the required parameter 'inbox_ruleset_test_options' is set
if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?
fail ArgumentError, "Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox"
end
# resource path
local_var_path = '/rulesets'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'inboxId'] = inbox_id
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
# 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[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options)
# return_type
return_type = opts[:return_type] || 'InboxRulesetTestResult'
# auth_names
auth_names = opts[:auth_names] || ['API_KEY']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: InboxRulesetControllerApi#test_inbox_rulesets_for_inbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end",
"def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})\n data, ... | [
"0.72629654",
"0.6315927",
"0.60893935",
"0.58721715",
"0.5780896",
"0.5497661",
"0.5484492",
"0.5480035",
"0.5434681",
"0.54239094",
"0.53774464",
"0.53744745",
"0.5336081",
"0.51936847",
"0.51283765",
"0.51251245",
"0.5080757",
"0.50705403",
"0.5008124",
"0.49881157",
"0.49... | 0.6427489 | 1 |
Test new inbox ruleset Test new inbox ruleset | def test_new_inbox_ruleset(test_new_inbox_ruleset_options, opts = {})
data, _status_code, _headers = test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end",
"def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_o... | [
"0.64125824",
"0.60827935",
"0.5998476",
"0.5913734",
"0.56242436",
"0.5592575",
"0.55215394",
"0.5515756",
"0.5394641",
"0.53827137",
"0.5276402",
"0.5274095",
"0.5244903",
"0.52198315",
"0.52137554",
"0.51923436",
"0.5175251",
"0.5127945",
"0.5124497",
"0.5117424",
"0.50990... | 0.6669657 | 0 |
Test new inbox ruleset Test new inbox ruleset | def test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_new_inbox_ruleset ...'
end
# verify the required parameter 'test_new_inbox_ruleset_options' is set
if @api_client.config.client_side_validation && test_new_inbox_ruleset_options.nil?
fail ArgumentError, "Missing the required parameter 'test_new_inbox_ruleset_options' when calling InboxRulesetControllerApi.test_new_inbox_ruleset"
end
# resource path
local_var_path = '/rulesets'
# 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(['*/*'])
# 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[:body] || @api_client.object_to_http_body(test_new_inbox_ruleset_options)
# return_type
return_type = opts[:return_type] || 'InboxRulesetTestResult'
# auth_names
auth_names = opts[:auth_names] || ['API_KEY']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: InboxRulesetControllerApi#test_new_inbox_ruleset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_new_inbox_ruleset(test_new_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts)\n data\n end",
"def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_c... | [
"0.6669657",
"0.64125824",
"0.60827935",
"0.5913734",
"0.56242436",
"0.5592575",
"0.55215394",
"0.5515756",
"0.5394641",
"0.53827137",
"0.5276402",
"0.5274095",
"0.5244903",
"0.52198315",
"0.52137554",
"0.51923436",
"0.5175251",
"0.5127945",
"0.5124497",
"0.5117424",
"0.50990... | 0.5998476 | 3 |
this function merge the pr branch into target branch, where the author of pr wanted to submit | def goto_prj_dir(repo)
git_repo_dir = @git_dir + "/" + repo.split('/')[1]
# chech that dir exist, otherwise clone it
if File.directory?(@git_dir) == false
FileUtils.mkdir_p(@git_dir)
Dir.chdir @git_dir
puts `git clone git@github.com:#{repo}.git`
end
begin
# /tmp/gitbot, this is in case the dir already exists
Dir.chdir git_repo_dir
rescue
# this is in case we clone the repo
Dir.chdir repo.split('/')[1]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_pr_totarget(upstream, pr_branch)\n goto_prj_dir\n check_git_dir\n `git checkout #{upstream}`\n check_duplicata_pr_branch(\"#{pr_fix}#{pr_branch}\")\n `git remote update`\n `git fetch`\n `git pull origin #{upstream}`\n `git checkout -b #{pr_fix}#{pr_branch} origin/#{pr_branch}`\n ... | [
"0.742202",
"0.7404796",
"0.6897114",
"0.6328288",
"0.6287318",
"0.6116008",
"0.5946049",
"0.59200597",
"0.59033775",
"0.58943677",
"0.58930343",
"0.5880678",
"0.58181566",
"0.577461",
"0.57574403",
"0.5752447",
"0.5744066",
"0.5736197",
"0.5690128",
"0.5679538",
"0.56374127"... | 0.0 | -1 |
merge pr_branch into upstream targeted branch | def merge_pr_totarget(upstream, pr_branch, repo)
goto_prj_dir(repo)
# check that we are in a git dir
check_git_dir
`git checkout #{upstream}`
`git remote update`
`git fetch`
`git pull origin #{upstream}`
`git checkout -b PR-#{pr_branch} origin/#{pr_branch}`
puts `git branch`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_pr_totarget(upstream, pr_branch)\n goto_prj_dir\n check_git_dir\n `git checkout #{upstream}`\n check_duplicata_pr_branch(\"#{pr_fix}#{pr_branch}\")\n `git remote update`\n `git fetch`\n `git pull origin #{upstream}`\n `git checkout -b #{pr_fix}#{pr_branch} origin/#{pr_branch}`\n ... | [
"0.8051848",
"0.6836924",
"0.6743151",
"0.6703898",
"0.6445372",
"0.63865745",
"0.6333562",
"0.6296837",
"0.6247566",
"0.6168456",
"0.61101",
"0.6103195",
"0.60160255",
"0.6002186",
"0.6000863",
"0.59704703",
"0.59190494",
"0.587834",
"0.5839706",
"0.5823195",
"0.582193",
"... | 0.8003641 | 1 |
cleanup the pr_branch(delete it) | def del_pr_branch(upstream, pr)
`git checkout #{upstream}`
`git branch -D PR-#{pr}`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del_pr_branch(upstream, pr)\n `git checkout #{upstream}`\n `git branch -D #{pr_fix}#{pr}`\n end",
"def clean_tree(branch)\n\n branch.children = branch.children.inject(Children.new(branch)) do |r, c|\n cc = if c.name == 'sequence' and c.children.size == 1\n c.children.first\n ... | [
"0.7179789",
"0.6870446",
"0.678229",
"0.678229",
"0.6617888",
"0.6564336",
"0.6564336",
"0.6541621",
"0.6541621",
"0.6541621",
"0.6541621",
"0.651397",
"0.651397",
"0.651397",
"0.6484305",
"0.6484305",
"0.6484305",
"0.6484305",
"0.647548",
"0.647548",
"0.6420382",
"0.64040... | 0.711742 | 1 |
Only allow a trusted parameter "white list" through. | def update_basic_model_params
params.require(:basic_model).permit(:name, :description)
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 |
before date 20140723 all data 20140724 tradedate after date 20140724 all data 20140725 tradedate | def quotationfileprocess path
File.open(path, 'r') do |file|
file.each_line do |line|
cols = line.force_encoding('gb2312').split("\t")
if /\d{6}/ =~ cols[0][2..7].strip
#added new quotation
q = Quotation.new
q.marketdate = tradedate
q.code = cols[0][2..7].strip
q.name = cols[1].strip
q.cqstatus = 'chuquan' unless q.name[0..1] != 'XD'
q.plate = cols[18].strip
if cols[11].strip == '--'
preq = Quotation.find_by(marketdate: pretradedate, code: q.code)
q.open = 0
q.high = 0
q.low = 0
q.close = cols[14].strip
q.dprofit = 0
q.tpstatus = 'tingpai'
else
q.open = cols[11].strip
q.high = cols[12].strip
q.low = cols[13].strip
q.close = cols[3].strip
q.dprofit = cols[2].strip
end
q.save
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_date(stock_data)\n stock_data.map { |date| date.trade_date }\n end",
"def stock_picker(data) \n\tday1 = 0\n\twhile day1 < data.length - 1\n\t\tday2 = day1 + 1\t\n\t\twhile day2 < data.length\n\t\t\tprofit ||= 0 #initialize profit at 0\n\t\t\tif data[day2] - data[day1] > profit\n\t\t\t\tprofit = da... | [
"0.612637",
"0.5765744",
"0.57104886",
"0.55969465",
"0.5443216",
"0.5436239",
"0.5429118",
"0.5402995",
"0.5389769",
"0.53847605",
"0.53809094",
"0.53223085",
"0.5309074",
"0.5289704",
"0.52865505",
"0.52699673",
"0.526799",
"0.52490634",
"0.52456653",
"0.52250874",
"0.52250... | 0.0 | -1 |
Start a pryremoteem server | def run(obj, host = DEFHOST, port = DEFPORT, opts = {:tls => false})
tries = :auto == port ? 100.tap{ port = DEFPORT } : 1
# TODO raise a useful exception not RuntimeError
raise "root permission required for port below 1024 (#{port})" if port < 1024 && Process.euid != 0
begin
EM.start_server(host, port, PryRemoteEm::Server, obj, opts) do |pre|
Fiber.new {
begin
yield pre if block_given?
#Pry.start(obj, :input => pre, :output => pre)
pry_instance.input = pre
pry_instance.output = pre
pry_instance.repl
ensure
pre.close_connection
end
}.resume
end
rescue => e
# EM 1.0.0.beta4's message tells us the port is in use; 0.12.10 just says, 'no acceptor'
if (e.message.include?('port is in use') || e.message.include?('no acceptor')) && tries >= 1
tries -= 1
port += 1
retry
end
raise e
end
scheme = opts[:tls] ? 'pryems' : 'pryem'
(opts[:logger] || ::Logger.new(STDERR)).info("[pry-remote-em] listening for connections on #{scheme}://#{host}:#{port}/")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_server\n erl = CliRunner.open 'skirmish_server', 'erl', /\\d>/, /Eshell/\n erl << \"code:add_path(\\\"#{server_dir}/ebin\\\").\" >> /true/\n erl << \"application:start(skirmish_server).\" >> /ok/\n @automation_server = erl\n log.info(\"Automation#start_server\") { \"server star... | [
"0.63203704",
"0.61644065",
"0.61449873",
"0.60924476",
"0.6028563",
"0.6018178",
"0.58099306",
"0.57852554",
"0.5699426",
"0.5672735",
"0.56571615",
"0.56401294",
"0.563884",
"0.5634684",
"0.56253934",
"0.56201166",
"0.556598",
"0.5563213",
"0.55624896",
"0.55548394",
"0.554... | 0.6956129 | 0 |
run(obj, host = DEFHOST, port = DEFPORT) The list of pryremoteem connections for a given object, or the list of all pryremoteem connections for this process. The peer list is used when broadcasting messages between connections. | def peers(obj = nil)
@peers ||= {}
obj.nil? ? @peers.values.flatten : (@peers[obj] ||= [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(obj, host = DEFHOST, port = DEFPORT, opts = {:tls => false})\n tries = :auto == port ? 100.tap{ port = DEFPORT } : 1\n # TODO raise a useful exception not RuntimeError\n raise \"root permission required for port below 1024 (#{port})\" if port < 1024 && Process.euid != 0\n begin\... | [
"0.66141766",
"0.5685814",
"0.5447587",
"0.5206275",
"0.51846236",
"0.5155107",
"0.5141587",
"0.5111461",
"0.510834",
"0.5048246",
"0.5025278",
"0.49100885",
"0.48911005",
"0.48559332",
"0.48534557",
"0.4838163",
"0.4836324",
"0.48361152",
"0.4830353",
"0.48205438",
"0.482022... | 0.5155629 | 5 |
Record the association between a given object and a given pryremoteem connection. | def register(obj, peer)
peers(obj).tap { |plist| plist.include?(peer) || plist.push(peer) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_associated_object(opts, o)\n raise(Error, \"associated object #{o.inspect} does not have a primary key\") if o && !o.pk\n _set_associated_object(opts, o)\n end",
"def connection_established(pid, conn)\n @connections[pid.uuid] ||= conn\n __send__(conn.connected_callback,... | [
"0.56070936",
"0.54814255",
"0.54501635",
"0.5445855",
"0.54047143",
"0.53537416",
"0.53358924",
"0.5321213",
"0.5310794",
"0.5300171",
"0.5268312",
"0.5266322",
"0.52365273",
"0.5233372",
"0.52143663",
"0.52002984",
"0.5198543",
"0.5160214",
"0.51321083",
"0.5128225",
"0.509... | 0.4607448 | 92 |
Remove the association between a given object and a given pryremoteem connection. | def unregister(obj, peer)
peers(obj).tap {|plist| true while plist.delete(peer) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_connection(relation_name, other_object, bidi)\n return Relation.delete(relation_name, self.node, other_object.node, bidi)\n end",
"def remove_association(server_url, handle)\n raise NotImplementedError\n end",
"def remove_associated_object(opts, o)\n raise(Sequel::Error, 'model obje... | [
"0.67301714",
"0.65093297",
"0.6493623",
"0.6415994",
"0.63365436",
"0.6322572",
"0.6269781",
"0.6254589",
"0.6248836",
"0.62135637",
"0.6198612",
"0.6184476",
"0.6069441",
"0.6059727",
"0.5975634",
"0.5964121",
"0.5946139",
"0.59359527",
"0.5907842",
"0.5901945",
"0.58937865... | 0.5416738 | 62 |
added by banisterfiend, return a hash of nests classes/modules for mod each key in hash is the class/module and the value is true/false indicating whether nested classes exist under it | def browser_hash_for(mod)
mod.constants(false).each_with_object({}) do |c, h|
if (o = mod.const_get(c)).is_a?(Module) then
begin
h[c] = o.constants(false).any? { |c| o.const_get(c).is_a? Module }
rescue
next
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classes\n return @classes if @classes\n @classes = {}\n @stores.each do |store|\n store.cache[:modules].each do |mod|\n # using default block causes searched-for modules to be added\n @classes[mod] ||= []\n @classes[mod] << store\n end\n end\n @classes\n end",
"... | [
"0.6395142",
"0.6385925",
"0.614291",
"0.61214894",
"0.61214894",
"0.61053467",
"0.60452676",
"0.6024766",
"0.59719145",
"0.59102803",
"0.5880091",
"0.5873416",
"0.5837326",
"0.5827594",
"0.5812675",
"0.5805403",
"0.5781596",
"0.57295495",
"0.5708816",
"0.5708816",
"0.5669319... | 0.6062787 | 6 |
Sends a chat message to the client. | def send_message(msg, from = nil)
msg = "#{msg} (@#{from})" unless from.nil?
@auth_required ? @after_auth.push({:m => msg}) : send_data({:m => msg})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_message(jid,text)\n m = Jabber::Message.new(jid, text)\n m.set_type :chat\n @client.send m\n end",
"def send_message(chat_id, message)\n ActionCable.server.broadcast \"Chat:#{chat_id}\", response: chat_message(message), type: 'message'\n end",
"def send_message(message)\n ... | [
"0.8093",
"0.7949052",
"0.78806484",
"0.772044",
"0.76901555",
"0.7440954",
"0.7390944",
"0.7244094",
"0.7238495",
"0.72367567",
"0.72233623",
"0.72135496",
"0.7116044",
"0.7068467",
"0.7053515",
"0.70520043",
"0.6998519",
"0.69644886",
"0.6891059",
"0.68759143",
"0.6875394",... | 0.0 | -1 |
Sends a chat message to the client. | def send_bmessage(msg, from = nil)
msg = "#{msg} (@#{from})" unless from.nil?
@auth_required ? @after_auth.push({:mb => msg}) : send_data({:mb => msg})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_message(jid,text)\n m = Jabber::Message.new(jid, text)\n m.set_type :chat\n @client.send m\n end",
"def send_message(chat_id, message)\n ActionCable.server.broadcast \"Chat:#{chat_id}\", response: chat_message(message), type: 'message'\n end",
"def send_message(message)\n ... | [
"0.8093",
"0.7949052",
"0.78806484",
"0.772044",
"0.76901555",
"0.7440954",
"0.7390944",
"0.7244094",
"0.7238495",
"0.72367567",
"0.72233623",
"0.72135496",
"0.7116044",
"0.7068467",
"0.7053515",
"0.70520043",
"0.6998519",
"0.69644886",
"0.6891059",
"0.68759143",
"0.6875394",... | 0.0 | -1 |
Callbacks for events on the server Registers a block to call when authentication is attempted. | def auth_attempt(*args, &blk)
block_given? ? @auth_attempt_cbs << blk : @auth_attempts.push(args)
while (auth_data = @auth_attempts.shift)
@auth_attempt_cbs.each { |cb| cb.call(*auth_data) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_login(&block)\n add_callback(:login, block)\n end",
"def after_custom_authentication; end",
"def callback\n rpx_auth\n after_auth(params[:on_complete_url])\n end",
"def on_connection_success &block\n @connection_success_callback = block\n end",
"def listen_account(&block)\n... | [
"0.7109251",
"0.6351356",
"0.6306088",
"0.62733257",
"0.62172306",
"0.6111113",
"0.61036783",
"0.6078022",
"0.60432506",
"0.5974429",
"0.595984",
"0.59598106",
"0.59377474",
"0.5932868",
"0.5932029",
"0.59099734",
"0.5870921",
"0.5825908",
"0.5808648",
"0.5808648",
"0.5778115... | 0.5676483 | 27 |
auth_attempt(args, &blk) Registers a block to call when authentication fails. | def auth_fail(*args, &blk)
block_given? ? @auth_fail_cbs << blk : @auth_fails.push(args)
while (fail_data = @auth_fails.shift)
@auth_fail_cbs.each { |cb| cb.call(*fail_data) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth_attempt(*args, &blk)\n block_given? ? @auth_attempt_cbs << blk : @auth_attempts.push(args)\n while (auth_data = @auth_attempts.shift)\n @auth_attempt_cbs.each { |cb| cb.call(*auth_data) }\n end\n end",
"def token_auth(*args, &block); end",
"def auth_ok(*args, &blk)\n bloc... | [
"0.79108554",
"0.58806264",
"0.5812654",
"0.5794389",
"0.57523674",
"0.56922996",
"0.5638406",
"0.55901074",
"0.5588444",
"0.5564731",
"0.55596066",
"0.55021936",
"0.5465623",
"0.5437874",
"0.5423029",
"0.5395928",
"0.5385815",
"0.538531",
"0.5371494",
"0.53482777",
"0.529639... | 0.66621166 | 1 |
auth_fail(args, &blk) Registers a block to call when authentication succeeds. | def auth_ok(*args, &blk)
block_given? ? @auth_ok_cbs << blk : @auth_oks.push(args)
while (ok_data = @auth_oks.shift)
@auth_ok_cbs.each { |cb| cb.call(*ok_data) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth_fail(*args, &blk)\n block_given? ? @auth_fail_cbs << blk : @auth_fails.push(args)\n while (fail_data = @auth_fails.shift)\n @auth_fail_cbs.each { |cb| cb.call(*fail_data) }\n end\n end",
"def auth_fail\n fail(Kankri::AuthenticationFailure)\n end",
"def failure\n\n\t\t#... | [
"0.80586606",
"0.69103783",
"0.6131274",
"0.6081329",
"0.6068126",
"0.6051085",
"0.59965783",
"0.59359205",
"0.5913045",
"0.5900398",
"0.58975923",
"0.58975923",
"0.58776444",
"0.58609706",
"0.5822489",
"0.5763486",
"0.5755156",
"0.57269037",
"0.57079226",
"0.56912273",
"0.56... | 0.58873034 | 12 |
auth_fail(args, &blk) Methods that make Server compatible with Pry | def readline(prompt)
@last_prompt = prompt
# FIXME, we're blocking prompt from being sent
@auth_required ? @after_auth.push({:p => prompt}) : nil #send_data({:p => prompt})
return @lines.shift unless @lines.empty?
@waiting = Fiber.current
return Fiber.yield
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth_fail(*args, &blk)\n block_given? ? @auth_fail_cbs << blk : @auth_fails.push(args)\n while (fail_data = @auth_fails.shift)\n @auth_fail_cbs.each { |cb| cb.call(*fail_data) }\n end\n end",
"def auth_fail\n fail(Kankri::AuthenticationFailure)\n end",
"def process_authoriz... | [
"0.7346566",
"0.72955227",
"0.6634425",
"0.65896666",
"0.65896666",
"0.64356595",
"0.64251995",
"0.640853",
"0.63257074",
"0.62805694",
"0.6242272",
"0.62215173",
"0.61934114",
"0.61055654",
"0.6080478",
"0.60166657",
"0.6003669",
"0.59989023",
"0.59822273",
"0.5981176",
"0.5... | 0.0 | -1 |
Convert the json map to the Config object | def json_to_config(name, json_map={})
backend = {
:name => name,
:healthcheck => {
:delay => 10000,
:timeout => 2000,
:failcount => 2,
:send => "'GET #{json_map['healthcheck_path']} HTTP/1.0'"
},
:hosts => json_map['backends'].collect! { |p|
asg_hosts_objects(p['asg_name'], p['host_opts'], json_map['app_port'])
}.flatten!
}
# build server list
listen_ports = [80]
listen_ports.push 443 if json_map['ssl']
matchers = json_map['endpoint_matchers'] ||= %w(/)
locations = matchers.collect! { |m|
{
:matcher => m,
:backend => name,
:keepalive_timeout => '75s'
}
}
cert_file = "/etc/nginx/config/#{SecureRandom.uuid.to_s}.crt"
cert_key = "/etc/nginx/config/#{SecureRandom.uuid.to_s}.key"
if json_map['ssl_cert'] && json_map['ssl_cert_key']
# download ssl certs and key
File.open(cert_file, 'w') do |file|
AWS::S3::S3Object.stream(json_map['ssl_cert'], @bucket) do |chunk|
file.write(chunk)
end
end
File.open(cert_key, 'w') do |file|
AWS::S3::S3Object.stream(json_map['ssl_cert_key'], @bucket) do |chunk|
file.write(chunk)
end
end
end
server = {
:listen => listen_ports,
:server_name => json_map['public_dns'],
:ssl => {
:certificate => cert_file,
:certificate_key => cert_key,
:ssl_session_timeout => '5m'
},
:locations => locations
}
Config.new({
:name => name, # becomes the filename / app_name
:backend => backend, # identifies the merged server set that handles the requests (gets load balanced)
:server => server # locations that are being load balanced over the backend servers
})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_config\n self.config = JSON.load(self.data)\n end",
"def load_config\n self.config = JSON.load(self.data)\n end",
"def load_config\n self.config = JSON.load(self.data)\n end",
"def set_json(json)\n @map = Oj.load(json)\n end",
"def parsed_config\n @parsed_config ||= begin\n ... | [
"0.6605796",
"0.6605796",
"0.6541631",
"0.6215872",
"0.5877206",
"0.5875126",
"0.58186215",
"0.5814737",
"0.5814737",
"0.55717707",
"0.55717707",
"0.5550272",
"0.55458",
"0.55438673",
"0.55374646",
"0.55374646",
"0.5505102",
"0.5490747",
"0.54509175",
"0.5397277",
"0.5394319"... | 0.6248806 | 3 |
Determine the list(with properties) of the running instances in the given autoscaling group if asg_name is nil it returns nil | def running_hosts_in_asg(asg_name)
return nil unless asg_name
asg = @auto_scaling.groups[asg_name]
return nil unless asg
# return a lost of maps having the list of running instances
asg.auto_scaling_instances.collect { |i|
if i.health_status != 'Healthly'
ec2instance = i.ec2_instance.dns_name
{
:instance_id => ec2instance.id,
:health_status => i.health_status,
:public_dns => ec2instance.dns_name,
:ip => ec2instance.ip_address
}
else
nil
end }.compact!.sort { |x,y| x.instance_id <=> y.instance_id }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autoscaling_instances\n autoscaling_group.auto_scaling_instances\n end",
"def autoscaling_instances\n autoscaling_group.auto_scaling_instances\n end",
"def list_asgs\n # collect the list of running instances in this zone\n ec2 = AWS::EC2.new\n region = ec2.regions[AMI_REGION]\n instanc... | [
"0.7375907",
"0.7375907",
"0.70902634",
"0.6642567",
"0.64987755",
"0.6257543",
"0.61650634",
"0.60263926",
"0.596555",
"0.5959928",
"0.5895302",
"0.58703625",
"0.58542144",
"0.5844213",
"0.5843603",
"0.5732009",
"0.5724304",
"0.5686478",
"0.5668869",
"0.55124885",
"0.5493279... | 0.77462995 | 0 |
If the Elastic IP is unhealthy/unreachable, we will try to assign the Elastic IP to this instance | def try_steal_eip
unless eip_healthy?
# try to steal the eip
eip_instance = @ec2.elastic_ips[@eip]
raise "cannot find #{@eip} in list of elastic IPs" unless eip_instance
instance = @ec2.instances[my_instance_id]
instance.associate_elastic_ip(eip_instance)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aws_instance_elastic_ip_create(instance)\n log \"AWS: creating ElasticIP for Instance '#{instance.id}'\"\n # get elastic ip object\n elastic_ip = aws_call('aws_elastic_ip_create')\n log \"AWS: created ElasticIP '#{elastic_ip.public_ip}'\"\n\n # this is interesting, perhaps elastic ips dont have ... | [
"0.73278844",
"0.6686053",
"0.6594199",
"0.6590179",
"0.6534397",
"0.6395143",
"0.6360093",
"0.63496107",
"0.6334051",
"0.6249226",
"0.6174922",
"0.61516446",
"0.6123249",
"0.60844904",
"0.60332716",
"0.601612",
"0.5988108",
"0.59795195",
"0.5958159",
"0.5946782",
"0.5938979"... | 0.73130995 | 1 |
Fetches the instance id for the current machine | def my_instance_id
Net::HTTP.get(URI('http://169.254.169.254/1.0/meta-data/instance-id'))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_instance_id\n metadata_endpoint = 'http://169.254.169.254/latest/meta-data/'\n instance_id = Net::HTTP.get( URI.parse( metadata_endpoint + 'instance-id' ) )\n end",
"def instance_id\n data[:instance_id]\n end",
"def instance_id\n `curl --connect-timeout 1 #{aws_url} 2>&1`... | [
"0.7857428",
"0.7545339",
"0.7476348",
"0.7406198",
"0.73788303",
"0.73788303",
"0.73735946",
"0.72641224",
"0.726",
"0.7204595",
"0.7121513",
"0.6947031",
"0.6941511",
"0.6844466",
"0.6708967",
"0.6573709",
"0.6555427",
"0.6555427",
"0.6555427",
"0.6555427",
"0.6555427",
"... | 0.80713713 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.