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 |
|---|---|---|---|---|---|---|
read line for Rover Instructions and Update Rover Position | def handle_rover_move_instructions(file)
line_reader = self.read_instruction_line(file, "")
self.parse_instructions(line_reader)
self.output_rover_coordinates
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_rover_position_instruction(file)\n\t\tline_reader = self.read_instruction_line(file, \" \")\n\t\tself.set_rover_start_coordinates(line_reader)\n\tend",
"def process_rovers\n # Processes 2 lines at a time\n STDIN.each_slice(2).each_with_index do |lines, index|\n rover_x, rover_y, rover_face ... | [
"0.711014",
"0.6797024",
"0.6425352",
"0.6018085",
"0.59480613",
"0.5948014",
"0.5737831",
"0.5642601",
"0.559898",
"0.5594633",
"0.55680156",
"0.55361515",
"0.5497756",
"0.53914374",
"0.53759044",
"0.5371895",
"0.5370546",
"0.53644913",
"0.53597766",
"0.534787",
"0.53300184"... | 0.62885267 | 3 |
O(nlogn) (quicksort is technically O(n^2)) | def okay_two_sum?(arr, target_sum)
sorted = arr.sort
low, high = 0, arr.length - 1
until low >= high
case sorted[low] + sorted[high] <=> target_sum
when -1
low += 1
when 0
return true
when 1
high -= 1
end
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quicksort (a)\n return [] if a.empty? || a.nil?\n p = a.shift\n quicksort(a.select { |n| n < p }) + [p] + quicksort(a.select { |n| n >= p })\nend",
"def quick_sort(list)\n sl = list.clone\n return sl if sl.size <= 1\n pivot = sl.pop\n left, right = sl.partition { |e| e < pivot }\n quick_sort(left) + ... | [
"0.7621851",
"0.7456632",
"0.7407262",
"0.73609996",
"0.72643715",
"0.72628933",
"0.7255032",
"0.7249635",
"0.72268975",
"0.72247356",
"0.7215464",
"0.72084135",
"0.71970004",
"0.71876633",
"0.7166872",
"0.7164031",
"0.71506214",
"0.7125805",
"0.71234703",
"0.71162844",
"0.71... | 0.0 | -1 |
delegate instance methods of a set of classes options: to: name of thing to delegate to (default :model) without_methods_of: array of classes whose instance methods to remove from delegation (default: [Object]) with_default_methods: true/false on whether or not to delegate the DEFAULT_METHODS_TO_ALWAYS_DELEGATE anyway (even if without_methods_of would have removed them) (default: true) with_extra_methods: array of other methods to delegate that are not present in the instance_methods from the provided classes (default: []) | def delegate_instance_methods_of(*model_classes)
delegate_options = {
to: :model,
without_methods_of: Object,
with_default_methods: true,
with_extra_methods: [],
}
delegate_options = delegate_options.merge(model_classes.pop) if model_classes.last.is_a? Hash
# make sure each AR class is fully realised with methods for
# their db attributes
model_classes.each do |model_class|
if model_class.respond_to?(:define_attribute_methods)
model_class.define_attribute_methods
end
end
methods = model_classes.map(&:instance_methods).flatten.uniq
without_methods_of = delegate_options.delete(:without_methods_of)
Array.wrap(without_methods_of).each { |without| methods -= without.instance_methods }
methods += DEFAULT_METHODS_TO_ALWAYS_DELEGATE if delegate_options.delete(:with_default_methods)
methods += Array.wrap(delegate_options.delete(:with_extra_methods))
delegate(*methods, **delegate_options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delegate_methods_to(methods, ivar)\n return if methods.blank?\n def_delegators ivar, *methods\n end",
"def delegate(*methods, to: nil, **options)\n if to.nil?\n Makeover.deprecator.deprecation_warning 'delegate without specifying :to'\n end\n to ||= :model\n supe... | [
"0.67472744",
"0.63247496",
"0.6321973",
"0.6212295",
"0.60385",
"0.5932358",
"0.5859709",
"0.5822726",
"0.582013",
"0.58074003",
"0.57930535",
"0.57754576",
"0.5707195",
"0.5707195",
"0.5637052",
"0.558184",
"0.5548971",
"0.5538921",
"0.55313045",
"0.5503542",
"0.54778",
"... | 0.7988982 | 0 |
The main program. Tests are listed below this point. All tests should call the "result" function to report if they pass or fail. | def write_config()
afile = File.open("cp3nodes.conf", "w")
afile.puts "1 127.0.0.1 25500 25501 25502\n"
afile.puts "2 127.0.0.1 25503 25504 25505\n"
afile.puts "3 127.0.0.1 25506 25507 25508\n"
afile.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n print_banner\n @test_plan.each do |plan|\n found_nodes = nodes(plan)\n if found_nodes\n found_nodes.each { |node| execute_plan_tests(node, plan) }\n end\n end\n exit @ret_code\n end",
"def run_test\n if validate(@test)\n generate(@test)\n else\n... | [
"0.692984",
"0.68886673",
"0.6855937",
"0.6800343",
"0.6757012",
"0.6734945",
"0.6723782",
"0.6713501",
"0.6700191",
"0.6687761",
"0.6626221",
"0.65901685",
"0.65891665",
"0.6564998",
"0.65396994",
"0.65112835",
"0.65058005",
"0.65016365",
"0.64784646",
"0.64605045",
"0.64285... | 0.0 | -1 |
Go through the config file, looking for the "id" passed, and spawn it | def spawn_daemon(id)
afile = File.open("cp3nodes.conf", "r")
afile.each_line do |line|
line.chomp!
(nodeid, ip, lport, dport, sport)=line.split
if(nodeid.to_i == id) # dont forget to convert to int
system("./srouted -i #{id} -c cp3nodes.conf &")
return 1
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spawn_daemon(file,id)\nafile = File.open(file, \"r\")\nafile.each_line do |line|\n\tline.chomp!\n\t(nodeid, ip, lport, dport, sport)=line.split\n\tif(nodeid.to_i == id) # dont forget to convert to int\n\t\tputs \"./srouted -i #{id} -c #{file} -a 1 &\"\n\t system(\"./srouted -i #{id} -c #{file} -a 1 &> /dev/n... | [
"0.652998",
"0.6111608",
"0.57430685",
"0.5432896",
"0.54233474",
"0.5351172",
"0.53185856",
"0.53120404",
"0.53046715",
"0.5280442",
"0.5252598",
"0.5168293",
"0.5152584",
"0.5121224",
"0.50918406",
"0.5089334",
"0.50776577",
"0.50640404",
"0.5062283",
"0.5055004",
"0.504922... | 0.71212333 | 0 |
GET /vehicle_repairs/1 GET /vehicle_repairs/1.xml | def show
@fleet = Fleet.find params[:fleet_id]
@vehicle = @fleet.vehicles.find params[:vehicle_id]
@vehicle_repair = @vehicle.vehicle_repairs.find params[:id]
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @vehicle_repair }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @rip = Rip.find params[:id]\n respond_to do |format|\n format.html\n format.xml { render :xml => @rip.to_xml }\n end\n end",
"def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vehicles }\n ... | [
"0.6213812",
"0.61656594",
"0.60316527",
"0.6017957",
"0.6017957",
"0.5999155",
"0.5951554",
"0.59262705",
"0.58799165",
"0.5878705",
"0.58638847",
"0.57571036",
"0.57369506",
"0.5709668",
"0.5709668",
"0.57029396",
"0.56995547",
"0.5698008",
"0.5696017",
"0.5693696",
"0.5692... | 0.70617795 | 0 |
GET /vehicle_repairs/new GET /vehicle_repairs/new.xml | def new
@fleet = Fleet.find params[:fleet_id]
@vehicle = @fleet.vehicles.find(params[:vehicle_id])
@vehicle_repair = @vehicle.vehicle_repairs.new
@vehicle_repair.vehicle_repair_details.build
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @vehicle_repair }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @vehicle = Vehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vehicle }\n end\n end",
"def new\n @vehicle = Vehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vehicle }\... | [
"0.69951355",
"0.69951355",
"0.6981778",
"0.6964425",
"0.6945397",
"0.68525785",
"0.68297935",
"0.68297935",
"0.67778635",
"0.67679834",
"0.6744228",
"0.67151225",
"0.67057395",
"0.66996264",
"0.66833043",
"0.6669079",
"0.6669079",
"0.6669079",
"0.6659103",
"0.6642412",
"0.66... | 0.6975903 | 3 |
POST /vehicle_repairs POST /vehicle_repairs.xml | def create
@fleet = Fleet.find params[:fleet_id]
@vehicle = @fleet.vehicles.find params[:vehicle_id]
@vehicle_repair = @vehicle.vehicle_repairs.new(params[:vehicle_repair])
respond_to do |format|
if @vehicle_repair.save
format.html { redirect_to(fleet_vehicle_vehicle_repairs_path(@fleet, @vehicle), :notice => 'Vehicle repair was successfully created.') }
format.xml { render :xml => @vehicle_repair, :status => :created, :location => @vehicle_repair }
else
format.html { render :action => "new" }
format.xml { render :xml => @vehicle_repair.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @fleet = Fleet.find params[:fleet_id]\n @vehicle = @fleet.vehicles.find params[:vehicle_id]\n @tire = @vehicle.tires.new(params[:tire])\n \n respond_to do |format|\n if @tire.save\n format.html { redirect_to(fleet_vehicle_tires_path(@fleet, @vehicle), :notice => 'Tire records ... | [
"0.5982461",
"0.5936233",
"0.5683107",
"0.55492574",
"0.53871655",
"0.5333787",
"0.5327881",
"0.5320917",
"0.5201351",
"0.5179054",
"0.51664054",
"0.5158608",
"0.5146325",
"0.5128416",
"0.5123741",
"0.51201147",
"0.5112353",
"0.5106618",
"0.5094026",
"0.50851375",
"0.5051685"... | 0.6856522 | 0 |
PUT /vehicle_repairs/1 PUT /vehicle_repairs/1.xml | def update
@vehicle_repair = VehicleRepair.find(params[:id])
respond_to do |format|
if @vehicle_repair.update_attributes(params[:vehicle_repair])
format.html { redirect_to(@vehicle_repair, :notice => 'Vehicle repair was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @vehicle_repair.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @vehicle = Vehicle.find(params[:id])\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to([@vehicle.fleet,@vehicle], :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html ... | [
"0.60812527",
"0.6030491",
"0.5848089",
"0.5847514",
"0.5847514",
"0.5844218",
"0.57764447",
"0.57528377",
"0.56905955",
"0.565256",
"0.5560028",
"0.5560028",
"0.55596703",
"0.5543802",
"0.5543045",
"0.5505321",
"0.5504468",
"0.5492404",
"0.5488948",
"0.5471152",
"0.5456835",... | 0.57418734 | 8 |
DELETE /vehicle_repairs/1 DELETE /vehicle_repairs/1.xml | def destroy
@fleet = Fleet.find params[:fleet_id]
@vehicle = @fleet.vehicles.find params[:vehicle_id]
@vehicle_repair = @vehicle.vehicle_repairs.find(params[:id])
@vehicle_repair.destroy
respond_to do |format|
format.html { redirect_to(fleet_vehicle_vehicle_repairs_path(@fleet, @vehicle), :notice => 'Vehicle repair was successfully created.') }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @vehicle = Vehicle.find(params[:id])\n @v... | [
"0.6711837",
"0.646639",
"0.6408859",
"0.63583755",
"0.63583755",
"0.63315207",
"0.62996745",
"0.62807333",
"0.627298",
"0.6209543",
"0.6208036",
"0.62061614",
"0.62023056",
"0.6186922",
"0.6174703",
"0.6159457",
"0.61333776",
"0.6121985",
"0.6118846",
"0.6117234",
"0.6107929... | 0.6896503 | 0 |
later events are styled differently in widget | def is_later?(time)
time.to_date > Date.today + 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def widget\n end",
"def widget\n end",
"def rmq_style_applied\n on_styled\n end",
"def events; end",
"def events; end",
"def events; end",
"def events; end",
"def events; end",
"def events; end",
"def events; end",
"def events; end",
"def event; end",
"def event; end",
"def event; e... | [
"0.59940904",
"0.59940904",
"0.54855216",
"0.5483412",
"0.5483412",
"0.5483412",
"0.5483412",
"0.5483412",
"0.5483412",
"0.5483412",
"0.5483412",
"0.546897",
"0.546897",
"0.546897",
"0.54663837",
"0.53846186",
"0.5353801",
"0.5342824",
"0.5339196",
"0.52890104",
"0.52462894",... | 0.0 | -1 |
event.summary is the creator's name event.description is the description that they entered. | def summary(event)
if is_valid_description?(event.description) && event.summary
"#{event.summary} - #{event.description}"
elsif is_valid_description?(event.description)
event.description
elsif event.summary
event.summary
else
"no details"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summary\n \"#{name} (#{email})\"\n end",
"def details\n format_description(@description, 25) + \"event dates: \" + format_date(@start_date,@end_date)\n end",
"def get_verbose_event_name\n \"(#{I18n.t(:event)} #{event_order}) #{event_type.i18n_description} #{get_category_type_name} #{gender_type.... | [
"0.6422062",
"0.6405267",
"0.63137096",
"0.63086206",
"0.6285908",
"0.6207707",
"0.61942846",
"0.615831",
"0.6143356",
"0.6142015",
"0.6139346",
"0.6133456",
"0.61173975",
"0.60985714",
"0.60390204",
"0.6003056",
"0.5983426",
"0.5979569",
"0.5973103",
"0.59661114",
"0.5966111... | 0.69424325 | 0 |
If no description was entered, SuperSAAS sets the description to the event's URL. We want to ignore those descriptions. | def is_valid_description?(description)
description && !description.include?('http://')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_nil_description\n self.description = \"\" if description.nil?\n end",
"def handle_nil_description\n self.description = \"\" if description.nil?\n end",
"def handle_nil_description\n self.description = \"\" if description.nil?\n end",
"def description\n @description |... | [
"0.7006323",
"0.7006323",
"0.7006323",
"0.6613476",
"0.6583549",
"0.6340232",
"0.6243703",
"0.6243703",
"0.6213811",
"0.62056994",
"0.6188074",
"0.6172472",
"0.61466366",
"0.6142755",
"0.614074",
"0.6096372",
"0.6063102",
"0.60512376",
"0.6049807",
"0.6049807",
"0.6049807",
... | 0.57419527 | 73 |
Initialize the instance with the given File object | def initialize(file)
@file = file
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(file)\n @file = file\n end",
"def initialize(file)\n @file = file\n end",
"def initialize(file)\n @file = file\n end",
"def initialize(file_path)\n @file_path = file_path\n end",
"def initialize(file)\n @file = file.is_a?(String) ? File.open(file) : file\n end",
... | [
"0.8452508",
"0.8452508",
"0.8431356",
"0.83620906",
"0.8130515",
"0.8130515",
"0.8130515",
"0.7892275",
"0.7821529",
"0.7763873",
"0.77073914",
"0.77073634",
"0.7706675",
"0.76851016",
"0.7664532",
"0.76613384",
"0.76546514",
"0.7610416",
"0.7610416",
"0.7609725",
"0.7583402... | 0.8467341 | 1 |
Get a list of dependencies | def dependencies
@dependencies ||= []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dependencies\n @dependencies.collect { |name, dependency| dependency }\n end",
"def dependencies\n []\n end",
"def dependencies\n []\n end",
"def dependencies\n @dependencies.values\n end",
"def dependencies\n []\n end",
"def dependency_list... | [
"0.8486586",
"0.8357781",
"0.8352555",
"0.8255598",
"0.81883764",
"0.8098488",
"0.7984062",
"0.7903306",
"0.7903306",
"0.7903306",
"0.7859616",
"0.7774806",
"0.77690256",
"0.76124877",
"0.75875705",
"0.7576311",
"0.75408465",
"0.75330746",
"0.752206",
"0.74761003",
"0.7412024... | 0.81260145 | 8 |
Get the defined source | def sources
@sources ||= []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source\n @source\n end",
"def source\n @source\n end",
"def source\n ap get_source\n end",
"def source\n return @source\n end",
"def source\n return @source\n end",
"def source_file\n @source_location[0]\n end",
"def so... | [
"0.8125052",
"0.8125052",
"0.8015389",
"0.79930234",
"0.79930234",
"0.784389",
"0.7821558",
"0.78209186",
"0.7820686",
"0.7820686",
"0.77945393",
"0.7788613",
"0.77834004",
"0.7779418",
"0.77169394",
"0.7653875",
"0.7653875",
"0.7634944",
"0.75121605",
"0.75121605",
"0.750442... | 0.0 | -1 |
Get the defined destinations | def destinations
@destinations ||= []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destinations\n [to_addrs, cc_addrs, bcc_addrs].compact.flatten\n end",
"def get_flight_destinations\n @flights = Flight.all.map(&:destination)\n end",
"def destinations(object, coord = nil)\n if coord\n AssociationMap.get_associated_data(object, DESTINATION, coord: opts[:coord])\n el... | [
"0.789481",
"0.70888984",
"0.70335203",
"0.691557",
"0.6893441",
"0.67944354",
"0.6758151",
"0.67141855",
"0.66659844",
"0.6656831",
"0.6645124",
"0.6619761",
"0.6501469",
"0.6376662",
"0.6298152",
"0.6269092",
"0.62465787",
"0.6207093",
"0.61981684",
"0.61898667",
"0.6093501... | 0.83878666 | 0 |
Get the transforms with the specified name def transform(name) transforms[name] ||= [] end | def after_read_processors
@after_read_processors ||= []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transforms\n @transforms ||= []\n end",
"def transforms\n @transforms ||= [\n NullTransform, NormalizationTransform, CasingTransform,\n NamedTransform, BreakInternalTransform\n ]\n end",
"def transform\n options[:transform] || name\n ... | [
"0.77694285",
"0.7323855",
"0.7166049",
"0.63459677",
"0.6324188",
"0.6139129",
"0.6090227",
"0.59039557",
"0.580589",
"0.57792306",
"0.5723729",
"0.56880766",
"0.5665985",
"0.5655762",
"0.56491345",
"0.562301",
"0.56001776",
"0.5571514",
"0.55105925",
"0.54625446",
"0.545677... | 0.0 | -1 |
Get all of the "before write" processors | def before_write_processors
@before_write_processors ||= []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_read_processors\n @after_read_processors ||= []\n end",
"def post_processors\n []\n end",
"def processors\n @@processors ||= @@processor_classes.collect {|processor| processor.instance}\n end",
"def pre_hooks\n @to_perform.map do |hook|\n next unless hook.typ... | [
"0.703788",
"0.60937005",
"0.6087268",
"0.60602164",
"0.57381845",
"0.5669466",
"0.56312966",
"0.5609149",
"0.55934215",
"0.5537398",
"0.55209434",
"0.5335678",
"0.5301022",
"0.5295986",
"0.521776",
"0.5207192",
"0.51904124",
"0.5187852",
"0.5185154",
"0.5145931",
"0.5145044"... | 0.79963976 | 0 |
Get an Array of preprocessors | def pre_processors
@pre_processors ||= []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocessors_for(file_path)\n select_matching_file_patterns(preprocess_paths, file_path).values\n end",
"def preprocessors(mime_type = nil)\n if mime_type\n @preprocessors[mime_type].dup\n else\n deep_copy_hash(@preprocessors)\n end\n end",
"def list\n @process... | [
"0.6713903",
"0.65813804",
"0.65524983",
"0.6314353",
"0.62113714",
"0.61306065",
"0.6121118",
"0.6063021",
"0.5855711",
"0.5624107",
"0.55441314",
"0.55384773",
"0.54642606",
"0.5441177",
"0.54396003",
"0.5417453",
"0.5416805",
"0.5385027",
"0.53741384",
"0.5367006",
"0.5348... | 0.825057 | 0 |
Get an Array of post processors | def post_processors
@post_processors ||= []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_processors\n []\n end",
"def processors(*args)\n preprocessors(*args)\n end",
"def processors\n environment.preprocessors(content_type) +\n engines.reverse +\n environment.postprocessors(content_type)\n end",
"def processors\n @@processors ||= @@processor... | [
"0.79602724",
"0.6972347",
"0.69250894",
"0.6853817",
"0.6497335",
"0.64434975",
"0.62154645",
"0.6048273",
"0.5995565",
"0.59249306",
"0.5921904",
"0.5702346",
"0.56904745",
"0.5642506",
"0.5633798",
"0.56324995",
"0.56255627",
"0.5564849",
"0.55368644",
"0.54850876",
"0.545... | 0.7884938 | 1 |
Get an Array of all transforms for this control | def transforms
@transforms ||= []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transforms\n @transforms ||= [\n NullTransform, NormalizationTransform, CasingTransform,\n NamedTransform, BreakInternalTransform\n ]\n end",
"def transforms( inputs, type )\n return inputs.map {|abs| self.transform( abs )}\n end",
"def transform... | [
"0.7318221",
"0.6413749",
"0.62274516",
"0.62146753",
"0.616822",
"0.58892524",
"0.5807785",
"0.5712795",
"0.56615573",
"0.5455203",
"0.5423795",
"0.5329434",
"0.5257979",
"0.5225525",
"0.5200557",
"0.5131174",
"0.5115786",
"0.5093484",
"0.50838584",
"0.5083172",
"0.50405306"... | 0.80930096 | 0 |
A hash of the screens executed before postprocess | def screens
@screens ||= {
:fatal => [],
:error => [],
:warn => []
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_post_process_screens\n @after_post_process_screens ||= {\n :fatal => [],\n :error => [],\n :warn => []\n }\n end",
"def screens\n @screens.keys.each {|screen| @logger.unknown(screen)}\n end",
"def get_ScreenName()\n \t return @outputs[\"ScreenName\"]\n ... | [
"0.69450265",
"0.5877388",
"0.5636646",
"0.53366727",
"0.52995396",
"0.5216248",
"0.52024615",
"0.51284325",
"0.50778204",
"0.507095",
"0.5051616",
"0.49923947",
"0.49885195",
"0.49828324",
"0.4955538",
"0.49520874",
"0.49480164",
"0.49430045",
"0.49183938",
"0.49014676",
"0.... | 0.6117675 | 1 |
A hash of the screens executed after postprocess | def after_post_process_screens
@after_post_process_screens ||= {
:fatal => [],
:error => [],
:warn => []
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def screens\n @screens ||= {\n :fatal => [],\n :error => [],\n :warn => []\n }\n end",
"def screens\n @screens.keys.each {|screen| @logger.unknown(screen)}\n end",
"def get_ScreenName()\n \t return @outputs[\"ScreenName\"]\n \tend",
"def hash\n _window.... | [
"0.6179351",
"0.59527266",
"0.5824746",
"0.5444249",
"0.53481096",
"0.5333527",
"0.5248488",
"0.51623845",
"0.51299256",
"0.5067361",
"0.5063882",
"0.50537384",
"0.5047572",
"0.5044869",
"0.5015034",
"0.4998391",
"0.49888256",
"0.49833506",
"0.49635708",
"0.4954924",
"0.49445... | 0.69624686 | 0 |
Get the error threshold. Defaults to 100. | def error_threshold
@error_threshold ||= 100
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def threshold\n @threshold || 95\n end",
"def error_threshold; end",
"def alert_threshold\n return @alert_threshold\n end",
"def error\n 1.0 - accuracy()\n end",
"def report_threshold_errors\n if percent < config.threshold\n puts \"FAIL! Coverage is low... | [
"0.7348047",
"0.7169307",
"0.6675846",
"0.65360403",
"0.63465714",
"0.63009804",
"0.61131966",
"0.6108317",
"0.60449946",
"0.60449946",
"0.59988314",
"0.59972507",
"0.59316343",
"0.5923533",
"0.58457154",
"0.5844753",
"0.58299637",
"0.5815019",
"0.5749017",
"0.5733033",
"0.57... | 0.8301309 | 0 |
Validate the control file | def validate
#unless sources.length > 0
# raise ControlError, "Configuration must include one of the following for the source: #{source_types.join(',')}"
#end
#unless destinations.length > 0
# raise ControlError, "Configuration must include one of the following for the destination: #{destination_types.join(',')}"
#end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_file(file)\n end",
"def validate!\n validate_name\n validate_version\n validate_icons\n validate_description\n\n check_for_browser_ui_collisions\n\n check_file_presence if @out\n\n @warnings.empty? && @errors.empty?\n end",
"def should_validate?(_filename)\... | [
"0.7241269",
"0.6817773",
"0.6467641",
"0.6425438",
"0.6381364",
"0.63649577",
"0.634486",
"0.6342641",
"0.6267456",
"0.6262775",
"0.62332976",
"0.62332976",
"0.62332976",
"0.62287545",
"0.6175704",
"0.6166648",
"0.6165873",
"0.61383456",
"0.6137447",
"0.6122914",
"0.61198276... | 0.6144457 | 17 |
Check if current slug is not the cannonical one. | def bad_slug?(object)
params[:id] != object.to_param
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_slug_needed?\n !slug || slug_text != slug.name\n end",
"def stale_slug?\n !((permanent_slug? && slug && !slug.empty?) || (slug_source_value.nil? || slug_source_value.empty?))\n end",
"def slug_unique_in_clinic?\n Department.in_clinic(self).where(slug: slug).count == 0\n end",
... | [
"0.71882623",
"0.7103944",
"0.63781613",
"0.637107",
"0.6198909",
"0.61935854",
"0.61713827",
"0.61137784",
"0.61099344",
"0.60849506",
"0.6045724",
"0.6045724",
"0.6024412",
"0.6011362",
"0.6011053",
"0.59697264",
"0.59455144",
"0.59455144",
"0.59455144",
"0.59315103",
"0.59... | 0.5902767 | 21 |
301 redirect to canonical slug. | def redirect_to_good_slug(object)
redirect_to params.merge({
:controller => controller_name,
:action => params[:action],
:id => object.to_param,
:status => :moved_permanently
})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_mixed_case_slug\n if params[:slug] =~ /[A-Z]/\n redirect_to request.fullpath.downcase, status: :moved_permanently\n end\n end",
"def redirect_to_canonical(item) # get this working\n name = item.is_a?(Product) ? item.listing_name : item.name\n link_seo_name = ApplicationHel... | [
"0.7500999",
"0.70531833",
"0.70068675",
"0.70068675",
"0.67735964",
"0.6496191",
"0.64952964",
"0.641766",
"0.641766",
"0.64030445",
"0.63837785",
"0.6325707",
"0.6312802",
"0.6265883",
"0.625057",
"0.6215579",
"0.62089425",
"0.6153334",
"0.6139457",
"0.6136151",
"0.6132292"... | 0.6358257 | 11 |
Unprocessed resources are those which are left over in the outer recipe context when a run fails. Subresources of unprocessed resourced are impossible to capture because they would require processing the outer resource. | def unprocessed_resources
@unprocessed_resources ||= action_collection&.filtered_collection(updated: false, up_to_date: false, failed: false, skipped: false)&.resources || []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup_created_resources\n # Avoid the use of any short circuiting folds.\n cleanup_commands.reverse.inject(true) { |accum, x| accum && x.cleanup }\n end",
"def collect!\n super { |r| relate_resource(yield(orphan_resource(r))) }\n end",
"def converge_failed(exception)\n detect_... | [
"0.5986465",
"0.549516",
"0.5361352",
"0.52689517",
"0.5258491",
"0.5211512",
"0.52085155",
"0.51805156",
"0.51705515",
"0.5098337",
"0.50927955",
"0.50854206",
"0.5052708",
"0.504347",
"0.5025768",
"0.49634832",
"0.4928367",
"0.49139208",
"0.48978424",
"0.48978424",
"0.48891... | 0.577918 | 1 |
The main entry point for report handling. Subclasses should override this method with their own report handling logic. | def report; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report\n \n end",
"def report\n\t\tend",
"def write_report\n\n end",
"def set_report\n end",
"def report(context, repo, dir)\n raise \"No report(context, repo, dir) function defined by report subclass\"\n end",
"def report_body; end",
"def report_body; end",
"def reporters; end",
"d... | [
"0.77070254",
"0.7636699",
"0.72470087",
"0.7132553",
"0.69644916",
"0.69378376",
"0.69378376",
"0.6886046",
"0.6886046",
"0.6886046",
"0.6886046",
"0.6886046",
"0.687986",
"0.6831757",
"0.67892253",
"0.6787872",
"0.6786901",
"0.67735547",
"0.6755319",
"0.6714239",
"0.6694948... | 0.784099 | 3 |
Runs the report handler, rescuing and logging any errors it may cause. This ensures that all handlers get a chance to run even if one fails. This method should not be overridden by subclasses unless you know what you're doing. | def run_report_safely(run_status)
run_report_unsafe(run_status)
rescue Exception => e
Chef::Log.error("Report handler #{self.class.name} raised #{e.inspect}")
Array(e.backtrace).each { |line| Chef::Log.error(line) }
ensure
@run_status = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report(handler)\n raise NotImplementedError\n end",
"def perform(*reports)\n reports.each do |report|\n run_report(report)\n rescue StandardError => e\n report.update status: 'error'\n raise e\n end\n end",
"def start_reporting!\n return unless registered? && confi... | [
"0.68228686",
"0.66036755",
"0.633062",
"0.62782246",
"0.62347776",
"0.6225499",
"0.61426556",
"0.60619926",
"0.5988856",
"0.5982319",
"0.59177184",
"0.58493584",
"0.5794503",
"0.5788155",
"0.5769494",
"0.57375354",
"0.5707811",
"0.5704032",
"0.56972927",
"0.569436",
"0.56154... | 0.6458807 | 2 |
Runs the report handler without any error handling. This method should not be used directly except in testing. | def run_report_unsafe(run_status)
@run_status = run_status
report
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report(handler)\n raise NotImplementedError\n end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def run_report_safely(run_status)\n run_report_unsafe(run_status)\n rescue Exception => e\n Chef::Log.error(\"Report handler #... | [
"0.74046856",
"0.6889534",
"0.6889534",
"0.6889534",
"0.6889534",
"0.6889534",
"0.67929417",
"0.6659159",
"0.65202457",
"0.6492212",
"0.64593464",
"0.6395896",
"0.63889486",
"0.63813967",
"0.6354279",
"0.6352836",
"0.63335323",
"0.62975025",
"0.62802976",
"0.627442",
"0.62744... | 0.60795647 | 31 |
Return the Hash representation of the run_status | def data
@run_status.to_h
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [check_id, exceptions, key, links, port, proof, protocol, since, status].hash\n end",
"def status()\n JobRunStatus.label_from_id(self.job_run_status_id)\n end",
"def status_hash\n return_val = { status: status ,\n post: true, # settable\n d... | [
"0.71105283",
"0.7009205",
"0.69168794",
"0.6780753",
"0.6745955",
"0.6601823",
"0.65446854",
"0.65426975",
"0.6523619",
"0.6496624",
"0.64787775",
"0.6463215",
"0.6384393",
"0.6384393",
"0.6357713",
"0.6346506",
"0.6298415",
"0.62932634",
"0.6258106",
"0.6242737",
"0.6229051... | 0.7770621 | 0 |
associate all changes to embeded documents in our array as changes to the array itself | def associate(embed)
embed.embed_will_change = lambda { embeds_will_change! }
embed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changes_applied!\n # find all fields that are of type :array\n fields(:array) do |key, v|\n proxy = send(key)\n # clear changes\n proxy.changes_applied! if proxy.respond_to?(:changes_applied!)\n end\n\n # for all relational fields,\n relations.each ... | [
"0.6423353",
"0.62969476",
"0.59969056",
"0.59716666",
"0.5971114",
"0.5960557",
"0.57961017",
"0.57820916",
"0.5781561",
"0.5760293",
"0.57317334",
"0.57240635",
"0.56842184",
"0.5660645",
"0.56584704",
"0.5644769",
"0.5618453",
"0.55927455",
"0.5583904",
"0.55749947",
"0.55... | 0.5092144 | 80 |
PATCH/PUT /cocktails/1 PATCH/PUT /cocktails/1.json | def update
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @cocktail = Cocktail.find(params[:id])\n respond_to do |format|\n if @cocktail.update_attributes(params[:cocktail])\n format.html { redirect_to @cocktail, :notice => 'Cocktail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { re... | [
"0.72754633",
"0.72576344",
"0.61955774",
"0.61580795",
"0.61115825",
"0.60460645",
"0.6031627",
"0.6025803",
"0.60184616",
"0.6003105",
"0.5979266",
"0.5977504",
"0.5966176",
"0.5963001",
"0.5962483",
"0.59590495",
"0.5957622",
"0.595237",
"0.59438854",
"0.59364",
"0.5921110... | 0.0 | -1 |
DELETE /cocktails/1 DELETE /cocktails/1.json | def destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cocktail = Cocktail.find(params[:id])\n @cocktail.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cocktail = Cocktail.find(params[:id])\n @cocktail.destroy\n\n respond_to... | [
"0.793862",
"0.793862",
"0.6950385",
"0.6947228",
"0.6945596",
"0.6845354",
"0.683248",
"0.67739415",
"0.67032516",
"0.66529137",
"0.6638629",
"0.66262037",
"0.6620353",
"0.6596014",
"0.6576414",
"0.6573716",
"0.65684664",
"0.65678996",
"0.6565495",
"0.6559129",
"0.65484357",... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_cocktail
@cocktail = Cocktail.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.6163927",
"0.6046165",
"0.59465253",
"0.59167755",
"0.58904207",
"0.58346355",
"0.577713",
"0.5703502",
"0.5703502",
"0.56531286",
"0.56215113",
"0.54224145",
"0.5410795",
"0.5410795",
"0.5410795",
"0.53924775",
"0.5379919",
"0.53580743",
"0.53401667",
"0.53397506",
"0.533... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def valid_attributes
#params.require(:cocktail).permit( :name, :address, :phone_number, :category)
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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
return url for object image | def image_url
url_for(object.profile_pic)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_url\n object.image_url\n end",
"def image_url\n rails_blob_url(object.image)\n # This helper gets the URL from the file we pass to it\n end",
"def image_url\n self.filename.url \n end",
"def image_url\n image.url\n end",
"def image_url\n Image.find(image_id).url\... | [
"0.871723",
"0.8392632",
"0.79279155",
"0.7906055",
"0.7859115",
"0.77881444",
"0.7755401",
"0.7746468",
"0.7739268",
"0.7697174",
"0.7652336",
"0.7645565",
"0.76354086",
"0.7468876",
"0.7447203",
"0.7446847",
"0.7422625",
"0.742147",
"0.74062455",
"0.7335878",
"0.73343587",
... | 0.7992016 | 2 |
check if user is verified or not | def verified
object.is_verified?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_verified?; end",
"def is_verified?\n verified\n end",
"def user_verified; end",
"def verified?\n\t\t\t@verified\n\t\tend",
"def verified?\n @verified\n end",
"def verified?\n true\n end",
"def verified?\n verification_token.blank? && verified_at.present?\n end",
"def ... | [
"0.84272707",
"0.8207904",
"0.8143889",
"0.79755074",
"0.7962941",
"0.7879459",
"0.7730039",
"0.769683",
"0.76590854",
"0.76511806",
"0.75739574",
"0.7557845",
"0.7540846",
"0.7518042",
"0.7432255",
"0.7360722",
"0.73485696",
"0.7348011",
"0.7337385",
"0.72751254",
"0.7264679... | 0.7518321 | 13 |
check if record is of current user | def is_owner
object == current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_this_user\n\t\t@user.id == current_user.id\n\tend",
"def current_user?(user)\n \t\tuser == current_user\n \tend",
"def current_user?(user)\n \t\tuser == current_user\n \tend",
"def current_user?(user)\n \tuser == current_user\n \tend",
"def current_user?(user)\n \tuser == current_user\n... | [
"0.8043909",
"0.79940206",
"0.79475605",
"0.7924724",
"0.7924724",
"0.78967535",
"0.78967357",
"0.78899217",
"0.7889266",
"0.7889266",
"0.7889266",
"0.7889266",
"0.7889266",
"0.7889266",
"0.7889266",
"0.7889266",
"0.7889266",
"0.7889266",
"0.7885673",
"0.7867715",
"0.7867715"... | 0.0 | -1 |
check if record is of another user | def other_user_profile?
!is_owner
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user?(user)\n user.id == self.user_id if user\n end",
"def user?(user)\n self.user_id == user.id if user\n end",
"def user?(user)\n self.user_id == user.id if user\n end",
"def user?(user)\n self.user_id == user.id if user\n end",
"def owner?\n record.id == user.id\n end",
"def is... | [
"0.7543155",
"0.7528679",
"0.7528679",
"0.7528679",
"0.72398317",
"0.7182346",
"0.7175314",
"0.7126601",
"0.7098206",
"0.70273894",
"0.7015757",
"0.7006588",
"0.69704854",
"0.69694346",
"0.6968789",
"0.69454086",
"0.69323593",
"0.69102323",
"0.6905168",
"0.6901803",
"0.690043... | 0.6571342 | 91 |
check if current user can send friend request | def can_request
return true if is_requested
return true if both_user_verified? && !friend_request_exists?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_request\n request_status_pending? && @friend.requester != current_user\n end",
"def is_friend\n friend_request_exists? && @friend.accepted?\n end",
"def is_requested\n request_status_pending? && @friend.requester == current_user\n end",
"def friend_request_accepted?\n friend_request_ex... | [
"0.8425055",
"0.8300358",
"0.827742",
"0.7966758",
"0.7812552",
"0.7776936",
"0.7640665",
"0.75827205",
"0.7526258",
"0.7505901",
"0.73927873",
"0.73884994",
"0.73739535",
"0.73263",
"0.7323693",
"0.7298432",
"0.72897285",
"0.72437274",
"0.72405523",
"0.7210799",
"0.7194555",... | 0.85091627 | 0 |
check if current user has sent friend request | def is_requested
request_status_pending? && @friend.requester == current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_request\n request_status_pending? && @friend.requester != current_user\n end",
"def is_friend\n friend_request_exists? && @friend.accepted?\n end",
"def friend_request_accepted?\n friend_request_exists? && friend.accepted?\n end",
"def can_request\n return true if is_requested\n\n r... | [
"0.8664541",
"0.8521042",
"0.8244583",
"0.81204927",
"0.8093329",
"0.8091424",
"0.8033502",
"0.7980936",
"0.79512274",
"0.78127414",
"0.7723362",
"0.7714234",
"0.7669575",
"0.764967",
"0.7636406",
"0.75585735",
"0.75033045",
"0.74894094",
"0.7480778",
"0.74771875",
"0.7469687... | 0.8401829 | 2 |
check if current user has pending friend request | def has_request
request_status_pending? && @friend.requester != current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_status_pending?\n friend_request_exists? && @friend.pending?\n end",
"def is_requested\n request_status_pending? && @friend.requester == current_user\n end",
"def friend_request_pending?(other_user)\n requested_friendships.to_ary.any? { |u| u.requestee_id == other_user.id }\n end",
... | [
"0.89402664",
"0.88077253",
"0.8351644",
"0.8261696",
"0.8220672",
"0.81964266",
"0.8111013",
"0.8084563",
"0.8066499",
"0.805825",
"0.78864384",
"0.77592933",
"0.77120537",
"0.7682303",
"0.7680217",
"0.76356864",
"0.7596041",
"0.7591541",
"0.75136495",
"0.750728",
"0.7502391... | 0.9111105 | 0 |
check if both user already friends | def is_friend
friend_request_exists? && @friend.accepted?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_if_already_friends\n unless Friendship.find_friendship(requester_id, requestee_id).nil?\n errors.add(:base, \"You are already friends with this user\")\n end\n end",
"def friends?(other_user)\n friends.include?(other_user)\n end",
"def friends_with?(other_user)\n friends.include?(o... | [
"0.81057274",
"0.79946357",
"0.79181725",
"0.78948766",
"0.78835815",
"0.7855413",
"0.7842403",
"0.78074473",
"0.77941614",
"0.7738523",
"0.76905006",
"0.76871544",
"0.75774455",
"0.7557123",
"0.7544705",
"0.7422021",
"0.74115264",
"0.7406456",
"0.7403536",
"0.7377971",
"0.73... | 0.74495614 | 15 |
check if both user are verified | def both_user_verified?
current_user.is_verified? && object.is_verified?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_verified?; end",
"def operational?\n @user1_confirmed && @user2_confirmed\n end",
"def user_verified; end",
"def verify\n\t\tif user = check_admin\n\t\t\ttarget_user = User.find_by(id: params[:user_id])\n\t\t\ttarget_user.toggle!(:verified)\n\t\t\tredirect_back fallback_location: '/home'\n\t... | [
"0.72224814",
"0.71598595",
"0.7116565",
"0.68249696",
"0.6779157",
"0.6744238",
"0.6727324",
"0.65864646",
"0.65656006",
"0.6557902",
"0.65577215",
"0.6548065",
"0.65404314",
"0.65263826",
"0.6482667",
"0.64658135",
"0.6442326",
"0.64250004",
"0.6392219",
"0.6371927",
"0.632... | 0.8176558 | 0 |
check if friend request exists | def friend_request_exists?
both_user_verified?
users = Friend.user_sequence(object.id, current_user.id)
@friend = Friend.find_by(user1_id: users[0], user2_id: users[1])
@friend.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_friend\n friend_request_exists? && @friend.accepted?\n end",
"def friend_request_requester?\n friend_request_exists? && friend.requester == record\n end",
"def has_request\n request_status_pending? && @friend.requester != current_user\n end",
"def friend_request_accepted?\n friend_reque... | [
"0.8174853",
"0.8169966",
"0.80875653",
"0.8051815",
"0.79415244",
"0.7897671",
"0.7864224",
"0.7721544",
"0.7583709",
"0.743196",
"0.74248654",
"0.7290167",
"0.7230836",
"0.7178952",
"0.7172456",
"0.7101818",
"0.70968986",
"0.7071496",
"0.7041606",
"0.7003331",
"0.6932116",
... | 0.847493 | 0 |
check if friend request status is pendind? | def request_status_pending?
friend_request_exists? && @friend.pending?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_request\n request_status_pending? && @friend.requester != current_user\n end",
"def is_requested\n request_status_pending? && @friend.requester == current_user\n end",
"def is_friend\n friend_request_exists? && @friend.accepted?\n end",
"def is_pending_friends_with?(friend)\n \t pen... | [
"0.83992636",
"0.8112946",
"0.76660264",
"0.7652956",
"0.7559802",
"0.7487463",
"0.7338922",
"0.72763646",
"0.7146563",
"0.7119469",
"0.70683926",
"0.7066346",
"0.70541984",
"0.702664",
"0.70135844",
"0.6951006",
"0.69377786",
"0.68885523",
"0.6877324",
"0.6868345",
"0.686772... | 0.84988886 | 0 |
GET /weightings/1 GET /weightings/1.xml | def show
@weighting = Weighting.find(params[:id])
@v_netweight=VNetweight.where(:date=>@weighting.created_at.strftime("%Y-%m-%d"), :code=>@weighting.truck_id).first.net_weight.to_i
@net_weight = @weighting.weight.to_i-@v_netweight rescue nil
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @weighting }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @weight = Weight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @weight }\n end\n end",
"def show\n @weight = Weight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {... | [
"0.7079947",
"0.6676592",
"0.6427495",
"0.6337147",
"0.6163833",
"0.60343444",
"0.5926516",
"0.5857392",
"0.58553797",
"0.5854478",
"0.5854478",
"0.583387",
"0.5814991",
"0.57874167",
"0.5784955",
"0.5784955",
"0.5784955",
"0.5784955",
"0.5765384",
"0.57616127",
"0.57555664",... | 0.5850392 | 11 |
GET /weightings/new GET /weightings/new.xml | def new
@weighting = Weighting.new
@form_no=DateTime.now.strftime("%y%j%H%M%S")
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @weighting }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weight }\n end\n end",
"def create\n params.permit!\n @weighting = Weighting.new(params[:weighting])\n\n respond_to do |format|\n if @weighting.save\n form... | [
"0.7185222",
"0.70601565",
"0.683363",
"0.67678356",
"0.6713605",
"0.6673087",
"0.65096366",
"0.65022486",
"0.6435114",
"0.6428262",
"0.64278454",
"0.6412534",
"0.63963246",
"0.63854223",
"0.6360453",
"0.63330483",
"0.62934214",
"0.62894607",
"0.62703466",
"0.62545633",
"0.62... | 0.59446895 | 87 |
POST /weightings POST /weightings.xml | def create
params.permit!
@weighting = Weighting.new(params[:weighting])
respond_to do |format|
if @weighting.save
format.html { redirect_to(@weighting, :notice => 'Weighting was successfully created.') }
format.xml { render :xml => @weighting, :status => :created, :location => @weighting }
else
format.html { render :action => "new" }
format.xml { render :xml => @weighting.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @weight = Weight.new(weight_params)\n\n respond_to do |format|\n if @weight.save\n format.html { redirect_to @weight, notice: 'Weight was successfully created.' }\n format.json { render :show, status: :created, location: @weight }\n else\n format.html { render :new... | [
"0.65256214",
"0.6491748",
"0.64195925",
"0.63278365",
"0.630893",
"0.6201028",
"0.61963624",
"0.6138421",
"0.61276305",
"0.6059839",
"0.60289913",
"0.5998298",
"0.5976567",
"0.5930134",
"0.5915214",
"0.588473",
"0.5846807",
"0.58216023",
"0.5792171",
"0.5726729",
"0.5726729"... | 0.69605356 | 0 |
PUT /weightings/1 PUT /weightings/1.xml | def update
params.permit!
@weighting = Weighting.find(params[:id])
respond_to do |format|
if @weighting.update_attributes(params[:weighting])
format.html { redirect_to(@weighting, :notice => 'Weighting was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @weighting.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @weight = Weight.find(params[:id])\n\n respond_to do |format|\n if @weight.update_attributes(params[:weight])\n format.html { redirect_to(@weight, :notice => 'Weight was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \... | [
"0.69053465",
"0.66953915",
"0.65782756",
"0.6555942",
"0.6555942",
"0.6555942",
"0.6555942",
"0.651519",
"0.6302937",
"0.6296406",
"0.6274069",
"0.6202364",
"0.6189605",
"0.6015614",
"0.5987531",
"0.59736097",
"0.5914236",
"0.59046024",
"0.58929676",
"0.587017",
"0.58687544"... | 0.68238777 | 1 |
DELETE /weightings/1 DELETE /weightings/1.xml | def destroy
@weighting = Weighting.find(params[:id])
@weighting.destroy
respond_to do |format|
format.html { redirect_to(weightings_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @weight = Weight.find(params[:id])\n @weight.destroy\n\n respond_to do |format|\n format.html { redirect_to(weights_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @weight = Weight.find(params[:id])\n @weight.destroy\n\n respond_to do |format|\n f... | [
"0.75312746",
"0.7118617",
"0.6852558",
"0.67942756",
"0.6777704",
"0.6736215",
"0.66440237",
"0.6432249",
"0.637399",
"0.63612527",
"0.6339533",
"0.6321909",
"0.6191303",
"0.6153343",
"0.6146098",
"0.6078884",
"0.60580075",
"0.60449135",
"0.602087",
"0.6009463",
"0.59955174"... | 0.747749 | 1 |
Currently only MONROE COUNTYSHERIFF (cc = "38...") or MONROE COUNTY | def agency
return @agency if @agency_loaded
@agency_loaded = true
cc = cost_center.to_s[0, 2]
agens = Agency.find(:all, :conditions => ['find_in_set(?, vacancy_data_codes)', cc])
@agency = agens[0] if agens.size == 1
@agency ||= Agency.find_by_abbreviation('MC')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indicator_carbono()\n\t\t\t\tc = totalGei() / @alimentsList.length\n\t\t\t\t# c is the avg grams of co2 per plate\n\n\t\t\t\tif c < 670\n\t\t\t\t\treturn 1.0\n\t\t\t\telsif c <= 830\n\t\t\t\t\treturn 2.0\n\t\t\t\telse\n\t\t\t\t\treturn 3.0\n\t\t\t\tend\n\t\t\tend",
"def imc\n\t\tnum = (@peso/(@talla*@talla))... | [
"0.5859738",
"0.5726336",
"0.5526349",
"0.55224955",
"0.550066",
"0.5487211",
"0.5476491",
"0.53950304",
"0.5337579",
"0.53099203",
"0.53057265",
"0.5299254",
"0.5290823",
"0.52790713",
"0.52790713",
"0.5249015",
"0.52402574",
"0.52250904",
"0.5224634",
"0.52217406",
"0.52213... | 0.0 | -1 |
What calculation would you like to do? (add, sub, mult, div) add What is number 1? 3 What is number 2? 6 Your result is 9 | def calculator()
puts "What kind of operation would you like to do - addition, substraction, multiplication, division"
choice = gets.chomp
puts "What is number 1"
num_1 = gets.chomp.to_f
puts "What is number 2"
num_2 = gets.chomp.to_f
case choice
when "addition"
total = num_1 + num_2
puts "Your result is #{total}"
when "substraction"
total = num_1 - num_2
puts "Your result is #{total}"
when "multiplication"
total = num_1 * num_2
puts "Your result is #{total}"
else
total = num_1 / num_2
puts "Your result is #{total}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_number(result)\n # This is not mathematical correct, because we cant subtract\n puts \"Well done, #{result} == 24\" if 1 / 3 + 4 * 6 == result\n # But, if we can, here is solution: 6.0 / (1.0 - 3.0 / 4.0)\nend",
"def sum_multiples_3_and_5\n return 3 * 333 * 334 / 2 + 5 * 199 * 200 / 2 - 15 * 66 * 67 ... | [
"0.7444845",
"0.7072286",
"0.6977937",
"0.694151",
"0.6910427",
"0.68620133",
"0.6848257",
"0.6844825",
"0.6803176",
"0.6794258",
"0.67750466",
"0.6720252",
"0.669113",
"0.6690067",
"0.6650463",
"0.6648843",
"0.66482306",
"0.6645691",
"0.6631641",
"0.66106135",
"0.65666896",
... | 0.0 | -1 |
Join tables with additional columns on top of the two foreign keys must be considered ambiguous unless a select clause has been explicitly defined. Otherwise you can get broken records back, if, for example, the join column also has an id column. This will then overwrite the id column of the records coming back. | def finding_with_ambiguous_select?(select_clause)
!select_clause && columns.size != 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_using_clause_using_sql_append(sql, using_columns)\n if using_columns.is_a?(SQL::AliasedExpression)\n super(sql, using_columns.expression)\n sql << ' AS '\n identifier_append(sql, using_columns.alias)\n else\n super\n end\n end",
"def add_join... | [
"0.6354958",
"0.6007472",
"0.5979464",
"0.59311503",
"0.58956546",
"0.5863976",
"0.58460987",
"0.58217597",
"0.5817587",
"0.5792444",
"0.56916994",
"0.5680277",
"0.5656454",
"0.5566913",
"0.5564056",
"0.5540416",
"0.5531747",
"0.5525305",
"0.5493701",
"0.5491578",
"0.5463725"... | 0.0 | -1 |
or by "bundle exec rails runner maplabelstotags.rb" Rerunning this script should be safe, and will even rename previously created categories if you pass a different description. | def category_for_key(key, description)
# Keys may contain '/' e.g. 'openshift.io/build.name'.
name = 'kubernetes:' + Classification.sanitize_name(key.tr("/", ":"))
category = Classification.find_by_name(name)
if category
category.description = description
category.save!
category
else
Classification.create_category!(name: name, description: description,
read_only: true, single_value: true)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_tags(category, single_value, tag)\n # Convert to lower case and replace all non-word characters with underscores\n category_name = category.to_s.downcase.gsub(/\\W/,'_')\n tag_name = tag.to_s.downcase.gsub(/\\W/,'_')\n # if the category exists else create it\n unless $evm.execute('category_exists?... | [
"0.59585595",
"0.5944893",
"0.585804",
"0.5854468",
"0.5755211",
"0.5748919",
"0.57388526",
"0.57218903",
"0.56734335",
"0.56648624",
"0.56266665",
"0.5594766",
"0.55697274",
"0.5561367",
"0.55459887",
"0.55297184",
"0.5489343",
"0.5478387",
"0.54540163",
"0.54300785",
"0.542... | 0.5545489 | 15 |
class << self The RequestReport operation requests the generation of a report, which creates a report request. Reports are retained for 90 days. Required Request Parameters ReportType The type of report to request. Optional Request Parameters StartDate Start of a date range used for selecting the data to report. EndDate End of a date range used for selecting the data to report. | def request_report(report_type, params ={})
raise InvalidReportType if !REPORT_TYPES.include?(report_type)
# These may need to be processed
start_date = params[:start_date]
end_date = params[:end_date]
query_params = {
"Action" => "RequestReport",
"ReportType" => REPORT_TYPES[report_type]
}
query_params.merge!({"StartDate" => start_date}) if start_date
query_params.merge!({"EndDate" => end_date}) if end_date
response = get("/", query_params)
RequestReportResponse.format(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_report(report_type, opts = {})\n operation('RequestReport')\n .add(opts)\n .add('ReportType' => report_type)\n .structure!('MarketplaceIdList', 'Id')\n\n run\n end",
"def create_new_report(campaign_id,start_date,end_date)\n new_report_info={ Campaign... | [
"0.73038757",
"0.668791",
"0.63913697",
"0.6284064",
"0.62798625",
"0.617649",
"0.61566716",
"0.6126378",
"0.61094505",
"0.60835177",
"0.6079997",
"0.6036287",
"0.603117",
"0.603117",
"0.6029674",
"0.6002964",
"0.59956884",
"0.599365",
"0.599365",
"0.5976296",
"0.5970798",
... | 0.8077582 | 0 |
GetReportRequestList The GetReportRequestList operation returns a list of report requests that match the query parameters. Amazon MWS limits calls to 1,000 total calls per hour per seller account, including calls to GetReportRequestList. The maximum number of results that will be returned in one call is one hundred. If there are additional results to return, HasNext will be returned in the response with a true value. To retrieve all the results, you can use the value of the NextToken parameter to call GetReportRequestListByNextToken until HasNext is false. Optional Request Parameters ReportRequestIdList A structured list of report request IDs. If you pass in explicit IDs in this call, the other conditions, if specified, will be ignored. ReportTypeList A structured ReportType list by which to filter reports. ReportProcessingStatusList A structured list of report processing statuses by which to filter report requests. ReportProcessingStatus values: _SUBMITTED_ _IN_PROGRESS_ _CANCELLED_ _DONE_ _DONE_NO_DATA_ MaxCount Maximum number of reports to return in the list. If you specify a number greater than 100, the call will be rejected. RequestedFromDate The earliest date you are looking for, in ISO8601 date format (for example, "20080703T18:12:22Z" or "20080703T18:12:22.09307:00"). RequestedToDate The most recent date you are looking for. | def get_report_request_list(params = {})
response = get("/", {"Action" => "GetReportRequestList"}.merge(params))
GetReportRequestListResponse.format(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_report_request_list_by_next_token(next_token)\n operation('GetReportRequestListByNextToken')\n .add('NextToken' => next_token)\n\n run\n end",
"def get_report_list(params = {})\n response = get(\"/\", {\"Action\" => \"GetReportList\"}.merge(params))\n GetReportLi... | [
"0.66232944",
"0.6482061",
"0.6265871",
"0.6021995",
"0.58165205",
"0.57170916",
"0.56183064",
"0.5614789",
"0.5294909",
"0.52874446",
"0.5236693",
"0.5180926",
"0.5145689",
"0.5144004",
"0.5144004",
"0.5119279",
"0.5114524",
"0.5104171",
"0.5082333",
"0.5002381",
"0.49567804... | 0.82252777 | 0 |
GetReportRequestListByNextToken Description The GetReportRequestListByNextToken operation returns a list of report requests that match the query parameters, using the NextToken, which was supplied by a previous call to either GetReportRequestListByNextToken or a call to GetReportRequestList, where the value of HasNext was true in that previous call. NextToken Token returned in a previous call to either GetReportRequestList or GetReportRequestListByNextToken when the value of HasNext was true. | def get_report_request_list_by_next_token(next_token)
response =
post("/", {
"Action" => "GetReportRequestListByNextToken",
"NextToken" => next_token
})
GetReportRequestListByNextTokenResponse.format(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_report_request_list_by_next_token(next_token)\n operation('GetReportRequestListByNextToken')\n .add('NextToken' => next_token)\n\n run\n end",
"def get_report_list_by_next_token(next_token)\n operation('GetReportListByNextToken')\n .add('NextToken' => next_toke... | [
"0.7877067",
"0.6623637",
"0.58843374",
"0.44465816",
"0.43983778",
"0.42917246",
"0.42289463",
"0.4092007",
"0.40219533",
"0.39679837",
"0.3946002",
"0.39319155",
"0.39270574",
"0.39087313",
"0.38734412",
"0.37873745",
"0.37873745",
"0.37801245",
"0.37678435",
"0.37343422",
... | 0.77866036 | 1 |
GetReportRequestCount The GetReportRequestCount returns a count of report requests. | def get_report_request_count(params = {})
response = get("/", {"Action" => "GetReportRequestCount"})
GetReportRequestCountResponse.format(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_report_count(params = {})\n response = get(\"/\", {\"Action\" => \"GetReportCount\"})\n GetReportCountResponse.format(response)\n end",
"def count(request_criteria)\n return if ::ServiceMock.disable_stubs\n yield self if block_given?\n JSON.parse(http.post('/__admin/requ... | [
"0.7474224",
"0.59626466",
"0.5807474",
"0.54083973",
"0.53974736",
"0.53644776",
"0.51782733",
"0.5162767",
"0.5156312",
"0.51300764",
"0.5079807",
"0.50794435",
"0.50498605",
"0.50318813",
"0.49359503",
"0.49342713",
"0.48721325",
"0.48434156",
"0.48264223",
"0.4819791",
"0... | 0.8402902 | 0 |
CancelReportRequests The CancelReportRequests operation cancels one or more report requests, returning the count of the canceled report requests and the report request information. You can specify a number to cancel of greater than one hundred, but information will only be returned about the first one hundred report requests in the list. To return metadata about a greater number of canceled report requests, you can call GetReportRequestList. If report requests have already begun processing, they cannot be canceled. ReportRequestIdList A structured list of report request IDs. If you pass in explicit IDs in this call, the other conditions, if specified, will be ignored. ReportTypeList A structured ReportType list by which to filter reports. ReportProcessingStatusList A structured list of report processing statuses by which to filter report requests. ReportProcessingStatus _SUBMITTED_ _IN_PROGRESS_ _CANCELLED_ _DONE_ _DONE_NO_DATA_ RequestedFromDate The earliest date you are looking for, in ISO8601 date format (for example, "20080703T18:12:22Z" or "20080703T18:12:22.09307:00"). RequestedToDate The most recent date you are looking for. | def cancel_report_requests(params = {})
response = get("/", {"Action" => "CancelReportRequests"}.merge(params))
CancelReportRequestsResponse.format(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel_report_requests(opts = {})\n operation('CancelReportRequests')\n .add(opts)\n .structure!('ReportTypeList', 'Type')\n .structure!('ReportProcessingStatusList', 'Status')\n\n run\n end",
"def cancelled_requests\n @cancelled_requests ||= []\n ... | [
"0.8181688",
"0.5636354",
"0.5556606",
"0.5318393",
"0.5268198",
"0.50228816",
"0.50206494",
"0.501265",
"0.500885",
"0.49990004",
"0.49824232",
"0.49727705",
"0.49697822",
"0.49339968",
"0.4907115",
"0.49069503",
"0.49047953",
"0.48890424",
"0.48833647",
"0.48124236",
"0.479... | 0.81224716 | 1 |
GetReportList The GetReportList operation returns a list of reports within the previous 90 days that match the query parameters. The maximum number of results that will be returned in one call is one hundred. If there are additional results to return, HasNext will be returned in the response with a true value. To retrieve all the results, you can use the value of the NextToken parameter to call GetReportListByNextToken until HasNext is false. Request Parameters | def get_report_list(params = {})
response = get("/", {"Action" => "GetReportList"}.merge(params))
GetReportListResponse.format(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_report_list\n res=api_call('GetReportList')[:data]\n end",
"def get_report_list(options = {})\n options = argument_cleaner(required_params: %i( domainid ), optional_params: %i( ), options: options )\n authenticated_get cmd: \"getreportlist\", **options\n end",
"def get_... | [
"0.7486693",
"0.7256405",
"0.677048",
"0.67677104",
"0.6577919",
"0.6577919",
"0.64310217",
"0.62424004",
"0.62400615",
"0.6019217",
"0.6000471",
"0.5995996",
"0.5825907",
"0.5813327",
"0.58062303",
"0.57976085",
"0.5796282",
"0.57461697",
"0.57069546",
"0.5703306",
"0.570297... | 0.81552595 | 0 |
GetReportCount The GetReportCount operation returns a count of reports within the previous 90 days that are available for the seller to download. ReportTypeList A structured ReportType list by which to filter reports. Acknowledged Set to true to list reports that have been acknowledged with a prior call to UpdateReportAcknowledgements. Set to false to list reports that have not been acknowledged. AvailableFromDate The earliest date you are looking for, in ISO8601 date format (for example, "20080703T18:12:22Z" or "20080703T18:12:22.09307:00"). AvailableToDate The most recent date you are looking for. | def get_report_count(params = {})
response = get("/", {"Action" => "GetReportCount"})
GetReportCountResponse.format(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_report_request_count(params = {})\n response = get(\"/\", {\"Action\" => \"GetReportRequestCount\"})\n GetReportRequestCountResponse.format(response)\n end",
"def presence_report\n @total_reports = PresenceReport.summary_report(@date_start, @date_end, current_company_id)\n @repor... | [
"0.6242872",
"0.54208857",
"0.54146814",
"0.5384222",
"0.53462005",
"0.5330045",
"0.5271582",
"0.5261862",
"0.5259761",
"0.52293986",
"0.5180208",
"0.5141974",
"0.5125936",
"0.5077582",
"0.5059495",
"0.50516564",
"0.50307214",
"0.5026537",
"0.4974966",
"0.49650148",
"0.495796... | 0.7392054 | 0 |
GetReport Description The GetReport operation returns the contents of a report and the ContentMD5 header for the returned body. Reports are retained for 90 days from the time they have been generated. Amazon MWS limits calls to 1,000 total calls per hour per seller account, including a limit of 60 calls per hour to GetReport. You should compute the MD5 hash of the HTTP body and compare that with the returned ContentMD5 header value. If they do not match, which means the body was corrupted during transmission, you should discard the result and automatically retry the call for up to three more times. Please notify us if you ever see such a corrupted body. You can contact us by using the contact form at ( For more information, see Using the ContentMD5 Header with SubmitFeed. | def get_report(report_id, params = {})
response = get("/", {"Action" => "GetReport", "ReportId" => report_id})
# TODO format response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report_body(report_id)\n download_url = report_url(report_id)\n return unless download_url\n\n Downloader.fetch_report(download_url)\n end",
"def get_report_list\n res=api_call('GetReportList')[:data]\n end",
"def get_report(report_id, &blk)\n operation('GetReport')\n ... | [
"0.6726207",
"0.63796467",
"0.63371927",
"0.6092744",
"0.6055825",
"0.5900361",
"0.5882026",
"0.5880438",
"0.58748394",
"0.58573776",
"0.5807661",
"0.5741583",
"0.57333714",
"0.56963295",
"0.5686894",
"0.56714594",
"0.566011",
"0.5656619",
"0.561356",
"0.5582326",
"0.55511296... | 0.6499023 | 1 |
ManageReportSchedule The ManageReportSchedule operation creates, updates, or deletes a report schedule for a particular report type. Currently, only order reports can be scheduled. Request Parameters ReportType The type of reports that you want to schedule generation of. Currently, only order reports can be scheduled. Schedule A string that describes how often a ReportRequest should be created. The list of enumerated values is found in the enumeration topic, Schedule. ScheduledDate The date when the next report is scheduled to run. Limited to no more than 366 days in the future. | def manage_report_schedule(report_type, schedule, params={})
raise InvalidReportType if !REPORT_TYPES.include?(report_type)
raise InvalidSchedule if !SCHEDULE.include?(schedule)
response =
get("/", {
"Action" => "ManageReportSchedule",
"Schedule" => schedule,
"ReportType" => report_type
})
ManageReportScheduleResponse.format(reponse)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manage_report_schedule(report_type, schedule, opts = {})\n operation('ManageReportSchedule')\n .add(opts)\n .add('ReportType' => report_type, 'Schedule' => schedule)\n\n run\n end",
"def get_report_schedule_list(params = {})\n response = get(\"/\", {\"Action\" => \... | [
"0.8307902",
"0.5710822",
"0.56704605",
"0.5508336",
"0.5508336",
"0.5508336",
"0.54825866",
"0.5474588",
"0.54663026",
"0.52725303",
"0.52543765",
"0.52169377",
"0.52050155",
"0.520033",
"0.51692444",
"0.51692444",
"0.51692444",
"0.51692444",
"0.51692444",
"0.51692444",
"0.5... | 0.8387143 | 0 |
GetReportScheduleList The GetReportScheduleList operation returns a list of report schedules that match the query parameters. Currently, only order reports can be scheduled. The maximum number of results that will be returned in one call is one hundred. If there are additional results to return, HasNext will be returned in the response with a true value. To retrieve all the results, you can use the value of the NextToken parameter to call GetReportScheduleListByNextToken until HasNext is false. [Note] Note For this release of Amazon MWS, only order reports can be scheduled, so HasNext will always be False. | def get_report_schedule_list(params = {})
response = get("/", {"Action" => "GetReportScheduleList"}.merge(params))
GetReportScheduleListResponse.format(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_schedules(opts = {})\n data, _status_code, _headers = list_schedules_with_http_info(opts)\n return data\n end",
"def list_schedules request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_pa... | [
"0.6513851",
"0.6030862",
"0.5937943",
"0.5680873",
"0.5507223",
"0.54564935",
"0.5439618",
"0.5311705",
"0.52950865",
"0.5242871",
"0.51936996",
"0.51545936",
"0.515456",
"0.51343393",
"0.51293546",
"0.5054059",
"0.50142354",
"0.5005091",
"0.50014013",
"0.49265584",
"0.49146... | 0.8159332 | 0 |
Checks the response code for common errors. Returns parsed response for successful requests. | def validate(response)
case response.code
when 400 then fail(Error::BadRequest.new, error_message(response))
when 401 then fail(Error::Unauthorized.new, error_message(response))
when 403 then fail(Error::Forbidden.new, error_message(response))
when 404 then fail(Error::NotFound.new, error_message(response))
when 405 then fail(Error::MethodNotAllowed.new, error_message(response))
when 409 then fail(Error::Conflict.new, error_message(response))
when 500 then fail(Error::InternalServerError.new, error_message(response))
when 502 then fail(Error::BadGateway.new, error_message(response))
when 503 then fail(Error::ServiceUnavailable.new, error_message(response))
end
response.parsed_response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_response\n unless (res = get).valid?\n raise BadResponse, \"#{res.code} #{res['Code'].first}\"\n end\n\n res\n end",
"def validate_response(response) # :nodoc:\n code = response.code.to_i\n raise HttpError, \"#{code} #{response.msg}\" if code < 200 || code >... | [
"0.7596021",
"0.7420039",
"0.74150765",
"0.7329557",
"0.72985417",
"0.70154613",
"0.7009048",
"0.6959743",
"0.6950225",
"0.69470584",
"0.6901967",
"0.68966734",
"0.68869585",
"0.6879744",
"0.6858742",
"0.6853542",
"0.6846751",
"0.6840325",
"0.68368864",
"0.6796254",
"0.673483... | 0.73997724 | 3 |
Eventually driver can decide between Fc3Service and Fc4Service | def driver
Fc3Service
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service; end",
"def service; raise NotImplementedError; end",
"def on_db_service(service)\n\tend",
"def services\n end",
"def services\n\t\tselect {|x| x.class == Service }\n\tend",
"def supports_incomplete_services?\n Puppet::Util::Package.versioncmp(Puppet.runtime[:facter].value(:opera... | [
"0.5999838",
"0.5924388",
"0.58533376",
"0.582841",
"0.5825648",
"0.58189917",
"0.57971764",
"0.5777054",
"0.5750802",
"0.5694562",
"0.56764495",
"0.5644307",
"0.5618309",
"0.5583234",
"0.5580916",
"0.55771077",
"0.5560084",
"0.555464",
"0.5542064",
"0.5506177",
"0.5505888",
... | 0.7094756 | 0 |
Highlevel access to the Fedora find_objects API | def search(query, options = {}, &block)
return to_enum(:search, query, options).to_a unless block_given?
sessionToken = nil
doc = nil
begin
sessionOptions = {}
sessionOptions[:sessionToken] = sessionToken unless sessionToken.nil? || sessionToken.blank?
response = self.find_objects(options.merge(:query => query, :resultFormat => 'xml', :pid => true).merge(sessionOptions))
doc = Nokogiri::XML(response)
doc.xpath('//xmlns:objectFields/xmlns:pid', doc.namespaces).each do |pid|
begin
obj = self.find(pid.text)
rescue RestClient::Unauthorized
next
end
block.call(obj)
end
sessionToken = doc.xpath('//xmlns:listSession/xmlns:token', doc.namespaces).text
end until sessionToken.nil? || sessionToken.empty? || doc.xpath('//xmlns:resultList/xmlns:objectFields', doc.namespaces).empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_object(name); end",
"def listObjects _obj, _args\n \"_obj listObjects _args;\" \n end",
"def get_objects(data,*moredata)\n parms = legacy_getparms(data,moredata)\n # def get_objects(objecttype, get, exactget, regexget, exclude, andget, includes=nil, login=nil, password_callback=PasswordC... | [
"0.66212255",
"0.6605208",
"0.6502865",
"0.62811506",
"0.6139178",
"0.61210907",
"0.6094824",
"0.6063398",
"0.60402924",
"0.602953",
"0.595288",
"0.59501505",
"0.5937853",
"0.5924132",
"0.5895639",
"0.58742374",
"0.58445466",
"0.5840374",
"0.58280116",
"0.58211136",
"0.581483... | 0.5310317 | 96 |
repository profile (from APIALITE data) | def profile
@profile ||= repository_profile
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile; Profile.get(self.profile_id); end",
"def profile\n raw = client.get @json['user']['links']['self']\n client.factory.create(GoodData::Profile, raw)\n end",
"def profile\n end",
"def profile\n end",
"def profile\n end",
"def profile\n end",
"def profile\n end",
"def profi... | [
"0.6846609",
"0.6545922",
"0.6534756",
"0.6534756",
"0.6534756",
"0.6534756",
"0.6534756",
"0.6534756",
"0.64738184",
"0.64738184",
"0.64659554",
"0.6438211",
"0.6422457",
"0.63511336",
"0.63424665",
"0.63350594",
"0.63248324",
"0.6303819",
"0.6246344",
"0.6245202",
"0.621903... | 0.79560655 | 0 |
Raise an error if unable to connect to the API endpoint | def ping
raise "Unable to establish connection to Fedora Repository" unless profile
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_error; end",
"def api_connect(server, endpoint)\n url= \"http://#{server}:4569/#{endpoint}\"\n #puts url\n begin \n response = open(url).read\n rescue Errno::ECONNREFUSED\n return :unreachabe\n rescue Errno::ENETUNREACH\n return :unreachabe\n rescue Errno::ETIMEDOUT\n return :unreachabe... | [
"0.68709105",
"0.65117466",
"0.6479172",
"0.6368066",
"0.61932343",
"0.6190586",
"0.61037385",
"0.606717",
"0.6032882",
"0.6032882",
"0.601574",
"0.601574",
"0.59656525",
"0.5922136",
"0.5894316",
"0.58381146",
"0.58271796",
"0.58215326",
"0.5820923",
"0.58201367",
"0.5810730... | 0.0 | -1 |
Load fallback API implementations for older versions of Fedora | def check_repository_version!
return unless version
if version < 3.4
raise "You're connecting to a Fedora #{version} repository. Rubydora requires Fedora >= 3.4"
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_libraries\n raise StandardError, 'Unsupported, fix this'\n end",
"def load_platform(v)\n Chef::Log.debug \"[dropwizard_pleaserun] loading platform #{v}\"\n platform_lib = \"pleaserun/platform/#{v}\"\n require platform_lib\n const = PleaseRun::Platform.constants.find { |c| c.to_s.casecmp(v... | [
"0.602562",
"0.5981619",
"0.59613115",
"0.59613115",
"0.5760814",
"0.57325107",
"0.56428975",
"0.56102425",
"0.55567884",
"0.5542101",
"0.5539658",
"0.5463034",
"0.5426309",
"0.54257065",
"0.54027426",
"0.5396438",
"0.5347734",
"0.5248512",
"0.5229642",
"0.5221644",
"0.521434... | 0.0 | -1 |
the admin datasets main page showing users and stats, but slightly different in scope for curators vs tenant admins rubocop:disable Metrics/AbcSize | def index
# Limits due to the current search/filter settings are handled within CurationTableRow
authorize %i[stash_engine admin_datasets]
my_tenant_id = (%w[admin tenant_curator].include?(current_user.role) ? current_user.tenant_id : nil)
@all_stats = Stats.new
@seven_day_stats = Stats.new(tenant_id: my_tenant_id, since: (Time.new.utc - 7.days))
if request.format.to_s == 'text/csv' # we want all the results to put in csv
page = 1
page_size = 1_000_000
else
page = @page.to_i
page_size = @page_size.to_i
end
search_terms = { params: helpers.sortable_table_params, page: page.to_i, page_size: page_size.to_i }
@datasets = AdminDatasetsPolicy::Scope.new(current_user, StashEngine::AdminDatasets::CurationTableRow, search_terms).resolve
@publications = StashEngine::Journal.order(:title).map(&:title)
@pub_name = params[:publication_name] || nil
# paginate for display
blank_results = (page.to_i - 1) * page_size.to_i
@datasets = Array.new(blank_results, nil) + @datasets # pad out an array with empty results for earlier pages for kaminari
@datasets = Kaminari.paginate_array(@datasets, total_count: @datasets.length).page(page).per(page_size)
respond_to do |format|
format.html
format.csv do
headers['Content-Disposition'] = "attachment; filename=#{Time.new.strftime('%F')}_report.csv"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_users_stats\n get_admin_stats \"users\"\n end",
"def user_dashboard\n @progress_count = Resource.in_progress.where(user_id: @user.id).count\n # some of these columns are calculated values for display that aren't stored (publication date)\n @resources = Resource.where(user_id:... | [
"0.7113633",
"0.70360404",
"0.69091284",
"0.6895132",
"0.6828415",
"0.6828148",
"0.68255764",
"0.681875",
"0.6792682",
"0.6722552",
"0.6708358",
"0.6614491",
"0.6584723",
"0.65570784",
"0.6516072",
"0.65113515",
"0.6495348",
"0.6482156",
"0.64763165",
"0.6473073",
"0.6464961"... | 0.0 | -1 |
rubocop:enable Metrics/AbcSize Unobtrusive Javascript (UJS) to do AJAX by running javascript | def data_popup
authorize %i[stash_engine admin_datasets]
respond_to do |format|
@identifier = Identifier.find(params[:id])
@internal_datum = if params[:internal_datum_id]
InternalDatum.find(params[:internal_datum_id])
else
InternalDatum.new(identifier_id: @identifier.id)
end
setup_internal_data_list
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_js_ajax\n render_code(@js, :ajax)\n end",
"def inject_js; end",
"def xhr_script; end",
"def ajax_action_code\n js = Waw::ActionController::JSGeneration.new\n code = js.generate_js_for_action(Waw::kernel, self, \"\")\n <<-EOF\n <script type=\"text/javascript\">... | [
"0.7970413",
"0.7062222",
"0.6945595",
"0.6836867",
"0.6795558",
"0.67831844",
"0.66184586",
"0.6548332",
"0.6522034",
"0.64472294",
"0.64447975",
"0.6425805",
"0.6396313",
"0.6396313",
"0.6396313",
"0.63706094",
"0.6364617",
"0.6329912",
"0.6329912",
"0.6300944",
"0.62800395... | 0.0 | -1 |
Unobtrusive Javascript (UJS) to do AJAX by running javascript | def curation_activity_popup
authorize %i[stash_engine admin_datasets]
respond_to do |format|
@identifier = Identifier.where(id: params[:id]).first
# using the last submitted resource should apply the curation to the correct place, even with windows held open
@resource =
if @identifier.last_submitted_resource&.id.present?
Resource.includes(:identifier, :curation_activities).find(@identifier.last_submitted_resource.id)
else
@identifier.latest_resource # usually notes go on latest submitted, but there is none, so put it here
end
@curation_activity = StashEngine::CurationActivity.new(resource_id: @resource.id)
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_js_ajax\n render_code(@js, :ajax)\n end",
"def inline_javascript(options)\n callbacks = ''\n # :before and :loading get merged into ajax:beforeSend.\n before_send = options.values_at(:before, :loading).compact!\n if options[:data]\n before_send << \"xhr.set... | [
"0.73464036",
"0.68151015",
"0.6554751",
"0.6534225",
"0.6428934",
"0.6380362",
"0.6275246",
"0.62637097",
"0.61400974",
"0.60985166",
"0.60929155",
"0.60714096",
"0.59908545",
"0.5973343",
"0.59477204",
"0.59452116",
"0.58974063",
"0.58962697",
"0.58914983",
"0.58914983",
"0... | 0.0 | -1 |
show curation activities for this item | def activity_log
authorize %i[stash_engine admin_datasets]
@identifier = Identifier.find(params[:id])
resource_ids = @identifier.resources.collect(&:id)
ord = helpers.sortable_table_order(whitelist: %w[created_at])
@curation_activities = CurationActivity.where(resource_id: resource_ids).order(ord, id: :asc)
@internal_data = InternalDatum.where(identifier_id: @identifier.id)
rescue ActiveRecord::RecordNotFound
admin_path = stash_url_helpers.url_for(controller: 'stash_engine/admin_datasets', action: 'index', only_path: true)
redirect_to admin_path, notice: "Identifier ID #{params[:id]} no longer exists."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def curation_activity_popup\n authorize %i[stash_engine admin_datasets]\n respond_to do |format|\n @identifier = Identifier.where(id: params[:id]).first\n # using the last submitted resource should apply the curation to the correct place, even with windows held open\n @resource =\n ... | [
"0.6021858",
"0.59082454",
"0.5834382",
"0.5779889",
"0.5756816",
"0.56387943",
"0.56081355",
"0.55605096",
"0.55144083",
"0.5475771",
"0.53722775",
"0.535137",
"0.53326476",
"0.5325805",
"0.53065664",
"0.5281862",
"0.52786314",
"0.5275676",
"0.5247094",
"0.52183115",
"0.5216... | 0.5204686 | 22 |
this sets up the select list for internal data and will not offer options for items that are only allowed once and one is present | def setup_internal_data_list
@options = StashEngine::InternalDatum.validators_on(:data_type).first.options[:in].dup
return if params[:internal_datum_id] # do not winnow list if doing update since it's read-only and just changes the value on update
# Get options that are only allow one item rather than multiple
only_one_options = @options.dup
only_one_options.delete_if { |i| StashEngine::InternalDatum.allows_multiple(i) }
StashEngine::InternalDatum.where(identifier_id: @internal_datum.identifier_id).where(data_type: only_one_options).each do |existing_item|
@options.delete(existing_item.data_type)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_select\n @group_items = GroupItem.all\n end",
"def fill_select_option\n @search_by_values = QcLaboratory.get_search_values\n end",
"def set_selectbox_options\n set_kind_option\n set_scheduled_times_option\n set_user_option\n end",
"def make_option_list\n end",
"de... | [
"0.6304583",
"0.6137156",
"0.60920984",
"0.6018764",
"0.6018764",
"0.6013932",
"0.5994484",
"0.5882628",
"0.576413",
"0.576413",
"0.5759776",
"0.5759776",
"0.57529813",
"0.57351726",
"0.5722514",
"0.57197523",
"0.5711122",
"0.5711018",
"0.5677872",
"0.5655511",
"0.56351846",
... | 0.59873074 | 7 |
returns an array of all listings a guest has stayed at | def listings
Trip.all.select {|trip| trip.guest == self}.map { |trip| trip.listing}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listings\n arr = []\n Trips.all.each do |trip|\n if trip.guest == self\n arr << trip.listing\n end\n end\n arr\n end",
"def listings\n Trip.all.map do |trip|\n if trip.guest == self\n return trip.listing\n end\n end\n end",
"def guests \n Trip.al... | [
"0.7593683",
"0.75795543",
"0.72324926",
"0.7113327",
"0.71032214",
"0.6968897",
"0.695881",
"0.69275045",
"0.68823",
"0.6876778",
"0.68510354",
"0.68510354",
"0.68510354",
"0.67987883",
"0.6745149",
"0.66327685",
"0.66282696",
"0.6604289",
"0.6592368",
"0.65467846",
"0.64685... | 0.7426397 | 2 |
returns an array of all trips a guest has made | def trips
Trip.all.select{ |trip| trip.guest == self}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guests\n trips.map {|trip| trip.guest}.uniq\n end",
"def guests\n trips.collect {|g| g.guest}\n end",
"def guests\n self.trips.map do |trip|\n trip.guest\n end\n end",
"def trips\n @trips = Trip.all.select do |trip|\n trip.guest == self\n end\n end",
... | [
"0.84940946",
"0.8393448",
"0.8285537",
"0.8263111",
"0.82134277",
"0.81874436",
"0.814903",
"0.8115625",
"0.8098576",
"0.79452384",
"0.76824796",
"0.7657505",
"0.73159987",
"0.7307736",
"0.72961533",
"0.72003645",
"0.7113521",
"0.7101258",
"0.7034692",
"0.7013736",
"0.700919... | 0.81765294 | 6 |
returns the number of trips a guest has taken | def count
trips.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guest_count\n return @guests.count\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n trips.length\n end",
"def guests_count\n ... | [
"0.7706995",
"0.7676192",
"0.7641515",
"0.76164544",
"0.76164544",
"0.76164544",
"0.74588704",
"0.74378246",
"0.7434118",
"0.7410022",
"0.7366658",
"0.73179877",
"0.72065705",
"0.72065705",
"0.71936995",
"0.711102",
"0.7036033",
"0.6933371",
"0.67134684",
"0.6671646",
"0.6605... | 0.78346866 | 0 |
logic for drivers total earnings here. logic for drivers average rating here. | def average_rating
average = 0
count = 0
self.trips.each do |trip|
average += trip.rating.to_i
count += 1
end
return average / count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def driver_earnings\n before_fee = self.total_earnings\n \n if before_fee == 0\n return 0\n end\n \n after_fee = (before_fee - 165)\n \n percentage = 0.8\n driver_earnings = after_fee * percentage\n \n return driver_earnings\n end",
"def earnings\n drivers_trips = self.a... | [
"0.73675734",
"0.678582",
"0.67280746",
"0.67102593",
"0.6688149",
"0.66759515",
"0.6635958",
"0.65929574",
"0.6567195",
"0.6532053",
"0.64420336",
"0.63503367",
"0.6335655",
"0.6333358",
"0.63151634",
"0.6263687",
"0.62623376",
"0.62613165",
"0.6231559",
"0.6206731",
"0.6195... | 0.0 | -1 |
POST /api/resources/1/orders POST /api/resources/1/orders.json | def create
render_create @parent.new order_params.merge(user: @current_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orders\n authenticated_post(\"orders\").body\n end",
"def orders\n authenticated_post(\"auth/r/orders\").body\n end",
"def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend",
"def create\n or... | [
"0.7171634",
"0.7154289",
"0.71090114",
"0.7073123",
"0.70043725",
"0.68314344",
"0.67893547",
"0.67642015",
"0.67216134",
"0.67026913",
"0.6664875",
"0.665365",
"0.66215134",
"0.6608786",
"0.65544593",
"0.65528095",
"0.6552756",
"0.6545801",
"0.6507829",
"0.6493779",
"0.6491... | 0.0 | -1 |
PUT /api/resources/1/orders/1/finish PUT /api/resources/1/orders/1/finish.json | def finish
@order.finish
render_update @order
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complete\n @order = Order.find(params[:id])\n @order.update_attributes(:fulfilled => Time.now)\n\n respond_to do |format|\n if @order.update_attributes(:fulfilled => Time.now)\n format.html { redirect_to @order, notice: 'Order was successfully completed.' }\n format.json { render js... | [
"0.6755353",
"0.6411328",
"0.60826457",
"0.60631794",
"0.6001596",
"0.5925614",
"0.5864029",
"0.5850633",
"0.58432573",
"0.58345675",
"0.5822106",
"0.5822106",
"0.5822106",
"0.579868",
"0.57380295",
"0.5732552",
"0.5696267",
"0.5668562",
"0.56571877",
"0.5610502",
"0.5590711"... | 0.69680065 | 0 |
PUT /api/resources/1/orders/1/use PUT /api/resources/1/orders/1/use.json | def use
@order.use params.fetch(:count, 1).to_i
render_update @order
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put!\n request! :put\n end",
"def update\n @breadcrumb = 'update'\n @use = Use.find(params[:id])\n @use.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @use.update_attributes(params[:use])\n format.html { redirect_to @use,\n ... | [
"0.5894159",
"0.5877743",
"0.5874059",
"0.5865938",
"0.5763486",
"0.5692681",
"0.5684773",
"0.5674421",
"0.56592286",
"0.5640139",
"0.5613708",
"0.5590699",
"0.5574032",
"0.55686206",
"0.5556527",
"0.5524416",
"0.54915434",
"0.54911613",
"0.5485152",
"0.5468918",
"0.5468245",... | 0.5895683 | 0 |
PUT /api/resources/1/orders/1/cancel PUT /api/resources/1/orders/1/cancel.json | def cancel
@order.cancel
render_update @order
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel\n order = current_user.customer.orders.find(params[:id])\n order.update(status: 9)\n render json: {is_success: true}, status: :ok\n end",
"def cancel\n @order.cancel!\n return redirect_to order_path(@order), :notice => t(:update_success)\n end",
"def cancel_order(source_account, ord... | [
"0.753781",
"0.7183134",
"0.7165706",
"0.699627",
"0.68784165",
"0.6794234",
"0.6645697",
"0.6644165",
"0.6639768",
"0.6618165",
"0.6605868",
"0.65378624",
"0.6531487",
"0.6517761",
"0.6510338",
"0.6495517",
"0.64348334",
"0.640013",
"0.6376106",
"0.6253869",
"0.6216189",
"... | 0.75960624 | 0 |
POST /api/resources/1/orders/1/review POST /api/resources/1/orders/1/review.json | def review
render_create @order.build_review review_params
rescue ActiveRecord::RecordNotSaved
render_error I18n.t('review_exist'), :unprocessable_entity
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @review = Review.new(review_params)\n\n if @review.save\n render json: @review, status: :created, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end",
"def create\n @review = Review.new(review_params)\n\n if @review.save\n ... | [
"0.72279304",
"0.72279304",
"0.72279304",
"0.7134243",
"0.70040035",
"0.6982167",
"0.69484615",
"0.69396156",
"0.69253385",
"0.6903309",
"0.6903309",
"0.6873381",
"0.68710214",
"0.6860698",
"0.6805267",
"0.67758584",
"0.67658824",
"0.6760576",
"0.6717634",
"0.66695184",
"0.66... | 0.69825244 | 5 |
Use callbacks to share common setup or constraints between actions. | def set_race
@race = Race.friendly.find(params[:race_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.6163927",
"0.6046165",
"0.59465253",
"0.59167755",
"0.58904207",
"0.58346355",
"0.577713",
"0.5703502",
"0.5703502",
"0.56531286",
"0.56215113",
"0.54224145",
"0.5410795",
"0.5410795",
"0.5410795",
"0.53924775",
"0.5379919",
"0.53580743",
"0.53401667",
"0.53397506",
"0.533... | 0.0 | -1 |
Method to print a list and make it look pretty input: List of items and quantities (in a hash) steps: Print all of the items and quantities on the list output: Items and quantities | def print_list(list)
list.each_pair{ |item, quantity| puts "#{item}: #{quantity}" }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_in_print(list)\n puts \"---------------------------------------\"\n puts \"These are the items we are gonna buy\"\n list.each {|item, qty| puts \"#{qty} pieces of #{item}\" }\nend",
"def pretty_print(list)\n list.each {|item, quantity| puts \"#{item} : #{quantity}\"}\nend",
"def pretty_l... | [
"0.82800835",
"0.827089",
"0.8173328",
"0.80720085",
"0.80422086",
"0.8026367",
"0.8026367",
"0.7943025",
"0.7920855",
"0.78933537",
"0.7849694",
"0.7833596",
"0.77252364",
"0.77252364",
"0.76965004",
"0.7685485",
"0.76124203",
"0.76124203",
"0.76013535",
"0.75941604",
"0.757... | 0.70075697 | 75 |
GET /ambassadors GET /ambassadors.json | def index
if params[:active_ambassadors]
@ambassadors = Ambassador.approved
elsif current_user
@ambassadors = Ambassador.all
else
redirect_to 'http://globalmathproject.com'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ambassadors(params = {})\n self.class.get('/ambassador/all', params)\n end",
"def ambassador(params = {})\n self.class.get('/ambassador/get', params)\n end",
"def index\n @ambits = Ambit.all\n end",
"def index\n @awards = Award.all\n\n respond_to do |format|\n format.html # index.h... | [
"0.78298587",
"0.70064074",
"0.65883136",
"0.6497379",
"0.648127",
"0.6363422",
"0.6256514",
"0.62211806",
"0.6218529",
"0.62052506",
"0.6188501",
"0.6133783",
"0.61328465",
"0.60968184",
"0.60417587",
"0.60357744",
"0.59755623",
"0.5968059",
"0.596023",
"0.5956117",
"0.59491... | 0.662004 | 2 |
GET /ambassadors/1 GET /ambassadors/1.json | def show
return render unless !@ambassador.approved? && !current_user
redirect_to 'http://www.globalmathproject.com'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ambassadors(params = {})\n self.class.get('/ambassador/all', params)\n end",
"def ambassador(params = {})\n self.class.get('/ambassador/get', params)\n end",
"def show\n @ambush = Ambush.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { rende... | [
"0.7345504",
"0.68694466",
"0.65579796",
"0.6349156",
"0.6348248",
"0.6343002",
"0.6333708",
"0.63265115",
"0.6291374",
"0.62623525",
"0.615009",
"0.614924",
"0.6138218",
"0.6113244",
"0.6082242",
"0.6066521",
"0.60526884",
"0.60262173",
"0.6022239",
"0.6014209",
"0.60016537"... | 0.0 | -1 |
POST /ambassadors POST /ambassadors.json | def create
@ambassador = Ambassador.new(ambassador_params)
respond_to do |format|
if @ambassador.save
format.html { redirect_to new_ambassador_url, notice: 'Your application has been received! <a href="http://www.globalmathproject.org">Click here</a> to return to our main site.' }
else
format.html { render :new }
format.json { render json: @ambassador.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @ambush = Ambush.new(params[:ambush])\n\n respond_to do |format|\n if @ambush.save\n format.html { redirect_to @ambush, :notice => 'Ambush was successfully created.' }\n format.json { render :json => @ambush, :status => :created, :location => @ambush }\n else\n for... | [
"0.62661076",
"0.59849644",
"0.59534776",
"0.5917394",
"0.58546984",
"0.57608366",
"0.5729125",
"0.5702439",
"0.5661122",
"0.56435025",
"0.56396526",
"0.5639518",
"0.56387717",
"0.56120884",
"0.5602944",
"0.5595865",
"0.5594551",
"0.5567572",
"0.55497557",
"0.5534448",
"0.552... | 0.6258082 | 1 |
PATCH/PUT /ambassadors/1 PATCH/PUT /ambassadors/1.json | def update
respond_to do |format|
if @ambassador.update(ambassador_params)
format.html { redirect_to @ambassador, notice: 'Ambassador was successfully updated.' }
format.json { render :show, status: :ok, location: @ambassador }
else
format.html { render :edit }
format.json { render json: @ambassador.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @amenity = Amenity.find(params[:id])\n if @amenity.update_attributes(:name=>params[:body][:amenity])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@amenity.errors)\n end \n end",
"def update\n animal = Animal.find(params[:id])\n\n if validate_p... | [
"0.6417976",
"0.6337022",
"0.6286917",
"0.62796694",
"0.62642956",
"0.6250741",
"0.6243166",
"0.62424797",
"0.62375724",
"0.6220005",
"0.62122333",
"0.6209818",
"0.61919165",
"0.61818826",
"0.6097622",
"0.60964733",
"0.6054425",
"0.60419303",
"0.60334027",
"0.6029803",
"0.602... | 0.63939995 | 1 |
DELETE /ambassadors/1 DELETE /ambassadors/1.json | def destroy
@ambassador.destroy
respond_to do |format|
format.html { redirect_to ambassadors_url, notice: 'Ambassador was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @ambit.destroy\n respond_to do |format|\n format.html { redirect_to ambits_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @ambush = Ambush.find(params[:id])\n @ambush.destroy\n\n respond_to... | [
"0.71686554",
"0.7085181",
"0.7053505",
"0.7011877",
"0.69796616",
"0.6875542",
"0.6851114",
"0.68469024",
"0.6835392",
"0.68294364",
"0.68109524",
"0.67708063",
"0.67544514",
"0.6724222",
"0.6723062",
"0.6715777",
"0.6712444",
"0.67096865",
"0.6700439",
"0.6699218",
"0.66940... | 0.6997532 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_ambassador
@ambassador = Ambassador.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 ambassador_params
params.require(:ambassador).permit(:first_name, :last_name, :profile_photo,
:remove_profile_photo, :country, :twitter, :email, :gmp_statement, :bio,
:email_publishable, :website, :approved, :crop_x, :crop_y, :crop_w, :crop_h)
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.6978086",
"0.6780264",
"0.6742658",
"0.6738813",
"0.67338693",
"0.65908474",
"0.6501793",
"0.6495506",
"0.64796513",
"0.64755446",
"0.6454826",
"0.6437561",
"0.6377127",
"0.63722163",
"0.6364058",
"0.63178706",
"0.62979764",
"0.62968165",
"0.62913024",
"0.6289789",
"0.6289... | 0.0 | -1 |
button :apply, :id => 'editsubmitadminviewsuser' | def find_content content_title
self.content_title_field = content_title
apply
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loginSubmitBtn\n @dr.button(:id,'loginSubmitBtn')\n end",
"def submit_button \n\t\t@browser.button(id: @submit)\n\tend",
"def rcpstsave; det.button(:id, 'Save'); end",
"def button_up(id)\n\n end",
"def button_up(id); end",
"def button_to_edit(record, options={})\n button_to_action re... | [
"0.70225036",
"0.6839955",
"0.67712826",
"0.65542233",
"0.6516974",
"0.6498009",
"0.6483972",
"0.63929594",
"0.6334263",
"0.62258047",
"0.6210484",
"0.61991215",
"0.60959214",
"0.60823953",
"0.6081366",
"0.6061549",
"0.6059405",
"0.6049285",
"0.6047351",
"0.5991286",
"0.59491... | 0.0 | -1 |
in case engine was added in namespace | def guess_name(sections)
if sections.size > 1
sections[-1] = 'rails_db'
variable = sections.join("_")
result = eval(variable)
end
rescue NameError
sections.delete_at(-2)
guess_name(sections)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_engine\n end",
"def engine\n @engine ||= find_engine\n end",
"def engine; end",
"def engine\n return @engine if @engine\n self.engine = self.default_engine\n @engine\n end",
"def engines; engine_names; end",
"def engine_name\n @engine_name\n end",
"def engine\n ... | [
"0.7132681",
"0.71064615",
"0.6872416",
"0.67232186",
"0.659006",
"0.64695597",
"0.6335446",
"0.6335446",
"0.6300849",
"0.6280789",
"0.6264708",
"0.6235455",
"0.6235455",
"0.62343335",
"0.62343335",
"0.62343335",
"0.62343335",
"0.62343335",
"0.62343335",
"0.62343335",
"0.6234... | 0.0 | -1 |
import MOAS excel file to database for ATG content | def excel2mysql
moas_file_param = params[:excel_file]
catalog_file_param = params[:excel_catalog_file]
ymal_file_param = params[:excel_ymal_file]
language = params[:language]
table = language == 'english' ? 'atg_moas' : 'atg_moas_fr'
# initial AtgMoasImporting
atg_import = AtgMoasImporting.new table
# get temporary path of uploaded files
path = File.join(Dir.tmpdir, "#{File.basename(Rails.root.to_s)}_#{Time.now.to_i}_#{rand(100)}")
Dir.mkdir(path)
# upload file
moas_file_name = moas_file_param.blank? ? false : ModelCommon.upload_file(path, moas_file_param)
catalog_file_name = catalog_file_param.blank? ? false : ModelCommon.upload_file(path, catalog_file_param)
ymal_file_name = ymal_file_param.blank? ? false : ModelCommon.upload_file(path, ymal_file_param)
# import to mysql
if moas_file_name || catalog_file_name || ymal_file_name
moas_file = File.join(path, moas_file_name) if moas_file_name
catalog_file = File.join(path, catalog_file_name) if catalog_file_name
ymal_file = File.join(path, ymal_file_name) if ymal_file_name
@message = atg_import.import_atg_data moas_file, catalog_file, ymal_file, language
else
@message = '<p class="alert alert-error">Please select correct .xls/.xlsx file</p>'
end
FileUtils.rm_rf(path)
render 'index'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import(file)\n spreadsheet = ModelCommon.open_spreadsheet(file)\n return '<p class = \"alert alert-error\">Try to do the following instructions:<br/>\n 1. Please save as the file to excel format.<br/>\n 2. Make sure MOAS data in the first sheet.<br/>\n 3. Header is in the... | [
"0.7458066",
"0.6724324",
"0.6568057",
"0.6552013",
"0.6532915",
"0.6423492",
"0.6348425",
"0.620008",
"0.6192233",
"0.6133875",
"0.6127256",
"0.61022264",
"0.6071218",
"0.60239416",
"0.59733635",
"0.59496343",
"0.59138983",
"0.5886638",
"0.5881825",
"0.5868869",
"0.5831259",... | 0.6980701 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.