query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
POST /consumos POST /consumos.json | def create
@consumo = Consumo.new(params[:consumo])
respond_to do |format|
if @consumo.save
format.html { redirect_to @consumo.cliente, :notice => 'Consumo adicionado com sucesso.' }
format.json { render :json => @consumo, :status => :created, :location => @consumo }
else
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @consumo = Consumo.new(consumo_params)\n\n respond_to do |format|\n if @consumo.save\n format.html { redirect_to @consumo, notice: 'Consumo was successfully created.' }\n format.json { render :show, status: :created, location: @consumo }\n else\n format.html { rend... | [
"0.70352757",
"0.64376605",
"0.6434185",
"0.6427371",
"0.6196017",
"0.61579853",
"0.6125511",
"0.6118503",
"0.6085481",
"0.59165066",
"0.5904944",
"0.59007394",
"0.58832484",
"0.5857419",
"0.5847725",
"0.5833592",
"0.58187073",
"0.5810651",
"0.5802179",
"0.58019805",
"0.57940... | 0.6823912 | 1 |
PUT /consumos/1 PUT /consumos/1.json | def update
@consumo = Consumo.find(params[:id])
respond_to do |format|
if @consumo.update_attributes(params[:consumo])
format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }
format.json { head :no_content }
else
format.html { render :action ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @consumo.update(consumo_params)\n format.html { redirect_to @consumo, notice: 'Consumo was successfully updated.' }\n format.json { render :show, status: :ok, location: @consumo }\n else\n format.html { render :edit }\n format.json {... | [
"0.652192",
"0.62940246",
"0.6136523",
"0.6097513",
"0.6018487",
"0.5999629",
"0.5914193",
"0.5856723",
"0.58226657",
"0.58103126",
"0.57955664",
"0.57941645",
"0.57846594",
"0.57761693",
"0.5741386",
"0.57391024",
"0.573536",
"0.5729281",
"0.57183635",
"0.5705634",
"0.569327... | 0.6656378 | 0 |
DELETE /consumos/1 DELETE /consumos/1.json | def destroy
@consumo = Consumo.find(params[:id])
@consumo.destroy
respond_to do |format|
format.html { redirect_to consumos_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @consumo.destroy\n respond_to do |format|\n format.html { redirect_to consumos_url, notice: 'Consumo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @concurso = Concurso.find(params[:id])\n @concurso.destroy\n\n respond_to ... | [
"0.7191237",
"0.7097506",
"0.70437735",
"0.6938812",
"0.68583435",
"0.681157",
"0.6809005",
"0.6781027",
"0.6735512",
"0.6720991",
"0.66990656",
"0.6695535",
"0.6687152",
"0.668284",
"0.668284",
"0.668284",
"0.668284",
"0.6680758",
"0.6677691",
"0.6676861",
"0.6667477",
"0.... | 0.7400784 | 0 |
Click on a table Row Cell by providing text | def click_table_cell_by_text(tableId, columnNum, text)
self.class.elements(:tableRows, "#{'#' + tableId + ' tbody tr td:nth-of-type(' + columnNum.to_s + ')'}")
tableRows.each do |record|
if record.text.upcase.include? text.upcase
record.click
break
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def click_by_text_in_row(link_column, target_column, text)\n (0...rows_number).each do |row_number|\n return link(row_number, link_column).click if cell_text(row_number, target_column) == text\n end\n raise Capybara::ElementNotFound.new(\"Cell with provided text '#{text}' was not foun... | [
"0.7562308",
"0.6879781",
"0.6865235",
"0.68502265",
"0.670674",
"0.6576924",
"0.649305",
"0.64880705",
"0.6207486",
"0.60878325",
"0.6083698",
"0.60394865",
"0.6016036",
"0.5984803",
"0.5955661",
"0.595061",
"0.5930729",
"0.5918527",
"0.59148604",
"0.5897083",
"0.58751434",
... | 0.81778395 | 0 |
Assembling external memory references is difficult due to how many different types of addressing modes there are. The following is a summary of the different types of binary generated by each type of addressing mode: a_size = number of bytes in an address [0x4000] => direct generates: ext | direct | 0x4000 size: 1 | 1 ... | def assemble_external expression, instruction
type = [Processor::EXTERNAL].pack("C")
binary = nil
if expression.is_a? MemoryExpression or expression.is_a? Array
expression = MemoryExpression.flatten(expression)
expression = expression.map do |elem|
if elem.is_a? Register
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_memory_addressable\n hash = {}\n @data.length.times do |index|\n key = HumanComputer::Processor.eight_bitify index\n hash[key] = @data[index]\n end\n @data = hash\n end",
"def memadr; RAtlas::memadr(@storage);end",
"def memory_view(cols = nil,start_at = 8,end_at = ... | [
"0.54025227",
"0.5329242",
"0.5298607",
"0.52935493",
"0.522595",
"0.51798916",
"0.50956625",
"0.5048352",
"0.50413233",
"0.5035326",
"0.50299674",
"0.5003738",
"0.49561378",
"0.49352625",
"0.49088007",
"0.48978633",
"0.48851925",
"0.48303342",
"0.48172235",
"0.4814655",
"0.4... | 0.57764614 | 0 |
Allow string highlighting with Unix terminal codes. The +type+ of highlighting might be :bold, a color, e.g. :red, :blue or a background color, e.g. :red_bg, blue_bg, etc. If the +word+ is given, only the word will be highlighted. It is directly expanded in the Regexp, so you may use metacharacters, e.g. (John|Frank|Bi... | def hl(type=:bold,word=nil)
if word
self.gsub(/(\s|\A|[[:punct:]])#{word}(\s|\Z|[[:punct:]])/,
"\\1" + HIGHLIGHT[type] + word.to_s + HIGHLIGHT[:end] + "\\2")
else
HIGHLIGHT[type] + self.to_s + HIGHLIGHT[:end]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def highlight_words(t, words, html = true)\n if html\n t = h(t)\n end\n if html\n t = highlight(t, words, '<span class=\"highlight\">\\1</span>')\n else\n t = highlight(t, words, '*\\1*')\n end\n return t\n end",
"def highlight_word(wo... | [
"0.61852753",
"0.61152864",
"0.5969859",
"0.58535314",
"0.58162683",
"0.5812824",
"0.57508975",
"0.56662583",
"0.54929733",
"0.5382345",
"0.53774226",
"0.5291002",
"0.52687603",
"0.52466255",
"0.5224502",
"0.52198243",
"0.5147723",
"0.51030636",
"0.5066462",
"0.5050833",
"0.5... | 0.7581289 | 0 |
Convert input image to GIF format Converts the input image into GIF format. Supported input file formats include AAI, ART, ARW, AVS, BPG, BMP, BMP2, BMP3, BRF, CALS, CGM, CIN, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DIB, DJVU, DNG, DOT, DPX, EMF, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EXR, FAX, FIG, ... | def convert_to_gif(image_file, opts = {})
data, _status_code, _headers = convert_to_gif_with_http_info(image_file, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_gifs(text)\n text.tap do\n text.gsub!(/\\\\(includegraphics|image|imagebox)\\{(.*)\\.gif\\}/) do\n \"\\\\#{$1}{#{$2}.png}\"\n end\n end\n end",
"def images_to_gif(directory_name, gif_name)\n puts \"converting to gif\"\n sequence = Magick::ImageList.ne... | [
"0.68236804",
"0.66628206",
"0.64741564",
"0.63886136",
"0.6293928",
"0.62523377",
"0.62350035",
"0.6215011",
"0.61514425",
"0.61208045",
"0.6111659",
"0.6074932",
"0.5898166",
"0.5823249",
"0.5820812",
"0.57139343",
"0.5700818",
"0.564927",
"0.5516802",
"0.54905283",
"0.5376... | 0.6792816 | 1 |
Convert input image to PNG format Converts the input image into PNG format. Transparency is preserved when present. Supported input file formats include AAI, ART, ARW, AVS, BPG, BMP, BMP2, BMP3, BRF, CALS, CGM, CIN, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DIB, DJVU, DNG, DOT, DPX, EMF, EPDF, EPI, EPS, EPS2... | def convert_to_png(image_file, opts = {})
data, _status_code, _headers = convert_to_png_with_http_info(image_file, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_jpg_to_png(img_path)\n print_status(\"Converting #{img_path} back to PNG\")\n basename = File.basename(img_path, '.jpg')\n img = MiniMagick::Image.open(img_path)\n img.format('PNG')\n dst = \"#{WORKFOLDER}/#{basename}.png\"\n img.write(dst)\n dst\nend",
"def to_png\n return @png_data if !... | [
"0.6277595",
"0.6199377",
"0.61729455",
"0.59446204",
"0.589775",
"0.5883607",
"0.58124954",
"0.57322323",
"0.569562",
"0.5679239",
"0.5673995",
"0.56016433",
"0.55871046",
"0.55649585",
"0.55571324",
"0.5525057",
"0.55164343",
"0.55002517",
"0.54739505",
"0.5439914",
"0.5392... | 0.6211894 | 1 |
Convert input image to TIFF format Converts the input image into TIFF format. Supported input file formats include AAI, ART, ARW, AVS, BPG, BMP, BMP2, BMP3, BRF, CALS, CGM, CIN, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DIB, DJVU, DNG, DOT, DPX, EMF, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EXR, FAX, FIG... | def convert_to_tiff(image_file, opts = {})
data, _status_code, _headers = convert_to_tiff_with_http_info(image_file, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_tiff_from_storage\n puts('Update parameters of a TIFF image from cloud storage')\n\n upload_sample_image_to_cloud\n\n compression = 'adobedeflate'\n resolution_unit = 'inch'\n bit_depth = 1\n horizontal_resolution = 150.0\n vertical_resolution = 150.0\n from_scrat... | [
"0.60218656",
"0.5955547",
"0.59384567",
"0.5915101",
"0.58903563",
"0.5731619",
"0.56536585",
"0.5514673",
"0.54097784",
"0.52891546",
"0.5281001",
"0.52788836",
"0.524967",
"0.510062",
"0.5022573",
"0.50033545",
"0.500271",
"0.4994688",
"0.49587417",
"0.49293163",
"0.491241... | 0.6339593 | 0 |
Convert input image to WebP format Converts the input image into WebP format. Supported input file formats include AAI, ART, ARW, AVS, BPG, BMP, BMP2, BMP3, BRF, CALS, CGM, CIN, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DIB, DJVU, DNG, DOT, DPX, EMF, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EXR, FAX, FIG... | def convert_to_web_p(image_file, opts = {})
data, _status_code, _headers = convert_to_web_p_with_http_info(image_file, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_web_p_with_http_info(image_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertApi.convert_to_web_p ...'\n end\n # verify the required parameter 'image_file' is set\n if @api_client.config.client_side_validation && imag... | [
"0.6620884",
"0.5713643",
"0.5649952",
"0.5621545",
"0.53332627",
"0.52986544",
"0.5240108",
"0.52358127",
"0.5145401",
"0.51448953",
"0.5117544",
"0.51082855",
"0.508771",
"0.5076839",
"0.50647044",
"0.5001302",
"0.49994686",
"0.49938804",
"0.4991503",
"0.49359128",
"0.49162... | 0.63379884 | 1 |
Convert input image to WebP format Converts the input image into WebP format. Supported input file formats include AAI, ART, ARW, AVS, BPG, BMP, BMP2, BMP3, BRF, CALS, CGM, CIN, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DIB, DJVU, DNG, DOT, DPX, EMF, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EXR, FAX, FIG... | def convert_to_web_p_with_http_info(image_file, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ConvertApi.convert_to_web_p ...'
end
# verify the required parameter 'image_file' is set
if @api_client.config.client_side_validation && image_file.nil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_web_p(image_file, opts = {})\n data, _status_code, _headers = convert_to_web_p_with_http_info(image_file, opts)\n data\n end",
"def convert(src, dst, src_in_local, dst_in_local, is_url, options=nil, storage_name=nil)\r\n if src_in_local\r\n res = @storage_api.upload_file(\... | [
"0.63379884",
"0.5713643",
"0.5649952",
"0.5621545",
"0.53332627",
"0.52986544",
"0.5240108",
"0.52358127",
"0.5145401",
"0.51448953",
"0.5117544",
"0.51082855",
"0.508771",
"0.5076839",
"0.50647044",
"0.5001302",
"0.49994686",
"0.49938804",
"0.4991503",
"0.49359128",
"0.4916... | 0.6620884 | 0 |
Return a Pascal triangle (nested array form) of nrows rows. triangle(3) => [[1], [1, 1], [1, 2, 1]] | def triangle(nrows)
return [[1]] if nrows <= 1
previous = triangle(nrows-1)
center = previous[-1].enum_for(:each_cons, 2).map {|a| a[0] + a[1] }
return previous << ( [1] + center + [1] )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pascals_triangle(n)\n triangle = [[1]]\n until triangle.length == n\n triangle << row(triangle[-1])\n end\n triangle\nend",
"def pascals_triangle(n)\n triangle = []\n (1..n).each do |line|\n level = []\n num = 1\n (1..line).each do |idx|\n level << num\n num = (num * (... | [
"0.78848124",
"0.74172795",
"0.7341214",
"0.7282591",
"0.72663736",
"0.72478783",
"0.71485746",
"0.71241087",
"0.7075587",
"0.6990228",
"0.69005114",
"0.68514293",
"0.684826",
"0.68443733",
"0.68072337",
"0.673698",
"0.6699476",
"0.6665043",
"0.66432476",
"0.6590749",
"0.6507... | 0.7934575 | 0 |
From the useradd man page: Usernames must begin with a lower case letter or an underscore, and only lower case letters, underscores, dashes, and dollar signs may follow. In regular expression terms: [az_][az09_][$] so, let's ensure userName has only legitimate unix userName characters minus a trailing $ | def isValidUserName?(userName)
userName =~ /^[a-z_][a-z0-9_-]*$/
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_user_name(username)\n\t\tuser_name_input.set(username)\n\tend",
"def _user_add argv = {}\n\t\tf\t\t\t\t= {}\n\t\tf[:tag]\t\t\t= argv[:tag] if argv.include?(:tag)\n\t\tf[:salt] \t\t= _random 5\n\n\t\t#username\n\t\t_throw Sl[:'the user is existing'] if _user? f[:name]\n\t\tf[:name] \t\t= argv[:name]\n\n\t... | [
"0.64182556",
"0.63979477",
"0.6278934",
"0.6252592",
"0.6236244",
"0.6188283",
"0.61829185",
"0.61379486",
"0.61337274",
"0.6129119",
"0.61230654",
"0.6110801",
"0.6086576",
"0.6071301",
"0.60389155",
"0.6009239",
"0.59885633",
"0.5965699",
"0.5936659",
"0.5922872",
"0.59110... | 0.66052264 | 0 |
ensure semester is in our enum | def isValidSemester?(semester)
SEMESTERS.include? semester
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def semester\n time = time_from_enrollment\n @semester = time.div(1.year / 2) + 1\n @semester = 1 if @semester <= 0\n return @semester\n end",
"def current_semester\n AcademicCalendar.current_semester()\n end",
"def semester_params\n params.require(:semester).permit(:name, :semester_type)... | [
"0.6593471",
"0.6211786",
"0.6132404",
"0.6005632",
"0.59958345",
"0.5952233",
"0.5940253",
"0.59352857",
"0.5899491",
"0.57819396",
"0.57788783",
"0.5750849",
"0.57390904",
"0.57353115",
"0.57142234",
"0.56968343",
"0.5693378",
"0.5693378",
"0.5693378",
"0.5693378",
"0.56702... | 0.71140116 | 0 |
get_next_id generates a unique ID by using the systems nanosecond time and date | def get_next_id
id = java.lang.System.nanoTime.to_s
$log.info("*** get_next_id: " + id)
return id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_id\n id = java.lang.System.nanoTime.to_s\n $log.info(\"*** get_next_id: \" + id)\n return id\n end",
"def next_id\n next_id = \"sdc:\" + (current_id.to_i + 1).to_s\n next_id\n end",
"def next_id\n COUNTER_LOCK.synchronize do\n @@id_counter += 1\n ... | [
"0.8299884",
"0.77052766",
"0.7433611",
"0.74215883",
"0.74148977",
"0.7377411",
"0.7363795",
"0.73637074",
"0.7353245",
"0.72963095",
"0.728193",
"0.7279475",
"0.7219673",
"0.7173577",
"0.7157954",
"0.71211874",
"0.70744467",
"0.7022514",
"0.70192504",
"0.7018308",
"0.701449... | 0.83009565 | 0 |
is_id? tests to see if the provided ID is really an ID of the type specified | def is_id?(id, type: 'uuid')
is_id = false
# TODO - add support for other id types
if type == 'uuid'
is_id = id.to_s.match(/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}/) != nil
end
return is_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id?\n @kind == :id\n end",
"def is_id?(id, type: 'uuid')\n\n is_id = false\n\n # TODO - add support for other id types\n if type == 'uuid'\n is_id = id.to_s.match(/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}/) != nil\n end\n\n return is_id\n end",
"def is_... | [
"0.80270106",
"0.7745177",
"0.76106745",
"0.74916774",
"0.7412294",
"0.7374209",
"0.72572565",
"0.72273463",
"0.7180623",
"0.7042802",
"0.6870655",
"0.6690177",
"0.6623879",
"0.66138",
"0.6602176",
"0.6588058",
"0.65717864",
"0.6571646",
"0.65607375",
"0.6550523",
"0.6502666"... | 0.7888639 | 1 |
add_to_recents uses the standard fields for recently searched concepts to add an id and description to an array of these values in the session | def add_to_recents(recent_name, id, description, type, max_items: 20)
recents_array = []
added = false
# see if the recents array already exists in the session
if session[recent_name]
recents_array = session[recent_name]
end
# only proceed if the array does not already contain... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_recents(recent_name, id, description, type, max_items: 20)\n\n recents_array = []\n added = false\n\n # see if the recents array already exists in the session\n if session[recent_name]\n recents_array = session[recent_name]\n end\n\n # only proceed if... | [
"0.7213524",
"0.6120877",
"0.60893035",
"0.56719637",
"0.54275227",
"0.53561825",
"0.5335522",
"0.531444",
"0.5313405",
"0.5312729",
"0.5289892",
"0.52704215",
"0.5230078",
"0.52240616",
"0.5215842",
"0.5164931",
"0.51619005",
"0.5126851",
"0.5086846",
"0.50848985",
"0.508022... | 0.7274734 | 0 |
find_metadata_by_id loops through the metadata and finds an entry containing the specified id. | def find_metadata_by_id (id, id_type: 'uuid', return_description: true)
# loop through the metadata structure
$isaac_metadata_auxiliary.each_value do |value|
# check to see if the passed id matches the specified id in the metadata
if id_type == 'uuid' && value['uuids'] && value['uuids'].firs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(id)\n @entries_by_id[id]\n end",
"def find(id)\n map_id = proc { |object| object.respond_to?(:id) ? object.send(:id) : object }\n\n result = find_by_id_or_ids(map_id, id)\n\n fail RecordNotFound.new(\n \"Couldn't find #{name} with '#{id_property_name}'=#{id.... | [
"0.7123819",
"0.68432176",
"0.66340286",
"0.66118324",
"0.64986223",
"0.6452879",
"0.6421348",
"0.641429",
"0.6381623",
"0.63201684",
"0.6298941",
"0.6272282",
"0.62576735",
"0.6234774",
"0.62271476",
"0.62252873",
"0.6204429",
"0.6198183",
"0.61733437",
"0.6168367",
"0.61623... | 0.7348143 | 0 |
ruby_classname_to_java takes a class name in Ruby format (ex: 'Gov::Vha::Isaac::Rest::Api1::Data::Sememe::DataTypes::RestDynamicSememeString') and translates it into the format Java requires (ex: 'gov.vha.isaac.rest.api1.data.sememe.dataTypes.RestDynamicSememeString') | def ruby_classname_to_java(class_name:)
parts = class_name.to_s.split('::')
packageless_class_name = parts.pop
parts.map! do |package_part|
package_part[0] = package_part[0].downcase
package_part
end
parts << packageless_class_name
parts.join('.')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ruby_class_name as_class_name\n mapping = @as_mappings[as_class_name]\n return mapping.nil? ? nil : mapping.ruby\n end",
"def get_as_class_name ruby_class_name\n mapping = @ruby_mappings[ruby_class_name]\n return mapping.nil? ? nil : mapping.as\n end",
"def variable_name_to_cl... | [
"0.67329454",
"0.6651037",
"0.6544026",
"0.6544026",
"0.6504594",
"0.64634514",
"0.6442739",
"0.6345088",
"0.62438554",
"0.62101233",
"0.6080858",
"0.6080193",
"0.606856",
"0.59768575",
"0.59467345",
"0.5900172",
"0.58940905",
"0.5890482",
"0.5868726",
"0.5868092",
"0.5868092... | 0.8491701 | 0 |
Gets the decisionsThatWillMoveToNextStage property value. Indicate which decisions will go to the next stage. Can be a subset of Approve, Deny, Recommendation, or NotReviewed. If not provided, all decisions will go to the next stage. Optional. | def decisions_that_will_move_to_next_stage
return @decisions_that_will_move_to_next_stage
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decisions_that_will_move_to_next_stage=(value)\n @decisions_that_will_move_to_next_stage = value\n end",
"def current_state\n if self.steps.where(state: 'reproved').exists?\n 'reproved'\n elsif self.steps.pluck(:state).uniq == ['approved']\n 'approved'\n else\n ... | [
"0.7256391",
"0.51787287",
"0.5167713",
"0.50461113",
"0.4864818",
"0.48561892",
"0.48501733",
"0.48197678",
"0.48020464",
"0.47699532",
"0.47645614",
"0.4728726",
"0.4716207",
"0.4705542",
"0.47046205",
"0.47046205",
"0.47046205",
"0.4701429",
"0.4701429",
"0.4684312",
"0.46... | 0.78723776 | 0 |
Sets the decisionsThatWillMoveToNextStage property value. Indicate which decisions will go to the next stage. Can be a subset of Approve, Deny, Recommendation, or NotReviewed. If not provided, all decisions will go to the next stage. Optional. | def decisions_that_will_move_to_next_stage=(value)
@decisions_that_will_move_to_next_stage = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decisions_that_will_move_to_next_stage\n return @decisions_that_will_move_to_next_stage\n end",
"def set_forced_decision(context, decision)\n flag_key = context[:flag_key]\n return false if flag_key.nil?\n\n @forced_decision_mutex.synchronize { @forced_decisions[conte... | [
"0.69527286",
"0.49163887",
"0.46978626",
"0.46855605",
"0.45453748",
"0.4542635",
"0.45091438",
"0.44540757",
"0.4453449",
"0.4382159",
"0.436179",
"0.43593502",
"0.4356401",
"0.43007702",
"0.42980888",
"0.42686293",
"0.42325622",
"0.42312643",
"0.42305914",
"0.42183822",
"0... | 0.7590716 | 0 |
Gets the dependsOn property value. Defines the sequential or parallel order of the stages and depends on the stageId. Only sequential stages are currently supported. For example, if stageId is 2, then dependsOn must be 1. If stageId is 1, do not specify dependsOn. Required if stageId is not 1. | def depends_on
return @depends_on
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def depends_on=(value)\n @depends_on = value\n end",
"def DependsOn(value)\n case @DependsOn\n when nil\n @DependsOn = value\n when Array\n @DependsOn << value\n else\n @DependsOn = [@DependsOn, value]\n end\n if @DependsOn.is_a?(Array)... | [
"0.6011188",
"0.5652508",
"0.54645497",
"0.54500717",
"0.5154427",
"0.5129711",
"0.51015836",
"0.50402987",
"0.4867533",
"0.47671974",
"0.47396153",
"0.4692386",
"0.46523854",
"0.4636442",
"0.4517577",
"0.44919747",
"0.44908404",
"0.4476106",
"0.44671044",
"0.4448807",
"0.444... | 0.56527245 | 1 |
Sets the dependsOn property value. Defines the sequential or parallel order of the stages and depends on the stageId. Only sequential stages are currently supported. For example, if stageId is 2, then dependsOn must be 1. If stageId is 1, do not specify dependsOn. Required if stageId is not 1. | def depends_on=(value)
@depends_on = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def depends_on(*depends)\n @depends = depends.dup\n\n # Increment dependent references\n @depends.each { |b| b.ref }\n end",
"def DependsOn(value)\n case @DependsOn\n when nil\n @DependsOn = value\n when Array\n @DependsOn << value\n else\n @DependsOn = [@Depend... | [
"0.5965194",
"0.56522334",
"0.5530512",
"0.5472326",
"0.5397279",
"0.50156844",
"0.494808",
"0.4945352",
"0.48448995",
"0.48055828",
"0.47879332",
"0.4768004",
"0.4768004",
"0.47655198",
"0.4728635",
"0.47072938",
"0.47069854",
"0.4702889",
"0.46528342",
"0.4601824",
"0.45819... | 0.69749224 | 0 |
Gets the durationInDays property value. The duration of the stage. Required. NOTE: The cumulative value of this property across all stages 1. Will override the instanceDurationInDays setting on the accessReviewScheduleDefinition object. 2. Cannot exceed the length of one recurrence. That is, if the review recurs weekly... | def duration_in_days
return @duration_in_days
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration_in_days=(value)\n @duration_in_days = value\n end",
"def duration_days\n return nil if self.duration.blank?\n number,units=duration_parts\n return unless number.present? && units.present?\n\n if units=='years'\n number=12*number\n ... | [
"0.7092003",
"0.6467792",
"0.6257274",
"0.6229056",
"0.6181499",
"0.6156106",
"0.612126",
"0.6012268",
"0.6003044",
"0.592185",
"0.58348",
"0.58046883",
"0.57852614",
"0.5773335",
"0.57583237",
"0.57583237",
"0.5670316",
"0.5654951",
"0.5651534",
"0.5624046",
"0.5598334",
"... | 0.7363395 | 0 |
Sets the durationInDays property value. The duration of the stage. Required. NOTE: The cumulative value of this property across all stages 1. Will override the instanceDurationInDays setting on the accessReviewScheduleDefinition object. 2. Cannot exceed the length of one recurrence. That is, if the review recurs weekly... | def duration_in_days=(value)
@duration_in_days = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advance_start_at_duration_days=(value)\n value = if value.present? && value.to_i > 0\n value.to_i.days\n else\n nil\n end\n settings(:course).advance_start_at_duration = value\n end",
"def set_DailyDuration(value)\n set_input(\"DailyDuration\", va... | [
"0.59811765",
"0.5953175",
"0.5903367",
"0.5774423",
"0.57392496",
"0.57392496",
"0.5720973",
"0.57151496",
"0.5608898",
"0.5585719",
"0.5553434",
"0.54034007",
"0.5402124",
"0.5396234",
"0.5370588",
"0.53039175",
"0.5292287",
"0.5260422",
"0.5238873",
"0.5214099",
"0.5214099... | 0.76103944 | 0 |
Gets the fallbackReviewers property value. If provided, the fallback reviewers are asked to complete a review if the primary reviewers do not exist. For example, if managers are selected as reviewers and a principal under review does not have a manager in Azure AD, the fallback reviewers are asked to review that princi... | def fallback_reviewers
return @fallback_reviewers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fallback_reviewers=(value)\n @fallback_reviewers = value\n end",
"def fallback_reviewers=(value)\n @fallback_reviewers = value\n end",
"def reviewers=(value)\n @reviewers = value\n end",
"def reviewers\n return @... | [
"0.7206483",
"0.7206483",
"0.5494838",
"0.5469164",
"0.5395429",
"0.5157281",
"0.5156657",
"0.5153929",
"0.5122559",
"0.5088847",
"0.4974957",
"0.49745739",
"0.48771843",
"0.48745134",
"0.4854716",
"0.48105377",
"0.47869942",
"0.4762438",
"0.4676328",
"0.46561474",
"0.4624598... | 0.7393923 | 0 |
Sets the fallbackReviewers property value. If provided, the fallback reviewers are asked to complete a review if the primary reviewers do not exist. For example, if managers are selected as reviewers and a principal under review does not have a manager in Azure AD, the fallback reviewers are asked to review that princi... | def fallback_reviewers=(value)
@fallback_reviewers = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fallback_reviewers\n return @fallback_reviewers\n end",
"def fallback_reviewers\n return @fallback_reviewers\n end",
"def ar_fallbacks=(fallbacks)\n @@ar_fallbacks = fallbacks\n end",
"def reviewers=(value)\n @reviewers = value\n ... | [
"0.6409433",
"0.6409433",
"0.6159677",
"0.562908",
"0.55211407",
"0.52040064",
"0.50574064",
"0.49578118",
"0.49108902",
"0.47803882",
"0.46545982",
"0.4648263",
"0.45356196",
"0.44966865",
"0.44196358",
"0.43741873",
"0.43479207",
"0.43140155",
"0.42984998",
"0.42666355",
"0... | 0.75448424 | 0 |
Gets the recommendationInsightSettings property value. The recommendationInsightSettings property | def recommendation_insight_settings
return @recommendation_insight_settings
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recommendation_insight_settings=(value)\n @recommendation_insight_settings = value\n end",
"def settings\n return @settings\n end",
"def settings\n return @settings\n end",
"def review_settings\n return @review_s... | [
"0.74469316",
"0.62872636",
"0.62872636",
"0.62308437",
"0.60939705",
"0.60379344",
"0.60094017",
"0.5971691",
"0.59653467",
"0.58729506",
"0.5801804",
"0.57747126",
"0.577336",
"0.577336",
"0.5770097",
"0.57373995",
"0.57316273",
"0.5707745",
"0.5696673",
"0.5660665",
"0.566... | 0.82365364 | 0 |
Sets the recommendationInsightSettings property value. The recommendationInsightSettings property | def recommendation_insight_settings=(value)
@recommendation_insight_settings = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recommendation_insight_settings\n return @recommendation_insight_settings\n end",
"def review_settings=(value)\n @review_settings = value\n end",
"def recommendation=(value)\n @recommendation = value\n end",
"def recommendation... | [
"0.6398724",
"0.58032554",
"0.5798935",
"0.5630489",
"0.5578292",
"0.5578292",
"0.548954",
"0.5457831",
"0.53003985",
"0.53003985",
"0.53003985",
"0.5286503",
"0.5241219",
"0.508462",
"0.5027902",
"0.50108486",
"0.5007849",
"0.49799532",
"0.49799532",
"0.49790892",
"0.4923273... | 0.8271151 | 0 |
Gets the recommendationsEnabled property value. Indicates whether showing recommendations to reviewers is enabled. Required. NOTE: The value of this property will override override the corresponding setting on the accessReviewScheduleDefinition object. | def recommendations_enabled
return @recommendations_enabled
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_recommendation_enabled\n return @is_recommendation_enabled\n end",
"def recommendations_enabled=(value)\n @recommendations_enabled = value\n end",
"def is_recommendation_enabled=(value)\n @is_recommendation_enabled = value\n e... | [
"0.7731421",
"0.7622047",
"0.73274225",
"0.6145255",
"0.6135815",
"0.5918277",
"0.5918254",
"0.5918254",
"0.5918254",
"0.5918254",
"0.5918254",
"0.5918254",
"0.5918254",
"0.5831481",
"0.5831481",
"0.5831481",
"0.56902325",
"0.56788176",
"0.5617325",
"0.5617325",
"0.5610431",
... | 0.8018353 | 0 |
Sets the recommendationsEnabled property value. Indicates whether showing recommendations to reviewers is enabled. Required. NOTE: The value of this property will override override the corresponding setting on the accessReviewScheduleDefinition object. | def recommendations_enabled=(value)
@recommendations_enabled = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_recommendation_enabled=(value)\n @is_recommendation_enabled = value\n end",
"def recommendations_enabled\n return @recommendations_enabled\n end",
"def recommendation=(value)\n @recommendation = value\n end",
"def recommenda... | [
"0.71620977",
"0.6484856",
"0.6244601",
"0.59884965",
"0.59313625",
"0.5484406",
"0.522039",
"0.5146112",
"0.5144888",
"0.5076876",
"0.4923992",
"0.4923992",
"0.4923992",
"0.48996177",
"0.48996177",
"0.4897441",
"0.48871958",
"0.48820215",
"0.4860818",
"0.48295966",
"0.479651... | 0.7951128 | 0 |
Gets the reviewers property value. Defines who the reviewers are. If none are specified, the review is a selfreview (users review their own access). For examples of options for assigning reviewers, see Assign reviewers to your access review definition using the Microsoft Graph API. NOTE: The value of this property will... | def reviewers
return @reviewers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reviewers=(value)\n @reviewers = value\n end",
"def reviewers\n if review_committee.nil?\n offering_reviewers\n else\n review_committee.members.active_for(quarter_offered)\n end\n end",
"def get_reviewers\n self._get_reviewers\n end",
"def reviewers\n... | [
"0.72074157",
"0.6926436",
"0.6584723",
"0.635496",
"0.6225859",
"0.59284407",
"0.5900158",
"0.5835478",
"0.5835478",
"0.57971096",
"0.57940364",
"0.56970495",
"0.5644028",
"0.5598712",
"0.5598712",
"0.558115",
"0.55439115",
"0.55439115",
"0.55222297",
"0.5444217",
"0.5435487... | 0.74219555 | 0 |
Sets the reviewers property value. Defines who the reviewers are. If none are specified, the review is a selfreview (users review their own access). For examples of options for assigning reviewers, see Assign reviewers to your access review definition using the Microsoft Graph API. NOTE: The value of this property will... | def reviewers=(value)
@reviewers = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fallback_reviewers=(value)\n @fallback_reviewers = value\n end",
"def fallback_reviewers=(value)\n @fallback_reviewers = value\n end",
"def reviewers\n if review_committee.nil?\n offering_reviewers\n else\n review_committee.members.active_... | [
"0.61519504",
"0.61519504",
"0.60563076",
"0.59826475",
"0.5649621",
"0.54838455",
"0.5470576",
"0.54134995",
"0.5404911",
"0.53412116",
"0.526037",
"0.51564425",
"0.51482964",
"0.51291764",
"0.5123234",
"0.5108282",
"0.50393665",
"0.50240153",
"0.5007038",
"0.5003649",
"0.49... | 0.76676214 | 0 |
Gets the stageId property value. Unique identifier of the accessReviewStageSettings object. The stageId will be used by the dependsOn property to indicate the order of the stages. Required. | def stage_id
return @stage_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stage_id=(value)\n @stage_id = value\n end",
"def stage=(value)\n @stage = value\n end",
"def stage=(value)\n @stage = value\n end",
"def stage\n return @stage\n end",
"def stage\n ret... | [
"0.76041347",
"0.6104489",
"0.6104489",
"0.6072146",
"0.6072146",
"0.59834754",
"0.5929252",
"0.58679974",
"0.5707273",
"0.5707273",
"0.5707273",
"0.56801665",
"0.5620169",
"0.56086326",
"0.55665857",
"0.55580676",
"0.5532995",
"0.5517158",
"0.55027634",
"0.54011047",
"0.5401... | 0.78992474 | 0 |
Sets the stageId property value. Unique identifier of the accessReviewStageSettings object. The stageId will be used by the dependsOn property to indicate the order of the stages. Required. | def stage_id=(value)
@stage_id = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_stage\n @stage = Stage.find(params[:id])\n end",
"def set_stage\n @stage = Stage.find(params[:id])\n end",
"def set_stage\n @stage = Stage.find(params[:id])\n end",
"def set_stage\n @stage = Admin::Stage.find(params[:id])\n end",
"def set_stage\n @stage = St... | [
"0.6827119",
"0.6827119",
"0.6827119",
"0.6753966",
"0.6717101",
"0.6545843",
"0.6545843",
"0.6528769",
"0.65278804",
"0.6339483",
"0.6025743",
"0.59730875",
"0.59730875",
"0.5939686",
"0.5902498",
"0.5894594",
"0.58807695",
"0.5876857",
"0.5775906",
"0.5754508",
"0.5646443",... | 0.7913181 | 0 |
Validates that the answer is not empty. | def non_empty(answer)
answer = nil unless answer != ""
[answer, "I need an answer. Please?"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unanswered\n answers.blank?\n end",
"def validate_answer(answer)\n end",
"def validate\n (1..25).each do |i|\n if resulthash[\"ans\"+i.to_s].blank?\n self.errors.add_to_base \"Question ##{i} cannot be left blank.\"\n end\n end\n super\n end",
"def empty?\n que... | [
"0.7406286",
"0.69879574",
"0.68297905",
"0.67886406",
"0.66383207",
"0.6569885",
"0.65538776",
"0.65538776",
"0.65538776",
"0.65442187",
"0.6531862",
"0.64551055",
"0.64413965",
"0.64241177",
"0.6403215",
"0.6403215",
"0.6403215",
"0.6401844",
"0.6400148",
"0.6380891",
"0.63... | 0.7250824 | 1 |
Validates that the answer can be converted to an int. | def is_int(answer)
int_answer = answer.to_i
if int_answer == 0
int_answer = nil
end
[int_answer, "#{answer} must be a valid integer."]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def integer?(input)\n Integer(input) rescue false\nend",
"def validate_integer(input)\n input.to_s.to_i = input\nend",
"def is_integer?\n self =~ /\\A-?(?:0|[1-9][0-9]*)\\z/\n end",
"def is_number?(answer)\r\n answer.to_i != 0 || answer == '0'\r\n end",
"def is_int(value)\n true if Integer(... | [
"0.69029707",
"0.67666423",
"0.674236",
"0.67380846",
"0.6728658",
"0.6702539",
"0.6676092",
"0.6621661",
"0.65242755",
"0.6515026",
"0.64738446",
"0.64357924",
"0.64337474",
"0.6430747",
"0.64089406",
"0.6397494",
"0.6393397",
"0.6359789",
"0.63564795",
"0.63564795",
"0.6349... | 0.78368604 | 0 |
Validates that the answer can be converted to a float. :return [Array] The float answer; otherwise, None. | def is_float(answer)
float_answer = answer.to_f
if float_answer == 0.0
float_answer = nil
end
[float_answer, "#{answer} must be a valid float."]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_float(inFloat) \n\t returnValue = []\n\t if nil == inFloat\n\t\t returnValue << \"cannot be null \"\n\t else\n\t\t begin \n\t\t\t Float(inFloat)\n\t\t\t returnValue = nil \n\t\t rescue Exception => err \n\t\t\t returnValue = \" #{err.message }\" \n\t\t end \n\t end\n\t returnValue\n end... | [
"0.73046285",
"0.7252907",
"0.72353786",
"0.7227515",
"0.7145282",
"0.6930444",
"0.68829",
"0.6841656",
"0.6823386",
"0.66980225",
"0.6687357",
"0.6676965",
"0.6628463",
"0.66262126",
"0.6616342",
"0.6615794",
"0.6615794",
"0.65841895",
"0.65808856",
"0.6575971",
"0.656135",
... | 0.7668258 | 0 |
Validates that the answer is within a range. The answer must be of a type that can be compared to the lower and upper bounds. | def in_range(lower, upper)
Proc.new { |answer|
answer.between?(lower, upper) ? range_answer = answer : range_answer = nil
[range_answer, "#{answer} must be between #{lower} and #{upper}."]
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bounds(val, min, max)\n val >= min && val <= max\n end",
"def check_range(a)\n answer = case \n when (0 < a) && (a<= 50)\n \"Number is between 0 to 50\"\n when (51 < a) && (a <= 100)\n \"Number is between 51 to 100\"\n when (100 < a )\n \"Number is above 100\" \n else\n \"invalid\... | [
"0.7303391",
"0.7156027",
"0.71092325",
"0.7077964",
"0.7041564",
"0.701246",
"0.6986957",
"0.6943646",
"0.69332665",
"0.69164765",
"0.69058573",
"0.68366945",
"0.68366945",
"0.67793095",
"0.6779011",
"0.6730629",
"0.67292094",
"0.6716915",
"0.6706153",
"0.6703318",
"0.670201... | 0.74225384 | 0 |
most popular screening of a film instance version. | def most_popular_screening_film
most_popular = nil
unsold_tickets = 2 #max capacity of the cinema
screenings = return_film_screenings
screenings.each do |screening|
if screening.tickets_left.to_i < unsold_tickets
most_popular = screening
end
end
return most_popular
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def popular\n act = self.listings.map {|l| l.activity_id}\n activities = act.map {|a| Activity.find(a)}\n counts = Hash.new 0\n act.each do |id|\n counts[id] += 1\n end\n popular = 0\n appearances = 0\n counts.each do |id, value|\n if va... | [
"0.66931707",
"0.66745484",
"0.6669674",
"0.6564229",
"0.6524528",
"0.6497354",
"0.6374958",
"0.63659847",
"0.6275635",
"0.6258711",
"0.623711",
"0.6229962",
"0.6186026",
"0.61840796",
"0.6104253",
"0.6103129",
"0.6032058",
"0.6029956",
"0.60193276",
"0.6006586",
"0.5977203",... | 0.7642427 | 0 |
The gross price is the price + margin (or sales price, in case of absolutely priced goods). Taxes and rebate are not yet processed here. | def gross_price
if componentized?
gross_price = component_gross_price
else
absolutely_priced? ? gross_price = sales_price : gross_price = calculated_gross_price
end
return gross_price
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gross_price\n @gross_price = @net_price *(100 +VAT_RATE)/100\n end",
"def gross\n shop_sum_amount.to_f\n end",
"def gross\n # log_action \"gross #{ self.total_cents.inspect }\"\n return self.total\n end",
"def gross_total\n self.gross_amount ||= self.net_total + self.tax_t... | [
"0.7718189",
"0.74613166",
"0.7365658",
"0.72613853",
"0.7174767",
"0.71565396",
"0.7037629",
"0.6991144",
"0.6966006",
"0.6924484",
"0.6923043",
"0.6854425",
"0.67386603",
"0.6695342",
"0.66883504",
"0.66851294",
"0.66784275",
"0.66249675",
"0.661639",
"0.661639",
"0.6601910... | 0.8021328 | 0 |
Calculates all three pricing items (gross price, margin and compound purchase price) for products that consist of multiple products. This assigns all three results in one go so that a lot less calculation is necessary. | def calculate_component_pricing
purchase_price = BigDecimal.new("0")
price = BigDecimal.new("0")
margin = BigDecimal.new("0")
# Safeguard to prevent calculation on straightforward simple products
if componentized?
self.product_sets.each do |ps|
# Components can disappear if their sup... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_price\n result = 0.0\n @items.each do |item|\n name = item.name\n price = item.price\n final_taxed_price = price # Begin with price and add tax as necessary\n tax = 0.0\n\n # Is the item subject to sales tax (ie. not exempt)?\n if !is_exempt(name)\n # Not ex... | [
"0.66003853",
"0.6537234",
"0.6328423",
"0.62280107",
"0.617816",
"0.6172994",
"0.61547256",
"0.615337",
"0.61306465",
"0.6109853",
"0.6105222",
"0.61001205",
"0.60953826",
"0.6062725",
"0.60567063",
"0.603171",
"0.6025539",
"0.59949064",
"0.5982253",
"0.5973769",
"0.59677696... | 0.6985183 | 0 |
Returns how many of these products we could build based on the stock levels of its components at our suppliers. | def component_stock
stock_levels = []
product_sets.each do |ps|
# If any component's stock is below the required quantity, we can impossibly
# put together this product, so stock becomes immediately 0 as soon as we
# hit one of these combinations.
if ps.quantity > ps.component.stock
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_products_count\n products.inject(0) { |count, product| count + product.count.to_i }\n end",
"def quantity_of(product_or_supply_item)\n quantity = 0\n lines.each do |l|\n if l.product.componentized?\n l.product.product_sets.each do |ps|\n quantity = ps.quantity if ps.compo... | [
"0.69787365",
"0.6845343",
"0.6832558",
"0.6756684",
"0.6743956",
"0.6731811",
"0.67196286",
"0.6648839",
"0.66366297",
"0.6506859",
"0.64494",
"0.64224654",
"0.6416285",
"0.6416285",
"0.6406415",
"0.6406415",
"0.6406415",
"0.640007",
"0.6391244",
"0.63903517",
"0.6372732",
... | 0.7259603 | 0 |
Is this product priced via an absolutely defined sales price? | def absolutely_priced?
if sales_price.nil? or sales_price.blank? or sales_price == BigDecimal.new("0.0")
return false
else
return true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sale_price\r\n if (sale)\r\n if (sale.start > DateTime.now) || (DateTime.now > sale.end) #if the sale hasn't started yet or is over\r\n false\r\n else\r\n price * (100-sale.markdown) / 100\r\n end\r\n else\r\n false\r\n end\r\n end",
"def wholesale?\n line_items... | [
"0.7680884",
"0.7606168",
"0.7567047",
"0.74452096",
"0.73254824",
"0.72727597",
"0.72540015",
"0.71967447",
"0.71199095",
"0.70783806",
"0.7061856",
"0.7043308",
"0.7043308",
"0.70372266",
"0.69289684",
"0.69240195",
"0.6872929",
"0.6862789",
"0.68343395",
"0.682837",
"0.682... | 0.7908994 | 0 |
Returns a URL pointing to that particular product on the supplier's web page | def supplier_detail_link
if supplier.product_base_url.blank? or self.supplier_product_code.blank?
return nil
else
return "#{supplier.product_base_url}#{self.supplier_product_code}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_url(product, category = nil)\n if current_store.portal?\n host = product.store.hostname_at(current_store)\n show_product_url(product, host: host.to_s)\n else\n show_product_path(product, category)\n end\n end",
"def get_product_url(productname)\n category = data.produc... | [
"0.71597695",
"0.69827783",
"0.69739646",
"0.66186243",
"0.6519641",
"0.65144783",
"0.64857423",
"0.63830864",
"0.6362128",
"0.63248026",
"0.6296993",
"0.62855965",
"0.62835175",
"0.62674814",
"0.6252933",
"0.6242808",
"0.6242478",
"0.62392926",
"0.6205328",
"0.61461395",
"0.... | 0.7855223 | 0 |
If an URL to retrieve a product description from is set on this product's supply item, try to retrieve its product description from there and overwrite our own. | def try_to_get_product_description
unless self.supply_item.nil?
gotten_description = self.supply_item.get_description
self.description = gotten_description unless (gotten_description == false or gotten_description.blank? or gotten_description.nil?)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extended_description_field\n product_descriptions.where(content_name: \"extended_description\").first_or_initialize\n end",
"def description_field\n product_descriptions.where(content_name: \"description\").first_or_initialize\n end",
"def set_description_item\n @description_item = Description... | [
"0.6627473",
"0.63943934",
"0.62650526",
"0.62410915",
"0.6231409",
"0.6055924",
"0.58791494",
"0.5871656",
"0.5871656",
"0.5871656",
"0.58508927",
"0.58002675",
"0.5781467",
"0.577284",
"0.57702166",
"0.5747933",
"0.57308966",
"0.57034814",
"0.5695333",
"0.5691934",
"0.56504... | 0.8316427 | 0 |
gets 100 messages prior to id | def more_messages
log "Getting more_messages"
log "Old start_index: #@start_index"
max = @start_index - 1
@start_index = [(max + 1 - @limit), 1].max
log "New start_index: #@start_index"
fetch_ids = search_query? ? @ids[@start_index..max] : (@start_index..max).to_a
log fetch_ids... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def more_messages(message_id, limit=100)\n log \"More_messages: message_id #{message_id}\"\n message_id = message_id.to_i\n if @all_search \n x = [(message_id - limit), 0].max\n y = [message_id - 1, 0].max\n\n res = fetch_row_text((x..y))\n add_more_message_line(res, x)\n... | [
"0.68746316",
"0.6581727",
"0.6084397",
"0.6037579",
"0.60073775",
"0.60073775",
"0.5916121",
"0.5872539",
"0.587172",
"0.5844752",
"0.5789594",
"0.5782511",
"0.57277215",
"0.5677232",
"0.56678104",
"0.56626594",
"0.56323034",
"0.56186736",
"0.5556014",
"0.5555101",
"0.554979... | 0.6892577 | 0 |
render the item, parse the output and get all text inside elements | def render(item)
item.render({}, @site.site_payload)
doc = Nokogiri::HTML(item.output)
paragraphs = doc.search('//text()').map {|t| t.content }
paragraphs = paragraphs.join(" ").gsub("\r", " ").gsub("\n", " ").gsub("\t", " ").gsub(/\s+/, " ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render(item)\n item.render({}, @site.site_payload)\n doc = Nokogiri::HTML(item.output)\n paragraphs = doc.search('p').map {|e| e.text }\n paragraphs.join(\" \").gsub(\"\\r\",\" \").gsub(\"\\n\",\" \")\n end",
"def render(item)\n layoutless = item.dup\n Nokogiri::HTML(prep... | [
"0.7505436",
"0.691896",
"0.65507615",
"0.6416867",
"0.6405275",
"0.63507336",
"0.63291746",
"0.6309147",
"0.61894286",
"0.6122128",
"0.6094349",
"0.6075363",
"0.6075363",
"0.59973407",
"0.5967213",
"0.59440464",
"0.59440464",
"0.59260964",
"0.5917945",
"0.58689296",
"0.58684... | 0.7784067 | 0 |
Some elements on the page are hidden/shown using jQuery's 'slide' methods, which by default take 400ms to complete. So use this method to wait for a slideUp/slideDown to finish: | def wait_for_slide
sleep JQUERY_DEFAULT_SLIDE_DURATION
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_for_animation\n Selenium::WebDriver::Wait.new(:timeout => 60).until do\n sleep 1\n # jQuery(':animated').length is used to knwo how many animations are in the page\n @fox_driver.execute_script(\"return jQuery(':animated').length\") == 0\n end\n end",
"def test_slideDownUp\n @w_s... | [
"0.64720166",
"0.63334733",
"0.6193489",
"0.61410517",
"0.60774475",
"0.6005034",
"0.5983281",
"0.59823775",
"0.596853",
"0.596268",
"0.5930999",
"0.59273416",
"0.58933634",
"0.58771706",
"0.584134",
"0.5817285",
"0.58050364",
"0.57963574",
"0.57946044",
"0.5771665",
"0.57659... | 0.75792086 | 0 |
GET /price_schemas GET /price_schemas.json | def index
@price_schemas = PriceSchema.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_schemas\n @schemas\n end",
"def set_price_schema\n @price_schema = PriceSchema.find(params[:id])\n end",
"def index\n @schemas = Schema.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schemas }\n end\n end",
"def create\n ... | [
"0.6507403",
"0.64599013",
"0.64568096",
"0.6385191",
"0.60533077",
"0.59775054",
"0.59512395",
"0.5879976",
"0.5743132",
"0.5734136",
"0.5729152",
"0.5717819",
"0.5688578",
"0.5676315",
"0.56401014",
"0.56123",
"0.55903816",
"0.5586991",
"0.5578747",
"0.5547294",
"0.55132324... | 0.76342624 | 0 |
POST /price_schemas POST /price_schemas.json | def create
@price_schema = PriceSchema.new(price_schema_params)
respond_to do |format|
if @price_schema.save
format.html { redirect_to @price_schema, notice: 'Price schema was successfully created.' }
format.json { render action: 'show', status: :created, location: @price_schema }
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_schema_params\n params.require(:price_schema).permit(:quantity, :unit, :price)\n end",
"def index\n @price_schemas = PriceSchema.all\n end",
"def set_price_schema\n @price_schema = PriceSchema.find(params[:id])\n end",
"def create\n @schema = Schema.new(params[:schema])\n\n ... | [
"0.6763598",
"0.6184148",
"0.6054222",
"0.5904208",
"0.5865514",
"0.5824644",
"0.57909775",
"0.57909775",
"0.5550197",
"0.5531736",
"0.53971046",
"0.5339508",
"0.53229016",
"0.5304472",
"0.52619874",
"0.5185816",
"0.51671433",
"0.51619756",
"0.51522243",
"0.51192975",
"0.5049... | 0.7180889 | 0 |
PATCH/PUT /price_schemas/1 PATCH/PUT /price_schemas/1.json | def update
respond_to do |format|
if @price_schema.update(price_schema_params)
format.html { redirect_to @price_schema, notice: 'Price schema was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @json_schemas = args[:json_schemas] if args.key?(:json_schemas)\n @schema = args[:schema] if args.key?(:schema)\n end",
"def update!(**args)\n @open_apiv3_schema = args[:open_apiv3_schema] if args.key?(:open_apiv3_schema)\n end",
"def set_price_sch... | [
"0.6690044",
"0.64111525",
"0.63931215",
"0.6191255",
"0.61669105",
"0.60751224",
"0.60751224",
"0.5984355",
"0.5984355",
"0.5983666",
"0.58929676",
"0.58349293",
"0.5830169",
"0.57883364",
"0.57697505",
"0.57337964",
"0.57071793",
"0.5693553",
"0.5689933",
"0.56553286",
"0.5... | 0.70796 | 0 |
DELETE /price_schemas/1 DELETE /price_schemas/1.json | def destroy
@price_schema.destroy
respond_to do |format|
format.html { redirect_to price_schemas_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @schema = Schema.find(params[:id])\n @schema.destroy\n\n respond_to do |format|\n format.html { redirect_to schemas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schema = Schema.find(params[:id])\n @schema.destroy\n\n respond_to do |format|\n... | [
"0.6866441",
"0.6866441",
"0.6642747",
"0.6642747",
"0.6642747",
"0.66397655",
"0.6356023",
"0.627577",
"0.6275254",
"0.6272378",
"0.62273437",
"0.61918706",
"0.61285514",
"0.6093832",
"0.6075029",
"0.6044371",
"0.6028896",
"0.60251987",
"0.60178447",
"0.6010923",
"0.60087353... | 0.76170033 | 0 |
def visitBody node puts "body" | def visitBody node
puts "body"
# for now, always inactive.
if node.wrapperBody
@code.newline
node.stmts.each do |el|
el.accept self unless el.nil?
end
@code.newline
else
@code << "("
node.stmts.each do |el|
el.accept self un... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body!\n... | [
"0.7212809",
"0.7212809",
"0.7212809",
"0.7212809",
"0.7212809",
"0.7212809",
"0.7212809",
"0.7212809",
"0.7212809",
"0.7212809",
"0.7212809",
"0.7212809",
"0.7212809",
"0.7212809",
"0.7212809",
"0.7212809",
"0.7201945",
"0.71506155",
"0.6931471",
"0.68422216",
"0.6641301",
... | 0.7679292 | 0 |
Checks if the remote website is up. | def online?
Browser.get(url).code != 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection?\n check = Netchecker.new() \n @alive = check.check_url(\"google.com\", 80) \n end",
"def is_reachable_url?(url)\n begin\n wait(15, true, 1) {\n RestClient.get url\n }\n\n rescue Exception => e\n @@logger.an_event.debug \"url #{url} unreach... | [
"0.7208984",
"0.69154316",
"0.69058305",
"0.67949003",
"0.6760587",
"0.6700621",
"0.6571804",
"0.647727",
"0.6459538",
"0.64575475",
"0.64524114",
"0.6427016",
"0.6427016",
"0.6427016",
"0.6401552",
"0.6394745",
"0.63531697",
"0.63491756",
"0.6321594",
"0.63131666",
"0.629589... | 0.7253043 | 0 |
combines blog posts and change log posts grouped by month/year | def blog_and_grouped_changelog_posts
all_posts = blog_posts + changelog_posts_grouped.values
all_posts.sort_by do |p|
# If the post is a changelog group, sort by the first post in the group
p = p.first if p.is_a?(Array)
-p.data['posted'].to_time.to_i
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_blog_archives(item_set = nil)\n item_set ||= published_weblog\n archive_years(item_set).each do |year|\n @items.create(\n %(<%= render('/blog/archive.*', year: #{year}) %>),\n { title: \"Weblog postings from #{year}\", kind: 'archive-page', is_hidden: true, descripti... | [
"0.6197865",
"0.61886024",
"0.6077889",
"0.6060903",
"0.60333174",
"0.60256803",
"0.6006398",
"0.5861656",
"0.58312744",
"0.5817149",
"0.57885915",
"0.5779383",
"0.5767627",
"0.57141906",
"0.545503",
"0.54522485",
"0.54208416",
"0.5382447",
"0.53698325",
"0.5356632",
"0.53381... | 0.7499176 | 0 |
Social Share Link Helpers | def post_share_href(post)
"#{base_url}#{blog_post_href(post)}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def social_shares(e)\n return unless (e.facebook_share || e.instagram_share || e.linkedin_share || e.xing_share || e.twitter_share)\n c = '<div class=\"social button-wrapper\"> '.html_safe\n\n if e.facebook_share\n c+= \"<a class='fb-share' title='#{t('ShareOnFacebook')}' onclick='#{onclick_s... | [
"0.7726887",
"0.7319905",
"0.7264143",
"0.72061837",
"0.7055953",
"0.7010776",
"0.69673157",
"0.6934136",
"0.69187313",
"0.6800325",
"0.67400616",
"0.66820735",
"0.66617996",
"0.66597503",
"0.6657156",
"0.6631062",
"0.65412617",
"0.63767445",
"0.63475287",
"0.6344868",
"0.633... | 0.737777 | 1 |
Set default open_timeout for this Client | def open_timeout(timeout = nil)
timeout.nil? ? @open_timeout || DEFAULT_OPEN_TIMEOUT : @open_timeout = timeout
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_timeout=(open_timeout); end",
"def open_timeout= open_timeout\n @agent.open_timeout = open_timeout\n end",
"def default_timeout\n @default_timeout ||= 20000\n end",
"def default_timeout\n @default_timeout ||= 30\n end",
"def default_timeout\n 60\n end",
"def open_time... | [
"0.80087173",
"0.7982937",
"0.760928",
"0.7590545",
"0.74885565",
"0.73397464",
"0.729109",
"0.71938485",
"0.71870685",
"0.7158179",
"0.7133864",
"0.7102132",
"0.7038384",
"0.70298195",
"0.70298195",
"0.6994412",
"0.6994412",
"0.6994412",
"0.6994412",
"0.6896357",
"0.68759555... | 0.81044763 | 0 |
Set default read_timeout for this Client | def read_timeout(timeout = nil)
timeout.nil? ? @read_timeout || DEFAULT_READ_TIMEOUT : @read_timeout = timeout
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_timeout= read_timeout\n @agent.read_timeout = read_timeout\n end",
"def read_timeout=(read_timeout); end",
"def def_read_timeout\n 10\n end",
"def def_read_timeout\n 10\n end",
"def read_timeout=(sec); end",
"def read_timeout= secs\n if secs\n @read_timeout = secs\n @rea... | [
"0.81829447",
"0.79064375",
"0.7696722",
"0.7696722",
"0.75363433",
"0.74587816",
"0.7447019",
"0.72082895",
"0.7076686",
"0.7076686",
"0.7076686",
"0.7076686",
"0.7076686",
"0.7076686",
"0.7076686",
"0.7076686",
"0.6907598",
"0.68667686",
"0.68667686",
"0.68667686",
"0.67979... | 0.80378807 | 1 |
Retunrs all edges in the graph | def all_edges
@edges.values.inject { |arr1, arr2| arr1 + arr2 } || []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_edges\n\t\t@e.uniq\n\tend",
"def edges\n @vertices.reduce(Set.new) { |edges, vertex| edges + vertex.edges }\n end",
"def get_edges\n getEdges.to_route(:graph => self, :element_type => :edge)\n end",
"def get_edges\n getEdges.to_route(:graph => self, :element_type => :edge)\n end",... | [
"0.7756489",
"0.75661254",
"0.74954104",
"0.74954104",
"0.7494948",
"0.72821593",
"0.7243465",
"0.7203271",
"0.7192152",
"0.7184931",
"0.7082358",
"0.7028515",
"0.6917694",
"0.68617254",
"0.68014425",
"0.6645429",
"0.66085494",
"0.6578564",
"0.65758735",
"0.6539221",
"0.65272... | 0.7608893 | 1 |
Adds a vertex to the graph | def add_vertex(v)
@vertices << v
@edges[v] = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(vertex)\n raise TypeError, 'Argument is not an instance of Vertex' unless vertex.instance_of? Vertex\n raise GraphError.new('Vertex with this name already exists in the graph', GraphError::ERROR_DUPLICATE_VERTEX) unless find_index_for_vertex(vertex.name) == nil\n\n @vertices << vertex\n\n ... | [
"0.84215605",
"0.82709056",
"0.82599694",
"0.8190214",
"0.8061664",
"0.79139775",
"0.778584",
"0.778584",
"0.77418524",
"0.7649019",
"0.763538",
"0.76192725",
"0.76064867",
"0.75971776",
"0.75012934",
"0.7500112",
"0.7470956",
"0.7375805",
"0.7217267",
"0.71942866",
"0.703795... | 0.8431638 | 0 |
Adds an edge to the graph | def add_edge(e)
@edges[e.from] << e
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(edge)\n @edges.push(edge)\n end",
"def add_edge(e)\n add_vertex(e.from); add_vertex(e.to)\n (@from_store[e.from].add?(e) && @to_store[e.to].add(e) && e) || edge(e.from, e.to)\n end",
"def add_edge(edge)\n @edges << edge\n add_node(edge.n1) unless @nodes.find_index(edge.n1)... | [
"0.8618433",
"0.81135494",
"0.8070019",
"0.80680573",
"0.7985665",
"0.7959682",
"0.79263705",
"0.79203504",
"0.7823857",
"0.77413684",
"0.77127737",
"0.76881623",
"0.7654966",
"0.76063913",
"0.75998133",
"0.75978285",
"0.758508",
"0.7519496",
"0.7492176",
"0.7477944",
"0.7468... | 0.85115963 | 1 |
If the graph is a bigraph finds its maximal matching. | def max_matching(left, right)
g = Graph.new
left.each do |v|
g.add_vertex v
end
right.each do |v|
g.add_vertex v
end
source = Vertex.new "source"
g.add_vertex source
sink = Vertex.new "sink"
g.add_vertex sink
capacity_table = {
source => {},
sink => {}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findMaximum(weights)\n\t\n\tputs \"Weights\" if DEBUG_OUTPUT\n\tprintMatrix(weights) if DEBUG_OUTPUT\n\t# l(x) == l[x]\n\t\t\n\teq = EqualityGraph.new(weights)\n\teq.generateLabelFunctions()\n\t\n\t#Generate equality graph\n\t\n\teq.generateEqualityGraph()\n\t\n\t#Pick an abitrary matching in the equality su... | [
"0.6513101",
"0.6305472",
"0.605911",
"0.6046384",
"0.58655673",
"0.5839129",
"0.58050734",
"0.5712838",
"0.57078457",
"0.5695994",
"0.5695488",
"0.5682045",
"0.5678639",
"0.5676696",
"0.5672187",
"0.5659191",
"0.56315374",
"0.5607294",
"0.5584432",
"0.5564443",
"0.55610883",... | 0.70305365 | 0 |
Finds a path from "from" to "to" using BFS. Returns nil if no path exists. | def path(from, to)
prev = bfs(from)[0]
return nil unless prev[to]
rev_path = []
current_vertex = to
while current_vertex
rev_path << current_vertex
current_vertex = prev[current_vertex]
end
rev_path.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def knight_path(from, to)\n\topen_queue = [PositionPath.new( from, [copy(from)] )]\n\tdiscovered = [from]\n\n\tuntil open_queue.empty?\n\t\tcurrent = open_queue.shift\n\n\t\treturn current.path if current.position == to\n\t\tvalid_moves(current.position).each do |move|\n\t\t\tunless discovered.include?(move)\n\t\t... | [
"0.665062",
"0.65655214",
"0.6435137",
"0.6159329",
"0.6131742",
"0.6108185",
"0.60657656",
"0.59942883",
"0.5940551",
"0.5899212",
"0.58972114",
"0.58711505",
"0.5826118",
"0.581928",
"0.5734547",
"0.571152",
"0.5628936",
"0.5627653",
"0.5611357",
"0.56046635",
"0.5572079",
... | 0.68691117 | 0 |
Performs breadthfirstsearch. Returns a hash with predecessors and a hash with calculated distances from "source" vertex. | def bfs(source)
color = {}
prev = {}
dist = {}
@vertices.each do |v|
color[v] = "white"
prev[v] = nil
dist[v] = -1
end
color[source] = "grey"
dist[source] = 0
queue = []
queue.push source
while !queue.empty?
v = queue.pop
(@edges[v] || []).each do |e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def breadth_first_search(root)\n visited = {}\n distance = {}\n predecessor = {}\n\n visited[root] = true\n distance[root] = 0\n predecessor[root] = nil\n\n queue = [ root ]\n\n while from = queue.shift\n\tnext unless @graph[from]\n\t@graph[from].each_key do |to|\n\t unless... | [
"0.71070683",
"0.7099129",
"0.6998231",
"0.69473225",
"0.6915773",
"0.6827772",
"0.6512402",
"0.6489084",
"0.6488816",
"0.6368151",
"0.63148195",
"0.6176492",
"0.6163919",
"0.61636466",
"0.6155967",
"0.61490804",
"0.60921454",
"0.6069526",
"0.5998759",
"0.59623975",
"0.596157... | 0.71374404 | 0 |
Creates an edge in residual graph. | def create_res_edge(from, to, res_capacity)
edge = Edge.new(from, to)
class << edge; class_eval "attr_accessor :res_capacity"; end
edge.res_capacity = res_capacity
@edges[from] ||= []
@edges[from] << edge
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(source, target = nil, label = nil)\n @reversal = nil\n if target\n edge = Puppet::Relationship.new(source, target, label)\n else\n edge = source\n end\n [edge.source, edge.target].each { |vertex| setup_vertex(vertex) unless vertex?(vertex) }\n ... | [
"0.59703076",
"0.5897219",
"0.58854216",
"0.58259076",
"0.5818264",
"0.57387936",
"0.57272",
"0.5652719",
"0.56451845",
"0.5635385",
"0.5599929",
"0.55946153",
"0.55640566",
"0.55605537",
"0.5500569",
"0.5489005",
"0.5475929",
"0.5470748",
"0.5446459",
"0.5422895",
"0.5422603... | 0.650958 | 0 |
Returns minimum residual capacity at given path. | def min_res_capacity_at_path(path)
min = nil
path.inject do |pred, succ|
edge = @edges[pred].select { |e| e.to == succ }.first
min = edge.res_capacity if min.nil? or min > edge.res_capacity
succ
end
min
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_remaining_cost(path)\n return 0 if @goal_location == path.location\n (path.turns + 1 ... path.turns + path.location.manhattan_distance(@goal_location)).sum + @costs[*@goal_location]\n end",
"def demand\n demand = 0\n (@path.size - 1).times { |i| demand += @path[i].demand }\n return demand... | [
"0.65256447",
"0.61771494",
"0.60027665",
"0.58831435",
"0.5779311",
"0.57506496",
"0.56617844",
"0.5598871",
"0.5482563",
"0.53983545",
"0.5370424",
"0.530395",
"0.52694196",
"0.5196679",
"0.5193102",
"0.51836824",
"0.51821977",
"0.51551163",
"0.5135798",
"0.5119455",
"0.510... | 0.87079096 | 0 |
Sets the value for the puzzle cell at the specified coordinate | def []=(row, column, value)
puzzle[row][column] = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def []=(pos, value)\n if valid_pos?(pos)\n row, col = pos\n if @grid[row][col].given == true\n @grid[row][col].value = value\n else\n \"Cannot change tiles that have already been set by the puzzle\"\n end\n else\n pu... | [
"0.7911338",
"0.7616317",
"0.7533043",
"0.74035645",
"0.73676175",
"0.7264784",
"0.72564983",
"0.72264624",
"0.72153795",
"0.720204",
"0.71758235",
"0.7154604",
"0.71008855",
"0.7097328",
"0.7085516",
"0.70450985",
"0.70358634",
"0.6985464",
"0.6981754",
"0.6972836",
"0.69035... | 0.7833762 | 1 |
Returns an array of values associated with each column of the puzzle | def columns
puzzle.transpose
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_array_by_col()\n\t\tprepare(@dim_i,@dim_j)\n\t\ttmpTab = Array.new\n\t\tfor j in 0..@dim_j-1\n\t\t\ttmpTab.push get_col(j)\n\t\tend\n\t\treturn tmpTab\n\tend",
"def board_column_values(board, column_number)\n column_values = []\n\n BOARD_HEIGHT.times do |i|\n column_values << board.values[column_num... | [
"0.7450361",
"0.73300946",
"0.70243293",
"0.69469756",
"0.6877359",
"0.6825557",
"0.67831975",
"0.6775628",
"0.67737114",
"0.6768638",
"0.671937",
"0.6690661",
"0.6661872",
"0.66069245",
"0.65728736",
"0.6567312",
"0.654123",
"0.65371716",
"0.6516046",
"0.648807",
"0.6481672"... | 0.7885427 | 0 |
Returns the size of this puzzle's sections Example: sudoku = Sudoku::Puzzle.new(puzzle_9x9) sudoku.section_size => 3 | def section_size
@section_size ||= Math.sqrt(puzzle.size).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def padded_size\n self.course.sections.count\n end",
"def top_level_section_count\n @top_level.items.size\n end",
"def number_of_cells(size)\n size * size\n end",
"def num_questions\n n = 0\n self.sections.each do |s|\n n+= s.questions.size()\n end\n return n\n end",... | [
"0.68799984",
"0.637927",
"0.6358781",
"0.6244835",
"0.616537",
"0.61359686",
"0.6101392",
"0.60612553",
"0.6046847",
"0.6044865",
"0.6004165",
"0.5971679",
"0.5862678",
"0.5858277",
"0.5848881",
"0.5848881",
"0.5848212",
"0.5845259",
"0.58288205",
"0.5823606",
"0.5811526",
... | 0.89191395 | 0 |
Returns an array of coordinates corresponding to each section Example: sudoku = Sudoku::Puzzle.new(puzzle_9x9) sudoku.sections[0] => [[0,0], [0,1], [0,2], [1,0], [1,1], [1,2], [2,0], [2,1], [2,2]] | def sections
(1..section_size).inject([]) do |array, row_offset|
(1..section_size).inject(array) do |array, column_offset|
array << section_coordinates(row_offset - 1, column_offset - 1)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def section_coordinates(row_offset, column_offset)\n row_start = row_offset * section_size\n row_end = row_start + section_size - 1\n column_start = column_offset * section_size\n column_end = column_start + section_size - 1\n ((row_start..row_end).to_a * section_size).sort.zip((... | [
"0.71103597",
"0.6337902",
"0.5991874",
"0.59573007",
"0.59215724",
"0.58984286",
"0.5850614",
"0.5827265",
"0.5702719",
"0.5680192",
"0.56562793",
"0.56534714",
"0.55644786",
"0.5562128",
"0.54828006",
"0.5465035",
"0.54642636",
"0.5446033",
"0.5397862",
"0.53825736",
"0.537... | 0.84473985 | 0 |
Solves this instance's puzzle, returns self | def solve!
solve
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solve\n # If the puzzle has already been solved, don't solve it again, just return.\n return self if solved?\n\n # If the puzzle is not valid, we'll error out.\n @algorithm.solve(self) if valid?\n\n self\n # Catch puzzle validity errors\n rescue => e\n puts \"Error: #{e.message}\"\n exit... | [
"0.813513",
"0.74414283",
"0.7388555",
"0.7200238",
"0.71664983",
"0.70891094",
"0.69701564",
"0.6784843",
"0.6705811",
"0.6680431",
"0.6654649",
"0.6644317",
"0.662501",
"0.6621987",
"0.65225756",
"0.6506141",
"0.65035367",
"0.6449995",
"0.642976",
"0.64192253",
"0.6386533",... | 0.7689173 | 1 |
Checks if all values are filled in and unique for the column at the specified index. | def valid_column?(index)
column_values = column(index).compact
column_values == column_values.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_row?(index)\n row_values = row(index).compact\n row_values == row_values.uniq\n end",
"def unique?\n if @data.fetch(:Index_type) == \"UNIQUE\" || @data.fetch(:Non_unique).to_i == 0\n return true\n else\n return false\n end\n end",
"def unique?\n indexes.any?{... | [
"0.71443766",
"0.65963584",
"0.64998925",
"0.6380058",
"0.6193918",
"0.61818886",
"0.60255104",
"0.58900154",
"0.58779633",
"0.57940793",
"0.57758695",
"0.57441145",
"0.57055235",
"0.56840533",
"0.568029",
"0.56409127",
"0.5640652",
"0.56335175",
"0.5627777",
"0.56257814",
"0... | 0.77787197 | 0 |
Checks if all values are filled in and unique for the row at the specified index. | def valid_row?(index)
row_values = row(index).compact
row_values == row_values.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_column?(index)\n column_values = column(index).compact\n column_values == column_values.uniq\n end",
"def unique?\n if @data.fetch(:Index_type) == \"UNIQUE\" || @data.fetch(:Non_unique).to_i == 0\n return true\n else\n return false\n end\n end",
"def unique?\n ... | [
"0.6771135",
"0.64296603",
"0.6366138",
"0.6153902",
"0.6128635",
"0.6122761",
"0.60767883",
"0.60510385",
"0.59843177",
"0.59647673",
"0.5868192",
"0.58097947",
"0.57975185",
"0.57810205",
"0.57644814",
"0.5703764",
"0.5682127",
"0.5676877",
"0.5643577",
"0.56419665",
"0.564... | 0.78782153 | 0 |
Returns an array of coordinates for the section starting at the specified row_offset and column_offset | def section_coordinates(row_offset, column_offset)
row_start = row_offset * section_size
row_end = row_start + section_size - 1
column_start = column_offset * section_size
column_end = column_start + section_size - 1
((row_start..row_end).to_a * section_size).sort.zip((column_sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sections\n (1..section_size).inject([]) do |array, row_offset|\n (1..section_size).inject(array) do |array, column_offset|\n array << section_coordinates(row_offset - 1, column_offset - 1)\n end\n end\n end",
"def position\n [ @row_offset, @col_offset ]\n end",
"... | [
"0.71936095",
"0.6647717",
"0.6590624",
"0.64106905",
"0.64089453",
"0.62069064",
"0.6140048",
"0.6100737",
"0.6085015",
"0.6081942",
"0.6081335",
"0.6046134",
"0.60393184",
"0.60367167",
"0.6032078",
"0.6010883",
"0.6009118",
"0.5972862",
"0.59649026",
"0.5959625",
"0.593743... | 0.8423914 | 0 |
Load gems. Returns a Gems::List. Old data structures are automatically converted to new data structures. | def gems
gem_data = (project['gems'] ||= Gems::List.new)
return gem_data if gem_data.kind_of? Gems::List
if gem_data.kind_of? Hash
project['gems'] = Gems::List.new(gem_data)
save_config
return gems
end
new_gems = Gems::List.new
gem_data.each do |gem_ary|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installed_gems\n gems = []\n\n cmd = [attributes.gem_binary, 'list', '-l']\n cmd << '--prerelease' if attributes.prerelease\n\n run_command(cmd).stdout.each_line do |line|\n next unless /\\A([^ ]+) \\(([^\\)]+)\\)\\z/ =~ line.strip\n\n name = $1\n versions... | [
"0.7409601",
"0.7108708",
"0.68654406",
"0.65894294",
"0.64937145",
"0.64765227",
"0.63580143",
"0.63390815",
"0.62836874",
"0.6276279",
"0.6264442",
"0.6242888",
"0.6240599",
"0.6202391",
"0.61262804",
"0.6090158",
"0.5978206",
"0.59757537",
"0.59741616",
"0.5949479",
"0.592... | 0.7708546 | 0 |
GET /proyects GET /proyects.json | def index
@proyects = Proyect.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @proyects }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @proyects = Proyect.all\n end",
"def index\n @proyects = Proyect.all\n end",
"def show\n @proyect = Proyect.find(params[:id])\n if request.path != proyect_path(@proyect)\n redirect_to @proyect, status: :moved_permanently\n end\n\n respond_to do |format|\n format.html #... | [
"0.73681486",
"0.73681486",
"0.66322047",
"0.64679843",
"0.64679843",
"0.64679843",
"0.64679843",
"0.62654567",
"0.6214996",
"0.6156734",
"0.61553043",
"0.6121133",
"0.6121133",
"0.6121133",
"0.61067563",
"0.6078598",
"0.60463846",
"0.6030237",
"0.6030237",
"0.60279995",
"0.6... | 0.77960885 | 0 |
GET /proyects/1 GET /proyects/1.json | def show
@proyect = Proyect.find(params[:id])
if request.path != proyect_path(@proyect)
redirect_to @proyect, status: :moved_permanently
end
respond_to do |format|
format.html # show.html.erb
format.json { render json: @proyect }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @proyects = Proyect.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proyects }\n end\n end",
"def index\n @proyects = Proyect.all\n end",
"def index\n @proyects = Proyect.all\n end",
"def new\n @proyect = Proyect.new\n\n ... | [
"0.73611146",
"0.6663637",
"0.6663637",
"0.6534517",
"0.63618493",
"0.63149476",
"0.6242129",
"0.6188299",
"0.61735",
"0.61735",
"0.61735",
"0.6104203",
"0.60935515",
"0.60935515",
"0.6041285",
"0.601096",
"0.5985798",
"0.5980179",
"0.5980179",
"0.5980179",
"0.5980179",
"0.... | 0.70120406 | 1 |
GET /proyects/new GET /proyects/new.json | def new
@proyect = Proyect.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @proyect }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @proyect = Proyect.new(params[:proyect])\n\n respond_to do |format|\n if @proyect.save\n format.html { redirect_to @proyect, notice: 'Proyect was successfully created.' }\n format.json { render json: @proyect, status: :created, location: @proyect }\n else\n format.... | [
"0.7466164",
"0.7262011",
"0.7238999",
"0.7156368",
"0.70366126",
"0.6957235",
"0.6746411",
"0.6721763",
"0.6706273",
"0.6704109",
"0.6702605",
"0.6683912",
"0.66678435",
"0.6638447",
"0.6633319",
"0.66138315",
"0.6580805",
"0.6563233",
"0.654465",
"0.6518509",
"0.6506551",
... | 0.8140024 | 0 |
POST /proyects POST /proyects.json | def create
@proyect = Proyect.new(params[:proyect])
respond_to do |format|
if @proyect.save
format.html { redirect_to @proyect, notice: 'Proyect was successfully created.' }
format.json { render json: @proyect, status: :created, location: @proyect }
else
format.html { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @proyect = Proyect.new(proyect_params)\n\n respond_to do |format|\n if @proyect.save\n format.html { redirect_to @proyect, notice: 'Proyect was successfully created.' }\n format.json { render :show, status: :created, location: @proyect }\n else\n format.html { rend... | [
"0.72590095",
"0.7250042",
"0.6577585",
"0.63143224",
"0.6234206",
"0.6157776",
"0.60874283",
"0.6016209",
"0.59471864",
"0.5845983",
"0.5807508",
"0.5802987",
"0.5788696",
"0.5764918",
"0.5753753",
"0.57405686",
"0.57343996",
"0.56808543",
"0.56808543",
"0.5658861",
"0.56459... | 0.7290619 | 0 |
PUT /proyects/1 PUT /proyects/1.json | def update
@proyect = Proyect.find(params[:id])
respond_to do |format|
if @proyect.update_attributes(params[:proyect])
format.html { redirect_to @proyect, notice: 'Proyect was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @proyect.update(proyect_params)\n format.html { redirect_to @proyect, notice: \"Proyect was successfully updated.\" }\n format.json { render :show, status: :ok, location: @proyect }\n else\n format.html { render :edit, status: :unprocessabl... | [
"0.6962154",
"0.6953425",
"0.6790654",
"0.6652214",
"0.6523471",
"0.651279",
"0.651279",
"0.651279",
"0.65094906",
"0.65094906",
"0.6144002",
"0.6106845",
"0.60277134",
"0.6016815",
"0.59712446",
"0.5963955",
"0.5866931",
"0.5781904",
"0.57679635",
"0.5757025",
"0.5754744",
... | 0.70895255 | 0 |
DELETE /proyects/1 DELETE /proyects/1.json | def destroy
@proyect = Proyect.find(params[:id])
@proyect.destroy
respond_to do |format|
format.html { redirect_to proyects_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @proyect.destroy\n respond_to do |format|\n format.html { redirect_to proyects_url, notice: 'Proyect was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proyect.destroy\n respond_to do |format|\n format.html { redirect_to pr... | [
"0.72686845",
"0.7264194",
"0.72396255",
"0.71675545",
"0.6645459",
"0.6607691",
"0.6602855",
"0.660201",
"0.6598336",
"0.6586635",
"0.6583919",
"0.65653896",
"0.65653896",
"0.65653896",
"0.65653896",
"0.65588766",
"0.6551359",
"0.6540981",
"0.6538447",
"0.6514998",
"0.645750... | 0.76137906 | 0 |
Had to split up the methods due to local variables This is the location method asking the user where they want to go | def location
puts 'A female voice appears from a tiny speaker somewhere in the room'
puts 'Thank you for using this device. Where and when would you like to go'.colorize(:red)
puts 'To make your travelling more efficent please type a single location and time'
puts 'Enter a location:'
location = gets.chomp
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gets_user_input\n puts \"We can help you find haunted hotels near you!\"\n puts \"Enter a location to get started:\"\n location = gets.chomp\nend",
"def show_location\n\n end",
"def get_location\n\n end",
"def location\n\t\t@location\n\tend",
"def location\n # TODO Check this\n # ret... | [
"0.67553455",
"0.6704484",
"0.6598851",
"0.65396327",
"0.6512309",
"0.6477576",
"0.6477576",
"0.6477576",
"0.6475201",
"0.646711",
"0.646711",
"0.646711",
"0.646711",
"0.646711",
"0.646711",
"0.64664716",
"0.64664716",
"0.64664716",
"0.64664716",
"0.64664716",
"0.64664716",
... | 0.6938986 | 0 |
should be a string and it also returned from the method [location] This is the year method which will ask the user what time period they want to go to | def year
puts "Please enter a year:"
year = gets.chomp.to_s
puts "Fantasic! You have answered #{year}".colorize(:light_blue)
year = year.to_i
case year
when 0..500
puts "year 0 to 500AD"
return 1
when 501..1000
puts "year 501AD to 1000AD"
return 2
when 1001..1500
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def year\n puts \"Please enter a year:\"\n print \"> \"\n year = gets.chomp.to_s\n puts \"Fantasic! You have answered #{year}\".colorize(:light_blue)\n year = year.to_i\n case year\n when 0..500\n puts \"year 0 to 500AD\"\n return 1\n when 501..1000\n puts \"year 501AD to 1000AD\"\n ... | [
"0.690748",
"0.68718725",
"0.67685527",
"0.6731369",
"0.67129254",
"0.6697262",
"0.6671931",
"0.6630466",
"0.66069067",
"0.655604",
"0.6531365",
"0.64725304",
"0.6464711",
"0.6463519",
"0.64449334",
"0.64449334",
"0.64394826",
"0.641596",
"0.64065176",
"0.6402475",
"0.6354266... | 0.6930065 | 0 |
If they passed no content block, assume primitive mode | def primitive?
if @primitive.nil?
# Guess, if they passed in no block, they gotta get primitive, or else
# if the attr_json registration looks primitive.
@caller_content_block.nil? || attr_json_registration.type.base_type_primitive?
else
@primitive
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_primitives\n preprocessed + wraps\n end",
"def primitive?\n false\n end",
"def primitive?\n false\n end",
"def i_tunes_block_explicit_content\n return @i_tunes_block_explicit_content\n end",
"def primitive?\n Proc === @body\n end",
... | [
"0.6103914",
"0.58773184",
"0.5873728",
"0.57836646",
"0.57698417",
"0.5462767",
"0.5462767",
"0.5462767",
"0.5462767",
"0.5462767",
"0.5462767",
"0.5431229",
"0.536653",
"0.5357353",
"0.53398967",
"0.52317137",
"0.52219415",
"0.5203798",
"0.5203798",
"0.5189169",
"0.51793885... | 0.6136215 | 0 |
Hidden input is to make sure that if the user in UI deletes _all_ instances of a repeatable block, serverside code still gets something submitted to know to blank it out. For primitive types, that's just making sure there is an array submitted (with an empty string value in it, we rely on the attributes= method to stri... | def placeholder_hidden_input
if primitive?
template.hidden_field_tag "#{form_builder.object_name}[#{attribute_name}_attributes][]", ""
else
template.hidden_field_tag "#{form_builder.object_name}[#{attribute_name}_attributes][_kithe_placeholder][_destroy]", 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _hidden_attributes \n @_hidden_attributes ||= []\n end",
"def clean_attributes\n attributes.delete(:bare_metal)\n attributes.delete(:flavor_id)\n attributes.delete(:ephemeral_storage)\n end",
"def hidden(name = \"\", value = nil)\n attributes = if name.kind_of... | [
"0.6986834",
"0.6418105",
"0.6231761",
"0.5919913",
"0.5876271",
"0.57984656",
"0.5718942",
"0.5706737",
"0.56599206",
"0.5639888",
"0.56247",
"0.5617156",
"0.55894524",
"0.5561709",
"0.5560462",
"0.55355126",
"0.55355054",
"0.55355054",
"0.55039907",
"0.5499543",
"0.54949605... | 0.71062803 | 0 |
The concatenated inputs for any existing values, for either primitive mode or model mode. For primitive mode, the inputs will end up with `name` attributes like `work[attribute_name][]` which will end up in submitted params as an array of strings. For models, it'll be proper nested hashes. In either case, wrapped in pr... | def existing_value_inputs
if primitive?
# We can't use fields_for, and in fact we don't (currently) yield at all,
# we do clever things with arrays.
(base_model.send(attribute_name) || []).collect do |str|
wrap_with_repeatable_ui do
if caller_content_block.nil?
defaul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inputs_for(model, form_builder)\n cols = []\n cols += content_columns(model)\n cols -= SKIPPED_COLUMNS\n cols.compact\n\n res = ''\n cols.each do |col|\n res << form_builder.input(col, placeholder: placeholder_for(model, col, form_builder))\n end\n\n cols = association_columns(mode... | [
"0.6842529",
"0.6184617",
"0.5970118",
"0.5965712",
"0.59462",
"0.5938349",
"0.5811833",
"0.57432556",
"0.571232",
"0.56801146",
"0.56740975",
"0.56145614",
"0.55935985",
"0.5584648",
"0.55657476",
"0.5518211",
"0.55117285",
"0.55052036",
"0.54142267",
"0.5372366",
"0.5372366... | 0.6548118 | 1 |
Either an AttrJson::Model class, or the symbol representing the type of the primitive class, like `:string`. | def repeatable_thing_class
base_type = attr_json_registration.type.base_type
if base_type.is_a?(AttrJson::Model)
base_type
else
# Will return a symbol name, confusingly
base_type.type
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_primitive_type_string(attr_details)\n attr_details[:primitive].to_s.downcase == 'nilclass' ? 'string' : attr_details[:primitive].to_s.downcase\n end",
"def attribute_type\n (float? || integer? || text? || boolean? ? field_type : 'string').to_sym\n end",
"def jsonapi_model_type\n\t\t\t\t\tjs... | [
"0.6657475",
"0.631261",
"0.61924905",
"0.59641784",
"0.5938823",
"0.59241015",
"0.5867407",
"0.5862218",
"0.58348155",
"0.5831976",
"0.5813632",
"0.5747396",
"0.5677763",
"0.56717896",
"0.5664715",
"0.5646911",
"0.5621888",
"0.56196135",
"0.56196135",
"0.56031847",
"0.560318... | 0.66813827 | 0 |
Link to "remove" UI. We have the right classes for cocoon JS to notice, but unlike cocoon we don't need to deal with "_destroy" stuff for AR, our attr_json things have no separate existence beyond what will be submitted with form. | def remove_link
# cocoon JS needs class specifically remove_fields.dynamic, just treat em all
# like dynamic, it seems okay.
template.link_to(I18n.t("kithe.repeatable_input.remove"), '#', class: "remove_fields dynamic btn btn-secondary")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_link f\n icon = image_tag 'subtract.gif', :class => 'icon'\n if f.object.new_record?\n link_to_function(icon, \"$(this).up('.#{f.object.class.name.underscore}').remove()\", :title => \"Remove\")\n else\n f.hidden_field(:_delete) + link_to_function(icon, \"$(this).up('.#{f.object.class... | [
"0.71739167",
"0.7112616",
"0.7048958",
"0.7048958",
"0.69271255",
"0.6756685",
"0.6695337",
"0.6637272",
"0.6634871",
"0.66281605",
"0.6621099",
"0.65687793",
"0.65687793",
"0.65213937",
"0.6520836",
"0.65028477",
"0.6495243",
"0.6397318",
"0.6305418",
"0.62724924",
"0.62713... | 0.7368655 | 0 |
Main processing of argument flags Handles errors in flags and flag values | def parse_args
@args = @args_a.each_slice(2).to_a.inject({}) { |h, k| h[k[0]] = k[1]; h }
keys = @skeys + @lkeys
@args.each do |k, v|
if !keys.include?(k)
puts "Unknown option `#{k}'"
exit
end
if keys.include?(v)
puts "Missing values for `#{k}' and `#{v}'"
exit
end
if v != nil
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_argv!\n args = ARGV.dup\n self.rest = []\n @unknown_argvs = []\n until args.empty? do\n arg = args.shift\n case\n # end of options parsing\n when arg == '--'\n self.rest += args\n break\n # --param=val or --param\n when arg... | [
"0.654483",
"0.6524064",
"0.6455343",
"0.63969064",
"0.63483524",
"0.632517",
"0.62716025",
"0.615805",
"0.6155829",
"0.61381406",
"0.606965",
"0.60689443",
"0.6057577",
"0.60519886",
"0.603805",
"0.6004138",
"0.5988021",
"0.5986685",
"0.5985843",
"0.5976753",
"0.5975885",
... | 0.66315883 | 0 |
Returns the value of a given flag | def get_value(flag)
fp = @flag_pairs.get_value(flag)
if !@no_vals.include?(flag)
if @args.has_key?(flag)
return @args[flag]
elsif @args.has_key?(fp) && fp != nil
return @args[fp]
else
return nil
end
else
return nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flags\n return @val\n end",
"def getFlag\r\n\t\t\t\t\treturn @flag\r\n\t\t\t\tend",
"def [](flag)\n (o = option(flag)) && o.value\n end",
"def feature_flag_for(flag_name)\n opt = get_flag_option(flag_name)\n opt.present? ? opt.value : FeatureFlag.find_by(name: flag_name)&.default_va... | [
"0.7641833",
"0.7522807",
"0.72565913",
"0.6752536",
"0.6721171",
"0.670477",
"0.6697088",
"0.65102863",
"0.6425125",
"0.6336628",
"0.6281935",
"0.6242082",
"0.6203032",
"0.6137593",
"0.6106429",
"0.6101252",
"0.6091424",
"0.60898596",
"0.6014322",
"0.6006136",
"0.5999873",
... | 0.8037572 | 0 |
Called when a HTTPsession destructs (disconnects). Used to stop the Hayabusaappserver when no connections are active to only be running when FCGIsessions are running. | def on_http_session_destruct(*args)
@hayabusa.log_puts("HTTP-connection destruction - checking if no connections are active any more.")
stop = false
httpserv = @hayabusa.httpserv
if !httpserv or !httpserv.http_sessions or httpserv.http_sessions.empty?
stop = true
end
if stop... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kill\n\t\tframework.sessions.deregister(self)\n\tend",
"def kill\n\t\tframework.sessions.deregister(self)\n\tend",
"def shutdown_handler(event)\n super\n\n stop_listener if @server_sig\n end",
"def shutdown\n @server_active = false\n end",
"def server_stop(cf, https = false)\... | [
"0.64552283",
"0.645509",
"0.63748175",
"0.636228",
"0.6349287",
"0.6304773",
"0.62454027",
"0.62233007",
"0.6212682",
"0.620909",
"0.6201821",
"0.6165254",
"0.6109344",
"0.61087793",
"0.61006594",
"0.6095721",
"0.6081508",
"0.605761",
"0.60492516",
"0.60443246",
"0.6018729",... | 0.7835421 | 0 |
Size of memory region allocated for JIT code | def code_region_size
::RubyVM::YJIT.runtime_stats[:code_region_size]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def memsize\n end",
"def _get_allocated_size; GC.stat(:malloc_increase_bytes); end",
"def memsize; RAtlas::memsize(@storage);end",
"def size\n @real_time_memory.size + @user_memory.size\n end",
"def size\n\n clib.tcmaprnum(pointer_or_raise)\n end",
"def size\n (instruction?) ? instructi... | [
"0.7252776",
"0.70046574",
"0.6989843",
"0.69444644",
"0.69414055",
"0.68763083",
"0.67657256",
"0.6694759",
"0.66813385",
"0.6516897",
"0.64758676",
"0.64758676",
"0.64584583",
"0.64584583",
"0.63672876",
"0.62961334",
"0.621455",
"0.62140596",
"0.62016064",
"0.61768585",
"0... | 0.83117205 | 0 |
Total number of object shapes | def object_shape_count
::RubyVM::YJIT.runtime_stats[:object_shape_count]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shape_count\n\t\treturn @shapes.length\n\tend",
"def total_count\n object.nodes.size\n end",
"def count_objects\n ObjectSpace.count_objects\n end",
"def number_of_verts\n\t\t@number_of_verts ||= begin\n\t\t\tsize = 0\n\t\t\t@primitives.each do |primitive|\n\t\t\t\tprimitive[:verts].ea... | [
"0.8234914",
"0.7188983",
"0.71253604",
"0.7118227",
"0.69506776",
"0.69322574",
"0.69250906",
"0.69202083",
"0.6901123",
"0.68657774",
"0.6833736",
"0.6806625",
"0.67975634",
"0.6794311",
"0.6791629",
"0.66555804",
"0.6646006",
"0.6608106",
"0.6590253",
"0.65504533",
"0.6539... | 0.85008895 | 0 |
GET /offsets/1 GET /offsets/1.json | def show
@offset = Offset.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @offset }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_offsets(**options)\n request = Protocol::ListOffsetRequest.new(**options)\n\n @connection.send_request(request)\n end",
"def api_offset(params)\n dataset = self\n\n # Offset results\n if num = params['offset']\n i = num.to_i\n if num =~ /[^\\... | [
"0.6893072",
"0.6142121",
"0.60618097",
"0.5885002",
"0.58456695",
"0.5775167",
"0.5746893",
"0.57465833",
"0.5704239",
"0.5656847",
"0.5652455",
"0.55379033",
"0.5523812",
"0.54983336",
"0.5471855",
"0.5471855",
"0.54625154",
"0.5451577",
"0.5420595",
"0.53757423",
"0.537574... | 0.64488626 | 1 |
GET /offsets/new GET /offsets/new.json | def new
@offset = Offset.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @offset }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @offset_time = OffsetTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offset_time }\n end\n end",
"def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = ... | [
"0.66694313",
"0.61356306",
"0.58479524",
"0.5739042",
"0.5524571",
"0.53659153",
"0.53457874",
"0.5320978",
"0.5231623",
"0.52062654",
"0.5175345",
"0.5174572",
"0.5127502",
"0.51206887",
"0.5094238",
"0.50829107",
"0.5056721",
"0.50195616",
"0.50195616",
"0.5017135",
"0.501... | 0.7189446 | 0 |
POST /offsets POST /offsets.json | def create
uri = URI.parse(Counter::Application.config.simplyurl)
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new('/offsets.json')
puts params
puts params.slice(*['custids','acctids','itemids'])
# ok, this join stuff is bogus - it encodes properly, but the other side only sees t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit_offsets!\n commit_offsets(async: false)\n end",
"def list_offsets(**options)\n request = Protocol::ListOffsetRequest.new(**options)\n\n @connection.send_request(request)\n end",
"def around\n params[:offset] ||= 1\n events = @event.around_events(params[:offset])\n r... | [
"0.6329939",
"0.6196934",
"0.5534183",
"0.54915696",
"0.54248434",
"0.54248434",
"0.5379886",
"0.5277402",
"0.5226118",
"0.52215636",
"0.51501566",
"0.50626713",
"0.50538427",
"0.5051114",
"0.502182",
"0.5021637",
"0.49909836",
"0.49698687",
"0.49181437",
"0.48810273",
"0.487... | 0.6449599 | 0 |
PUT /offsets/1 PUT /offsets/1.json | def update
@offset = Offset.find(params[:id])
respond_to do |format|
if @offset.update_attributes(params[:offset])
format.html { redirect_to @offset, notice: 'Offset was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit_offsets!\n commit_offsets(async: false)\n end",
"def update!(**args)\n @offset = args[:offset] if args.key?(:offset)\n end",
"def replace_with_existing_offsets(offsets, annual_rules); end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @of... | [
"0.63667107",
"0.6005431",
"0.59061074",
"0.5653397",
"0.5653397",
"0.55229586",
"0.54403174",
"0.54403174",
"0.54138786",
"0.53780675",
"0.53780675",
"0.5261511",
"0.5261511",
"0.522969",
"0.5204119",
"0.51608",
"0.51489466",
"0.5148507",
"0.5118462",
"0.51171803",
"0.511264... | 0.6278131 | 1 |
Send an invitation by email as a delayed job | def send_invitation
DelayedJob.enqueue('UserInviter',
Time.now+10.second,
self.id.to_s,
I18n.translate(:you_are_invited_by, :name => self.user.name),
self.message
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_invite\n\t\tMyMailer.new_invite(self).deliver_now\n\t\t#MyMailer.new_invite(self).deliver_later!(wait_until: 5.minutes.from_now)\n\tend",
"def send_invite\n\t\tMyMailer.new_invite(self).deliver_now\n\t\t#MyMailer.new_invite(self).deliver_later!(wait_until: 5.minutes.from_now)\n\tend",
"def perform(ema... | [
"0.75993305",
"0.75993305",
"0.7459578",
"0.719012",
"0.70736563",
"0.70677793",
"0.7016602",
"0.69183785",
"0.68333125",
"0.67885804",
"0.6765798",
"0.6728863",
"0.6691487",
"0.66388905",
"0.6636935",
"0.6601838",
"0.6591735",
"0.6590765",
"0.65604633",
"0.65603405",
"0.6530... | 0.81841123 | 0 |
Erase from the beginning of the line up to and including the current cursor position. | def clear_line_before
CSI + '1K'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def erase_line_to_beginning\n ConsoleGlitter.escape('1K')\n end",
"def clear_line\n CLEAR_LINE\n end",
"def clear_line\n CSI + '2K' + column(1)\n end",
"def erase_line_to_end\n ConsoleGlitter.escape('0K')\n end",
"def clear_line_after\n CSI + '0K'\n end",
"def clea... | [
"0.7668589",
"0.7305615",
"0.70315695",
"0.69853336",
"0.6944676",
"0.6861104",
"0.68335253",
"0.67682683",
"0.6750748",
"0.6727844",
"0.67146724",
"0.6711014",
"0.66791487",
"0.66425884",
"0.66121316",
"0.6608637",
"0.658304",
"0.65424657",
"0.64477587",
"0.6440126",
"0.6431... | 0.7459311 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.