query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Multiplies any two integers together that the user inputs.
def multiply(number_one, number_two) number_one * number_two end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply(a, b)\n\treturn a.to_i * b.to_i\nend", "def multiply_two_numbers( x, y )\n x * y\nend", "def multiply(int1, int2)\n int1 * int2\nend", "def multiply(int1, int2)\r\n int1 * int2\r\nend", "def multiply(a,b)\n a.to_i * b.to_i\nend", "def multiply(first_number, second_number)\n first_number...
[ "0.74555683", "0.74377584", "0.7431135", "0.7411989", "0.7383591", "0.7351849", "0.73339695", "0.73285896", "0.73062354", "0.7274972", "0.72709954", "0.72544163", "0.7251699", "0.7251699", "0.7244787", "0.72156566", "0.7213728", "0.7189992", "0.7152127", "0.7117049", "0.71073...
0.7031506
36
Divides any two integers that the user inputs.
def divide(number_one, number_two) number_one / number_two end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def divide_numbers x, y\n x.fdiv(y)\nend", "def Division\n print \"Ingrese El numero 1: \"\n numero1 = gets.chomp.to_f\n print \"Ingrese El numeor 2: \"\n numero2 = gets.chomp.to_f\n\n if numero2 == 0\n puts \"\\nNo es posible dividir entre 0\"\n else\n puts \"\\nDivision: #{numero1 ...
[ "0.7488782", "0.7452657", "0.74347067", "0.7417389", "0.74109745", "0.735583", "0.7311166", "0.7270216", "0.72184664", "0.72084063", "0.7194135", "0.7173144", "0.70332575", "0.700008", "0.6982546", "0.6971411", "0.6956797", "0.69479716", "0.69479716", "0.69479716", "0.6941194...
0.6882155
25
Writes the assembly code that is the translation of the given arithmetic command PARAMETER command(string) RETURN void
def writeArithmetic(command) assembly_builder = [] # Add if command == 'add' assembly_builder.push( '@SP',# A=0 'AM=M-1',# A=RAM[0]=M[0]-1 'D=M',# D=RAM[257] 'A=A-1',# A=257-1=256 'M=M+D'# RAM[256]=RAM[256]+D ) elsif command == 'sub' assembly_builder.push( '@SP', 'AM=M-1', 'D=M', 'A=A-1', 'M=M-D' ) # y = -y elsif command == 'neg' assembly_builder.push( '@SP', 'A=M-1', 'M=-M', ) # x == y ? -1 : 0 elsif command == 'eq' assembly_builder.push( '@SP', 'AM=M-1', # M = 257 'D=M', # D = 4 'A=A-1', # @256 'D=M-D', # D = 5 - 4 = 1 'M=-1', # M[256] = -1 '@EQEND', # if D == 0 → EQEND 'D;JEQ', # '@SP', 'A=M-1', 'M=0', '(EQEND)' ) # x > y ? -1 : 0 elsif command == 'gt' assembly_builder.push( '@SP', 'AM=M-1', # M = 257 'D=M', # D = 4 'A=A-1', # @256 'D=M-D', # D = 5 - 4 = 1 'M=-1', # M[256] = -1 '@GTEND', # if D == 0 → EQEND 'D;JGT', # '@SP', 'A=M-1', 'M=0', '(GTEND)' ) # x < y ? -1 : 0 elsif command == 'lt' assembly_builder.push( '@SP', 'AM=M-1', # M = 257 'D=M', # D = 4 'A=A-1', # @256 'D=M-D', # D = 5 - 4 = 1 'M=-1', # M[256] = -1 '@LTEND', # if D == 0 → EQEND 'D;JLT', # '@SP', 'A=M-1', 'M=0', '(LTEND)' ) # x & y elsif command == 'and' assembly_builder.push( '@SP', 'AM=M-1', # M = 257 'D=M', # D = 4 'A=A-1', # @256 'M=D&M' ) # x | y elsif command == 'or' assembly_builder.push( '@SP', 'AM=M-1', # M = 257 'D=M', # D = 4 'A=A-1', # @256 'M=D|M' ) # not y elsif command == 'not' assembly_builder.push( '@SP', 'A=M-1', # M = 257 'M=!M' ) end return assembly_builder end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeArithmetic(command)\n\t\tif command == \"add\"\n pop()\n @file.write(\"@SP\\n\")\n @file.write(\"A=M-1\\n\")\n @file.write(\"M=M+D\\n\")\n elsif command == \"sub\"\n pop()\n @file.write(\"@SP\\n\")\n @file.write(\"A=M-1\\n...
[ "0.6683082", "0.64509684", "0.6297073", "0.59178704", "0.5915949", "0.5609868", "0.5574378", "0.5536589", "0.55115277", "0.5479584", "0.546897", "0.54474735", "0.5420301", "0.5385527", "0.53832805", "0.5365469", "0.5320509", "0.5291893", "0.5290042", "0.52880615", "0.5264032"...
0.73196083
0
Writes the assembly code that is the translation of the given command , where command is either C_PUSH or C_POP PARAMETER command(C_PUSH or C_POP), segment(string), index(int) RETURN void
def writePushPop(command, segment, index) assembly_builder = [] # Push if command == 'C_PUSH' if segment == 'constant' assembly_builder.push( "@#{index}", 'D=A', '@SP', 'A=M', 'M=D', '@SP', 'M=M+1' ) elsif segment == 'temp' assembly_builder.push( "@#{5 + index.to_i}", # A = 10 'D=M', # D = M[10] '@SP', # A = 0 'A=M', # A = M[0] = 258 'M=D', # M[258] = D '@SP', # A = 0 'M=M+1' # M[0] = 258 + 1 ) elsif segment == 'pointer' assembly_builder.push( "@#{3 + index.to_i}", # A = 10 'D=M', # D = M[10] '@SP', # A = 0 'A=M', # A = M[0] = 258 'M=D', # M[258] = D '@SP', # A = 0 'M=M+1' # M[0] = 258 + 1 ) elsif segment == 'static' assembly_builder.push( "@#{file_name_without_ext}.#{index}", # A = 10 'D=M', # D = M[10] '@SP', # A = 0 'A=M', # A = M[0] = 258 'M=D', # M[258] = D '@SP', # A = 0 'M=M+1' # M[0] = 258 + 1 ) else segment_symbol = case segment when 'local' 'LCL' when 'argument' 'ARG' when 'this' 'THIS' when 'that' 'THAT' end assembly_builder.push( "@#{index}", 'D=A', "@#{segment_symbol}", # A = THAT = 4 'A=M', 'A=A+D', # A = 3010 + 5 'D=M', # D = M[3015] '@SP', # A = 0 'A=M', # A = M[0] = 257 'M=D', # M[257] = D = M[3015] '@SP', # A = 0 'M=M+1' # M[0] = 257 + 1 ) end # Pop elsif command == 'C_POP' if segment == 'temp' assembly_builder.push( '@SP', # A = 0 'AM=M-1', # A = M[0] - 1, M[0] = M[0] - 1 'D=M', # D = M[257] "@#{5 + index.to_i}", # A = 5 + index 'M=D' ) elsif segment == 'pointer' assembly_builder.push( '@SP', # A = 0 'AM=M-1', # A = M[0] - 1, M[0] = M[0] - 1 'D=M', # D = M[257] "@#{3 + index.to_i}", # A = 5 + index 'M=D' ) elsif segment == 'static' assembly_builder.push( '@SP', # A = 0 'AM=M-1', # A = M[0] - 1, M[0] = M[0] - 1 'D=M', # D = M[257] "@#{file_name_without_ext}.#{index}", # A = 6 + index 'M=D' ) else segment_symbol = case segment when 'local' 'LCL' when 'argument' 'ARG' when 'this' 'THIS' when 'that' 'THAT' end assembly_builder.push( # RAM[RAM[SP]] -> RAM[RAM[segment]] "@#{index}", # A = 3 'D=A', # D = 3 "@#{segment_symbol}", # A = 1 'D=M+D', # D = M[1] + 3 = 300 + 3 'M=D', # M[1] = 303 '@SP', # A = 0 'AM=M-1', # A = M[0] - 1 = 258 -1 'D=M', # D = M[257] "@#{segment_symbol}", # A = 1 'A=M', # A = M[1] = 303 'M=D', # M[303] = M[257] "@#{index}", # A = 3 'D=A', # D = 3 "@#{segment_symbol}", # A = 1 'M=M-D' # M[1] = M[1] - 3 = 303 - 3 ) end end return assembly_builder end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process\n if command_type == :C_COMMAND\n @c = Code.new([comp, dest, jump])\n \"#{@c.translate_c}\\n\"\n else\n @c = Code.new(@current[1..-1])\n \"#{@c.translate_a}\\n\"\n end\n end", "def writePushPop(command,segment,index)\n\n key = command + \" \" + segment\n if @segmen...
[ "0.67036366", "0.6270412", "0.6198958", "0.60747766", "0.6072834", "0.58584106", "0.5668081", "0.5628354", "0.5605948", "0.5588802", "0.55512863", "0.5542404", "0.55178785", "0.5511275", "0.5497258", "0.5452286", "0.5390342", "0.5356419", "0.535463", "0.53124267", "0.5308719"...
0.7189954
0
Closes the output file PARAMETER void RETURN void
def Close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_file\r\n end", "def close(filename); end", "def close()\n @file.close\n end", "def close\n @file.close\n end", "def close\n CoreServices::asl_close_output_file(@context, @dest.to_i) if @dest\n CoreServices::asl_finalize_context(@context)\n @context = nil\n end", "de...
[ "0.7832121", "0.75325537", "0.74706846", "0.7426678", "0.74094415", "0.7264086", "0.72565323", "0.724619", "0.7234656", "0.7212737", "0.7063339", "0.70421314", "0.7026591", "0.7026591", "0.69607055", "0.6918237", "0.69101614", "0.6895036", "0.68911344", "0.68911344", "0.68911...
0.0
-1
TODO: Add 'add' method to add a substring of a String.
def <<(other) if other.respond_to?(:to_int) return self << ('' << other) end @chain << SubString.new(@size, other) @size += other.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def substring(str, substr)\n\nend", "def substrings(string)\r\n \r\nend", "def substrings(string)\n\nend", "def substrings_at_start(string)\n array_of_strings = []\n split_string = string.split('')\n substring = ''\n split_string.each_index do |position|\n substring += split_string[position]\n arr...
[ "0.7156744", "0.71398467", "0.7124913", "0.6411755", "0.63850194", "0.6384808", "0.63287574", "0.63226795", "0.6221136", "0.6129629", "0.6093209", "0.6089252", "0.60675454", "0.6066548", "0.60664225", "0.6064077", "0.60554165", "0.6047874", "0.6043105", "0.602087", "0.6011153...
0.0
-1
State transition tables end reduce 0 omitted
def _reduce_1(val, _values, result) result = val[0] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transitions; end", "def closure! \n cstart = new_state\n cend = new_state\n\n add_transition(cstart, cend, \"\")\n add_transition(cend, cstart, \"\")\n\n add_transition(cstart, @start, \"\")\n @final.keys.each { |key| add_transition(key, cend, \"\")}\n\n set_start(cstart)\n...
[ "0.64042956", "0.6064393", "0.60386634", "0.6007729", "0.5946686", "0.59351325", "0.59351325", "0.5909589", "0.58873314", "0.58676314", "0.58676314", "0.57807076", "0.5779571", "0.5710219", "0.56961817", "0.5655912", "0.55736065", "0.55026084", "0.54936284", "0.5481873", "0.5...
0.0
-1
reduce 32 omitted reduce 33 omitted
def _reduce_34(val, _values, result) result = @builder.logical_op(:and, val[0], val[1], val[2]) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_32(val, _values, result); end", "def _reduce_32(val, _values, result); end", "def _reduce_512(val, _values, result); end", "def _reduce_512(val, _values, result); end", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce...
[ "0.7081952", "0.7081952", "0.70456636", "0.70456636", "0.6919567", "0.68905395", "0.68790436", "0.6871143", "0.6871143", "0.68538505", "0.6841522", "0.6831543", "0.6830546", "0.6827009", "0.68181384", "0.68181384", "0.6812494", "0.6799789", "0.6799789", "0.6793734", "0.678593...
0.0
-1
reduce 38 omitted reduce 39 omitted reduce 40 omitted reduce 41 omitted
def _reduce_42(val, _values, result) result = @builder.keyword_cmd(:return, val[0], nil, val[1], nil) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \...
[ "0.69768417", "0.69421995", "0.6920187", "0.69026196", "0.69007856", "0.68858093", "0.68820137", "0.68820137", "0.68664795", "0.68664795", "0.6864441", "0.68634504", "0.6862654", "0.6862654", "0.686087", "0.68546283", "0.68546283", "0.6846927", "0.6845093", "0.68427217", "0.6...
0.0
-1
reduce 93 omitted reduce 94 omitted reduce 95 omitted reduce 96 omitted reduce 97 omitted
def _reduce_98(val, _values, result) result = @builder.symbol_internal(val[0]) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n ...
[ "0.7076238", "0.70726484", "0.70458", "0.7022318", "0.69966483", "0.69799197", "0.69772357", "0.69772357", "0.6971455", "0.6965433", "0.69625586", "0.6953761", "0.6942905", "0.69428843", "0.69411147", "0.69353664", "0.69353664", "0.692743", "0.6910827", "0.6900043", "0.687040...
0.0
-1
reduce 99 omitted reduce 100 omitted reduce 101 omitted
def _reduce_102(val, _values, result) result = [ val[0] ] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _re...
[ "0.7185758", "0.7144268", "0.7131739", "0.71315444", "0.71315444", "0.7130166", "0.7128689", "0.71236426", "0.71224", "0.71081793", "0.70643544", "0.7057693", "0.70132846", "0.70132846", "0.70128626", "0.70128626", "0.69915897", "0.69914603", "0.69914603", "0.697216", "0.6972...
0.0
-1
reduce 105 omitted reduce 106 omitted reduce 107 omitted reduce 108 omitted reduce 109 omitted reduce 110 omitted reduce 111 omitted reduce 112 omitted reduce 113 omitted reduce 114 omitted reduce 115 omitted reduce 116 omitted reduce 117 omitted reduce 118 omitted reduce 119 omitted reduce 120 omitted reduce 121 omitted reduce 122 omitted reduce 123 omitted reduce 124 omitted reduce 125 omitted reduce 126 omitted reduce 127 omitted reduce 128 omitted reduce 129 omitted reduce 130 omitted reduce 131 omitted reduce 132 omitted reduce 133 omitted reduce 134 omitted reduce 135 omitted reduce 136 omitted reduce 137 omitted reduce 138 omitted reduce 139 omitted reduce 140 omitted reduce 141 omitted reduce 142 omitted reduce 143 omitted reduce 144 omitted reduce 145 omitted reduce 146 omitted reduce 147 omitted reduce 148 omitted reduce 149 omitted reduce 150 omitted reduce 151 omitted reduce 152 omitted reduce 153 omitted reduce 154 omitted reduce 155 omitted reduce 156 omitted reduce 157 omitted reduce 158 omitted reduce 159 omitted reduce 160 omitted reduce 161 omitted reduce 162 omitted reduce 163 omitted reduce 164 omitted reduce 165 omitted reduce 166 omitted reduce 167 omitted reduce 168 omitted reduce 169 omitted reduce 170 omitted
def _reduce_171(val, _values, result) result = @builder.assign(val[0], val[1], val[2]) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_724(val, _values, result)\n yyerrok\n \n resul...
[ "0.66875666", "0.66635364", "0.65839714", "0.6581318", "0.6577947", "0.6573952", "0.65137327", "0.64919853", "0.646608", "0.646608", "0.6465813", "0.64648384", "0.6464662", "0.645838", "0.64508516", "0.64346683", "0.6425549", "0.64075226", "0.64031893", "0.63875574", "0.63875...
0.0
-1
reduce 214 omitted reduce 215 omitted
def _reduce_216(val, _values, result) result = [] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n ...
[ "0.745499", "0.7445086", "0.7434346", "0.74305993", "0.7419498", "0.74124014", "0.74124014", "0.7406467", "0.74024224", "0.74006593", "0.74006593", "0.7399456", "0.73989046", "0.7383564", "0.73473316", "0.73461574", "0.7344167", "0.7342995", "0.73418367", "0.7339777", "0.7329...
0.0
-1
reduce 264 omitted reduce 265 omitted reduce 266 omitted reduce 267 omitted reduce 268 omitted reduce 269 omitted reduce 270 omitted reduce 271 omitted
def _reduce_272(val, _values, result) result = @builder.call_method(nil, nil, val[0]) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, resul...
[ "0.73286724", "0.7215517", "0.72106093", "0.72106093", "0.7192138", "0.7169282", "0.7167932", "0.71558297", "0.7151675", "0.7149889", "0.71381", "0.71381", "0.7121299", "0.71077764", "0.7105575", "0.70913285", "0.7091209", "0.7083746", "0.70664257", "0.70641434", "0.70625556"...
0.0
-1
reduce 322 omitted reduce 323 omitted reduce 324 omitted
def _reduce_325(val, _values, result) result = val[1] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_512(val, _values, result); end", "def _reduce_512(val, _values, result); end", "def _reduce_32(val, _values, result); end", "def _reduce_32(val, _values, result); end", "def _reduce_512(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_496(val, _values, result)\n ...
[ "0.7298738", "0.7298738", "0.71108943", "0.71108943", "0.7094781", "0.7037549", "0.70278347", "0.69799536", "0.69799536", "0.6973357", "0.69192064", "0.68922144", "0.6886068", "0.6873236", "0.68691456", "0.68463314", "0.6842173", "0.6832834", "0.68321365", "0.68321365", "0.68...
0.0
-1
reduce 326 omitted reduce 327 omitted reduce 328 omitted reduce 329 omitted
def _reduce_330(val, _values, result) else_t, else_ = val[4] result = [ val[0], @builder.condition(val[0], val[1], val[2], val[3], else_t, else_, nil), ] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n ...
[ "0.708324", "0.7047274", "0.70444155", "0.6992853", "0.6992853", "0.6923864", "0.6912876", "0.6912876", "0.69066507", "0.6882379", "0.6876222", "0.6834679", "0.68214226", "0.681597", "0.68158495", "0.68158495", "0.67952055", "0.6785401", "0.67789483", "0.67626715", "0.6761833...
0.0
-1
reduce 333 omitted reduce 334 omitted
def _reduce_335(val, _values, result) result = [ @builder.arg_expr(val[0]) ] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n ...
[ "0.75453967", "0.7485832", "0.74738675", "0.7467229", "0.7464228", "0.746281", "0.74530923", "0.7440326", "0.74233043", "0.7416796", "0.7416674", "0.7416674", "0.740446", "0.74044484", "0.7397121", "0.73910797", "0.73834455", "0.73797184", "0.73699766", "0.7363254", "0.735087...
0.0
-1
reduce 337 omitted reduce 338 omitted
def _reduce_339(val, _values, result) result = val[0]. push(@builder.blockarg_expr(val[2], val[3])) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_363(val, _values, result); end", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_496(val, _values, result)\n ...
[ "0.73445296", "0.73445296", "0.7298085", "0.725644", "0.72161674", "0.71827036", "0.7175643", "0.7175643", "0.7167267", "0.716692", "0.7162977", "0.71522", "0.71508366", "0.71362835", "0.7131755", "0.71300244", "0.71300244", "0.71241695", "0.7121963", "0.71207523", "0.7118360...
0.0
-1
reduce 377 omitted reduce 378 omitted
def _reduce_379(val, _values, result) result = [ val[0], val[1] ] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n ...
[ "0.7387706", "0.73733467", "0.7367915", "0.7349766", "0.7331728", "0.7326862", "0.7297008", "0.7293756", "0.7278939", "0.7275278", "0.7275278", "0.7274133", "0.7274133", "0.72619647", "0.72598344", "0.72579694", "0.72558755", "0.7245392", "0.72447026", "0.7238811", "0.723409"...
0.0
-1
reduce 382 omitted reduce 383 omitted reduce 384 omitted reduce 385 omitted
def _reduce_386(val, _values, result) result = @builder.string_compose(nil, val[0], nil) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n ...
[ "0.7317671", "0.73003757", "0.72820497", "0.7247289", "0.7234892", "0.7230869", "0.71958476", "0.71958476", "0.71760094", "0.71636474", "0.7147073", "0.71392006", "0.713243", "0.7128843", "0.7128843", "0.71251804", "0.7116366", "0.7113735", "0.7113735", "0.71099013", "0.71058...
0.0
-1
reduce 458 omitted reduce 459 omitted
def _reduce_460(val, _values, result) @static_env.declare val[1][0] result = [ @builder.restarg(val[0], val[1]) ] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_555(val, _values, result)\n result = nil\n ...
[ "0.73140836", "0.7241976", "0.7208349", "0.7190746", "0.71732765", "0.7164137", "0.71501476", "0.71440053", "0.7135463", "0.7133203", "0.71269894", "0.7124448", "0.7123086", "0.71215135", "0.71127737", "0.71127737", "0.7108824", "0.71026945", "0.71026945", "0.7098696", "0.708...
0.0
-1
reduce 462 omitted reduce 463 omitted
def _reduce_464(val, _values, result) @static_env.declare val[1][0] result = @builder.blockarg(val[0], val[1]) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n ...
[ "0.7505988", "0.7428923", "0.74218297", "0.7421626", "0.7388083", "0.7376065", "0.73724425", "0.73724425", "0.7353877", "0.73303175", "0.732211", "0.732211", "0.73181117", "0.730277", "0.73017347", "0.72995216", "0.72995216", "0.7289194", "0.72807974", "0.72795606", "0.726994...
0.0
-1
reduce 475 omitted reduce 476 omitted reduce 477 omitted reduce 478 omitted reduce 479 omitted reduce 480 omitted reduce 481 omitted reduce 482 omitted reduce 483 omitted reduce 484 omitted reduce 485 omitted reduce 486 omitted reduce 487 omitted reduce 488 omitted reduce 489 omitted reduce 490 omitted reduce 491 omitted reduce 492 omitted reduce 493 omitted
def _reduce_494(val, _values, result) yyerrok result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \...
[ "0.74167854", "0.73850244", "0.7354644", "0.7334862", "0.73247856", "0.73204184", "0.73155296", "0.7294253", "0.72786516", "0.72577024", "0.72577024", "0.72555196", "0.7252882", "0.72350633", "0.7234671", "0.7232565", "0.72266793", "0.72169805", "0.72169805", "0.7212306", "0....
0.0
-1
reduce 495 omitted reduce 496 omitted reduce 497 omitted
def _reduce_498(val, _values, result) result = nil result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_527(val, _values, result)\n result = nil\n \n ...
[ "0.749545", "0.74520427", "0.74520427", "0.7431019", "0.74008954", "0.7396472", "0.73883563", "0.738511", "0.7370563", "0.73573446", "0.73573446", "0.73220867", "0.7316749", "0.73133725", "0.7308586", "0.730313", "0.730313", "0.72983825", "0.7290327", "0.7290001", "0.72892326...
0.7299128
17
Adding new contact in an array
def add_new_contact # Getting information from user puts "Enter your firstname" firstName = gets puts"Enter your Lastname" lastName = gets puts"Enter Email" email = gets puts "Enter notes" notes = gets # Making a contact object contact = Contact.new(firstName, lastName, email, notes) @contacts << contact # Putting newly created object in array. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_contact(contact)\n\t\tcontact.id = @@ids\n\t\t@contacts << contact \n\t\t@@ids += 1\n\t\tcontact\n\tend", "def addContact(fname,lname,email)\n\t\t@dataArray.push(Struct::ContactEntry.new(fname,lname,email))\n\tend", "def create_contact(name, telephone, email)\n\tcontact_list = {\n\t\tname: name,\n\t\t...
[ "0.7606978", "0.73178595", "0.690067", "0.67124504", "0.6464356", "0.64344054", "0.64344054", "0.6364738", "0.6364475", "0.6325117", "0.63154167", "0.6278344", "0.6262329", "0.62103415", "0.6209401", "0.6169682", "0.6153025", "0.6117727", "0.61088103", "0.6104208", "0.6102624...
0.65596074
4
p bsearch([1, 2, 3], 1) => 0 p bsearch([2, 3, 4, 5], 3) => 1 p bsearch([2, 4, 6, 8, 10], 6) => 2 p bsearch([1, 3, 4, 5, 9], 5) => 3 p bsearch([1, 2, 3, 4, 5, 6], 6) => 5 p bsearch([1, 2, 3, 4, 5, 6], 0) => nil
def merged_sort(arr) return arr if arr.length <= 1 left_arr = arr[0...arr.length/2] right_arr = arr[arr.length/2..-1] combine(merged_sort(left_arr), merged_sort(right_arr)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bsearch(array, value)\n return nil if array.empty?\n # return nil if !array.include?(value)\n\n # debugger\n indeces = array.dup.freeze #[1, 2, 3]\n \n middle = (array.length) / 2\n left = array[(0...middle)]\n right = array[(middle..-1)]\n\n # debugger\n if array[middle] == valu...
[ "0.81812066", "0.81799465", "0.8134341", "0.80885816", "0.8026114", "0.80193424", "0.80049294", "0.79533374", "0.794989", "0.7945327", "0.79355997", "0.79161984", "0.7915403", "0.79104483", "0.7908109", "0.7894346", "0.7870683", "0.78651357", "0.7860259", "0.78494185", "0.784...
0.0
-1
p merged_sort([1, 6, 3, 3, 5, 2]) p merged_sort([3, 6, 12, 1, 0, 9, 15, 25, 0, 8, 13, 11, 90, 1564])
def array_subsets(arr) return [[]] if arr.empty? partial_subset = array_subsets(arr[0..-2]) addition = partial_subset.map {|ele| ele + [arr[-1]]} partial_subset + addition end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_sort(&prc)\n end", "def merge_sort(&prc)\n prc || = proc { |num1, num2| num1 <=> num2 }\n return self if length <= 1\n mid = length / 2\n left = self.take(mid).merge_sort(&prc)\n right = self.drop(mid).merge_sort&prc)\n Array.merge(left, right, &prc)\nend", "def merged_sort(arr)\n return ar...
[ "0.7901355", "0.77504057", "0.77203107", "0.7656196", "0.7608429", "0.7590312", "0.753318", "0.75045013", "0.7478862", "0.7466347", "0.74622244", "0.74622244", "0.7453215", "0.7422421", "0.74007636", "0.73996234", "0.73926634", "0.7374733", "0.73224396", "0.73116267", "0.7307...
0.0
-1
p array_subsets([]) p array_subsets([1]) p array_subsets([1,2]) p array_subsets([1,2,3]) p array_subsets([1,2,3,4])
def permutation(array) return array if array.length == 1 smaller = permutation(array[0...-1]) combination_array = [] (smaller.length + 1).times do |index| combination_array += smaller.dup.insert(index, array[-1]) # debugger end combination_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subsets(arr)\n return [arr] if arr.empty?\nsubsets(arr[])\nend", "def subsets(array)\n\nend", "def subsets(array)\n\nend", "def subsets(array)\n\nend", "def array_subsets(array)\n return [array] if array.empty?\n \nend", "def subsets(arr)\r\n comb = [] #set up return array\r\n\r\n for x in 0..arr...
[ "0.84753776", "0.8217911", "0.8217911", "0.8217911", "0.82110196", "0.8095407", "0.7994123", "0.7846153", "0.7780534", "0.7761643", "0.7755116", "0.7736509", "0.7734516", "0.7697075", "0.76968116", "0.75354934", "0.7526128", "0.74741256", "0.747332", "0.74587274", "0.7435874"...
0.0
-1
Is the order 100% ready to be merged?
def ready_for_merge?(order_detail) case order_detail.product when Service order_detail.valid_service_meta? when Instrument order_detail.valid_reservation? else true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_completable?\n force_completion || actual_end_at || reserve_end_at < Time.current\n end", "def complete?\n !pending?\n end", "def complete?()\n if (self.order_in_lines.length == 0)\n return false\n end\n self.order_in_lines.each do | line |\n if (line.qty < line.q...
[ "0.6725433", "0.6615383", "0.6569081", "0.6562348", "0.6552683", "0.65318865", "0.6455695", "0.6444472", "0.6444472", "0.64153403", "0.63636947", "0.63022274", "0.6259894", "0.6247822", "0.6246679", "0.6242941", "0.62382346", "0.62382346", "0.6233442", "0.62197524", "0.620667...
0.70886475
0
show quiz as user
def show @quiz = Quiz.find_by(user_id: current_user) if !@quiz redirect_to quiz_types_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @quiz = Quiz.find(params[:id])\n @user = User.find(params[:user_id])\n end", "def show_user_questions\n\t\tif logged_in?\n\t\t\t@user_questions = @current_user.question\n\t\tend\n\tend", "def show\n if @question.user_id.nil?\n @question_author = 'anonymous'\n else\n @question_...
[ "0.7509028", "0.74126077", "0.714882", "0.6950221", "0.69024473", "0.67744875", "0.675918", "0.67573017", "0.67550015", "0.67458963", "0.67403835", "0.6598986", "0.6564972", "0.6538785", "0.6472537", "0.6462741", "0.6448848", "0.6443549", "0.6442064", "0.642126", "0.64183754"...
0.7248873
2
view any quiz as admin
def view @quiz = Quiz.find(params[:id]) render 'show' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n authorize! :read, @admin_question\n end", "def show\n if current_user.has_role? :admin\n else\n session[:quiz_id] = @quiz.id\n redirect_to quiz_items_url\n end\n end", "def edit \n redirect_to root_path unless current_user.is_admin?\n \t@quiz = Quiz.find(params[:id]) \n...
[ "0.72880316", "0.72719544", "0.7267393", "0.7036107", "0.6971414", "0.6913896", "0.68071365", "0.67505145", "0.6728845", "0.6694874", "0.66897047", "0.6667931", "0.6610755", "0.65898114", "0.65684885", "0.655935", "0.65232867", "0.65132487", "0.6492512", "0.6461967", "0.64456...
0.6178523
51
Creates a new JSONSpectacular::Matcher object.
def initialize(expected) @expected = expected @message = '' @reported_differences = {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eql_json(expected)\n JSONSpectacular::Matcher.new(expected)\n end", "def new_matcher(node)\n # FIXME: Catch exceptions\n matcher = ResponseMatcher.new(node, @domain)\n @matchers[node] = matcher\n end", "def initialize\n @matchers = []\n @matches = {}\n ...
[ "0.689661", "0.68811506", "0.6474461", "0.64732826", "0.5916947", "0.5896641", "0.5668591", "0.560833", "0.55786866", "0.55646175", "0.5492894", "0.5492894", "0.54348624", "0.54348624", "0.53743714", "0.53486145", "0.53438413", "0.53438413", "0.5303306", "0.5276354", "0.52699...
0.0
-1
Declares that RSpec should not attempt to diff the actual and expected values to put in the failure message. This class takes care of diffing and presenting the differences, itself.
def diffable? false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def failure_message\n @message += \"Expected: #{@expected}\\n\\n\"\n @message += \"Actual: #{@actual}\\n\\n\"\n @message += \"Differences\\n\\n\"\n\n add_diff_to_message(@actual, @expected)\n\n @message\n end", "def failure_message_when_negated\n \"expected #{@actual.inspect} not...
[ "0.7619436", "0.7617784", "0.7464784", "0.7421844", "0.7359554", "0.7260809", "0.72444683", "0.72002774", "0.7098776", "0.7098776", "0.7098776", "0.7026485", "0.7026196", "0.6992354", "0.69616383", "0.69616383", "0.6949639", "0.6921867", "0.6887702", "0.6865488", "0.68566406"...
0.0
-1
Whether the actual value and the expected value are considered equal.
def matches?(actual) @actual = actual @expected.eql?(@actual) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matches?(actual)\n expected_value == actual\n end", "def matches?\n @actual == @expected\n end", "def eql(expected)\n set_relativity(:eql, expected)\n end", "def verifyEqual(exp_val,act_val)\n assert_equal(exp_val, act_val,\"Wrong value Expected #{exp_val} Actual #{act_...
[ "0.8196923", "0.79405427", "0.7089745", "0.7003615", "0.7002349", "0.6946374", "0.6906515", "0.6860677", "0.6847903", "0.68109816", "0.6779479", "0.6727026", "0.67059284", "0.6663392", "0.6657142", "0.66064507", "0.65785754", "0.6511842", "0.65073717", "0.6494001", "0.6468460...
0.7592921
2
Message to display to StdOut by RSpec if the equality check fails. Includes a complete serialisation of expected and actual values and is then followed by a description of only the (possibly deeply nested) attributes that are different
def failure_message @message += "Expected: #{@expected}\n\n" @message += "Actual: #{@actual}\n\n" @message += "Differences\n\n" add_diff_to_message(@actual, @expected) @message end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_equals(actual, expected, msg = nil, options = nil)\n if actual != expected\n msg = msg ? msg + ' - ' : ''\n message = \"#{msg}Expected: #{expected.inspect}, instead got: #{actual.inspect}\"\n Test.expect(false, message)\n end\n end", "def assert_not_same(expected, ac...
[ "0.6432467", "0.6316401", "0.62427676", "0.62104106", "0.61899346", "0.61573005", "0.61454767", "0.6130725", "0.6130129", "0.61241424", "0.6124119", "0.6088345", "0.60785687", "0.60714924", "0.6061393", "0.603216", "0.59935045", "0.59505934", "0.5933843", "0.58957833", "0.589...
0.5658647
57
Build a select field tag. If a block is given only build the label an yield the given block. Else, try to build a select for the given attr_name.
def agile_board_select_field(f, attr_name, label, model, required = false) content_tag :div, class: 'autocomplete-combobox' do concat(required ? required_form_label(f, attr_name, label) : f.label(attr_name, label)) if block_given? concat yield else concat f.select "#{attr_name}_id", model.send("#{attr_name}_options"), {include_blank: !required}, {class: "chzn-select#{'-deselect' unless required} cbb-medium search"} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_select(type, select_options_as_html); end", "def build_select(type, select_options_as_html)\n select_options = {\n id: input_id_from_type(type),\n name: input_name_from_type(type)\n }.merge!(@html_options)\n select_options[:disabled] = \"disabled\" if @o...
[ "0.63471705", "0.60647494", "0.56057066", "0.5558431", "0.5557816", "0.5530677", "0.5378787", "0.5273259", "0.52455086", "0.5243248", "0.5215386", "0.5209045", "0.5202424", "0.5189559", "0.51645595", "0.5159746", "0.5155336", "0.5130471", "0.511608", "0.51103425", "0.5072829"...
0.589055
2
this will be replaced by adding the ability to add workflow packages by workflow through the ui
def create_workflow_packages workflow = Workflow.find_by(name: 'Agile Acquisition Workflow', package_name: 'Solicitation') package = WorkflowPackage.create!(name: 'My First Solicitation Package', user: self, workflow: workflow) WorkflowStep.where(workflow: workflow).each do |wfs| WorkflowStepPackage.create!(user: self, workflow_step: wfs, workflow_package: package) unless WorkflowStepPackage.find_by(user: self, workflow_step: wfs, workflow_package: package).present? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def workflow\n end", "def before_package_create(package)\n end", "def before_package_create(package)\n end", "def handle_package_set_add\n if package_set\n order = cart_manager.order(shop: package_set.shop)\n order_maker = OrderMaker.new(identity_solver, order)\n add = or...
[ "0.6381666", "0.57877624", "0.57877624", "0.563234", "0.5619007", "0.561347", "0.561347", "0.55591905", "0.5528315", "0.55161864", "0.5505606", "0.5449082", "0.54382867", "0.54382867", "0.5434265", "0.5431292", "0.542181", "0.5391144", "0.5383205", "0.5375659", "0.5367948", ...
0.674353
0
override to get user roles in response
def token_validation_response self.as_json(include: :roles, except: [ :tokens, :created_at, :updated_at ]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_roles\n @roles = @user.roles.pluck(:name)\n render json: @roles\n end", "def roles\n response[\"roles\"]\n end", "def roles\n roles_from_users\n end", "def roles\n self.dig_for_array(\"roles\")\n end", "def my_roles(user)\n user.roles & self.design_review_results....
[ "0.81225836", "0.78644425", "0.7635204", "0.75992256", "0.7187225", "0.71674234", "0.71674234", "0.7126673", "0.70601684", "0.70553744", "0.70553744", "0.7050875", "0.6988939", "0.68633914", "0.6851109", "0.6844621", "0.68243766", "0.6821807", "0.6794176", "0.6794176", "0.677...
0.0
-1
Functions for loading/writing CSV files
def from_csv path, opts={} daru_options, opts = from_csv_prepare_opts opts # Preprocess headers for detecting and correcting repetition in # case the :headers option is not specified. hsh = if opts[:headers] from_csv_hash_with_headers(path, opts) else from_csv_hash(path, opts) .tap { |hash| daru_options[:order] = hash.keys } end Daru::DataFrame.new(hsh,daru_options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_csv_full\n \n end", "def import_csv_smart\n \n end", "def prepare_data\n data = CSV.read('input.csv', { col_sep: SEPARATOR })\n\n CSV.open('output.csv','wb') do |csv|\n data.each do |row|\n csv << prepare_row(row)\n end\n end\n\n rescue Errno::ENOENT\n puts 'No va...
[ "0.7053912", "0.6891978", "0.6891145", "0.6516779", "0.65161276", "0.64820725", "0.6467526", "0.6447237", "0.6437868", "0.6397502", "0.6358854", "0.6310676", "0.62716174", "0.6270609", "0.6258883", "0.6226451", "0.6222196", "0.62037605", "0.62018824", "0.6200083", "0.61763835...
0.0
-1
Execute a query and create a data frame from the result
def from_sql(db, query) require 'daru/io/sql_data_source' SqlDataSource.make_dataframe(db, query) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(query)\n @query = query\n @conn, @adapter = choose_adapter(@dbh, @query)\n df_hash = result_hash\n Daru::DataFrame.new(df_hash).tap(&:update)\n end", "def execute_query\n the_query = create_query\n\n #to do: start and end offsets\n res...
[ "0.7155133", "0.668187", "0.65245724", "0.64619875", "0.6428561", "0.64222574", "0.6419511", "0.64045465", "0.63543665", "0.63390696", "0.63262814", "0.6315325", "0.6311962", "0.6310839", "0.6299909", "0.62983733", "0.6240305", "0.62366605", "0.6219141", "0.6210278", "0.61859...
0.6906371
1
Load dataframe from AR::Relation
def from_activerecord(relation, *fields) if fields.empty? records = relation.map do |record| record.attributes.symbolize_keys end return Daru::DataFrame.new(records) else fields = fields.map(&:to_sym) end vectors = fields.map { |name| [name, Daru::Vector.new([], name: name)] }.to_h Daru::DataFrame.new(vectors, order: fields).tap do |df| relation.pluck(*fields).each do |record| df.add_row(Array(record)) end df.update end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_activerecord(relation, *fields)\n fields = relation.klass.column_names if fields.empty?\n fields = fields.map(&:to_sym)\n\n result = relation.pluck(*fields).transpose\n Daru::DataFrame.new(result, order: fields).tap(&:update)\n end", "def from_sql(db, query)\n req...
[ "0.6899915", "0.5885378", "0.5885378", "0.5681491", "0.5633544", "0.5607167", "0.5296113", "0.5291698", "0.5078717", "0.5078102", "0.5066383", "0.5064495", "0.50395834", "0.50111485", "0.49696183", "0.4960796", "0.49511477", "0.49497566", "0.48886317", "0.4886219", "0.4866307...
0.6936078
0
Loading data from plain text files
def from_plaintext filename, fields ds = Daru::DataFrame.new({}, order: fields) fp = File.open(filename,'r') fp.each_line do |line| row = Daru::IOHelpers.process_row(line.strip.split(/\s+/),['']) next if row == ["\x1A"] ds.add_row(row) end ds.update fields.each { |f| ds[f].rename f } ds end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_text(filename); end", "def parse_file\n @file ||= File.open(@file_name) unless @file_name.nil?\n @text = @file.readlines\n @file.close unless @file.nil?\n parse_text\n end", "def fromFile( filename ) \n lines = IO.readlines( filename )\n loa...
[ "0.7460712", "0.6832215", "0.6684912", "0.6676647", "0.6633156", "0.66077965", "0.6553301", "0.65314525", "0.65314525", "0.65171176", "0.6473957", "0.6458051", "0.6458051", "0.64159524", "0.6412087", "0.63579327", "0.63023347", "0.62768567", "0.6240431", "0.6225768", "0.61964...
0.60467064
32
Loading and writing Marshalled DataFrame/Vector
def save klass, filename fp = File.open(filename, 'w') Marshal.dump(klass, fp) fp.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def marshal_load(serialised); end", "def marshal_load(x)\n @table = x\n end", "def marshal\n @data\n end", "def marshal_load(array)\n\t\t@lines, @columns, @stack = array\n\t\treturn self\n\tend", "def marshal_dump\n data\n end", "def marshal_dump\n [@@col_map, @@location_column...
[ "0.57836026", "0.5728129", "0.5571151", "0.5559218", "0.55190283", "0.5463519", "0.5440021", "0.53774333", "0.5360353", "0.5355257", "0.5286476", "0.5262109", "0.52498364", "0.52316344", "0.5231279", "0.5231279", "0.5231279", "0.5231279", "0.5231279", "0.5231279", "0.52096295...
0.0
-1
output integer calculated as sum or product from 1 to input number Ask if they want to calculate product or sum If they enter anything other than 's' or 'p', it should loop again to get correct info 1 to number calculate product or sum
def sum_or_product operation = nil num = nil loop do puts "Enter a number greater than 0." num = gets.chomp.to_i break if num >= 1 puts "Invalid entry, must be greater than 0." end loop do puts "Enter 'p' to calculate the product. Enter 's' to calculate the sum." operation = gets.chomp break if ['p', 's'].include?(operation) puts "Incorrect entry." end if operation == 's' result = (1..num).sum else result = 1 1.upto(num) { |i| result *= i } end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_or_product\n multiply = 1\n p \">> Please enter an integer greater than 0:\"\n number = gets.chomp.to_i\n p \">> Enter 's' to compute the sum, 'p' to compute the product.\"\n operation = gets.chomp\n if operation == \"s\"\n\n puts \"The sum of the integers between 1 and #{number} is #{(1..number)....
[ "0.7865483", "0.77955884", "0.71740174", "0.7131533", "0.6667896", "0.6534447", "0.6484899", "0.64848787", "0.6433163", "0.6341425", "0.6324585", "0.624126", "0.6223523", "0.61402065", "0.6130295", "0.61285204", "0.60888565", "0.60591793", "0.60484135", "0.60353094", "0.60255...
0.77624243
2
TODO, TOFIX validate :material_filename_unique
def save_file if self.file then self.file.save end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_filename(_item)\n nil\n end", "def validate_name_is_unique_among_materials\n return if parent.nil?\n\n # conflicts = parent.materials.where.has { |parent| name =~ parent.name }\n conflicts = parent.materials.where(Course::Material.arel_table[:name].matches(name))\n errors.add...
[ "0.66475046", "0.64454967", "0.6224993", "0.61269563", "0.61181873", "0.6076486", "0.60676926", "0.59852904", "0.59082043", "0.5894987", "0.5885921", "0.5846301", "0.5832198", "0.5815858", "0.5813129", "0.5791955", "0.57732606", "0.5768478", "0.5761662", "0.57595706", "0.5759...
0.0
-1
Attaches the given file to this material; if an existing file is linked, the link is broken.
def attach(file) existing_file = self.file file.owner = self file.display_filename = existing_file.display_filename if existing_file if file.save and existing_file then existing_file.owner_type = nil existing_file.owner_id = nil existing_file.save end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attach_file(input, file)\n path = File.expand_path(File.join(SUPPORT_DIR,\"attachments/#{file}\"))\n\n raise RuntimeError, \"file '#{path}' does not exists\" unless File.exists?(path)\n\n input.set(path)\n end", "def link_file(filename, title = T.unsafe(nil), anchor = T.unsafe(nil)); end", "def l...
[ "0.6643031", "0.6198407", "0.6198303", "0.6148004", "0.6042394", "0.60200536", "0.5954688", "0.5954688", "0.5878957", "0.5841446", "0.58389527", "0.5785293", "0.5784163", "0.5738983", "0.56813246", "0.562604", "0.5610538", "0.5571698", "0.55579466", "0.5551819", "0.55406654",...
0.7131582
0
_store_chart_type() Implementation of the abstract method from the specific chart class. Write the Pie chart BIFF record.
def store_chart_type # :nodoc: record = 0x1019 # Record identifier. length = 0x0006 # Number of bytes to follow. angle = 0x0000 # Angle. donut = 0x0000 # Donut hole size. grbit = 0x0002 # Option flags. store_simple(record, length, angle, donut, grbit) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_chart_type # :nodoc:\n end", "def write_chart_type; end", "def write_chart_type(params = {})\n # Write the c:areaChart element.\n write_pie_chart\n end", "def write_chart_type\n # Write the c:barChart element.\n write_line_chart\n end", "def write_chart_ty...
[ "0.7705244", "0.76917017", "0.7567402", "0.7402535", "0.7053944", "0.63243276", "0.6097914", "0.59807354", "0.59499574", "0.5917845", "0.5887035", "0.58339185", "0.5806949", "0.57968646", "0.56917995", "0.56241626", "0.5588128", "0.5586219", "0.5519601", "0.54627264", "0.5443...
0.7689753
2
_store_axisparent_stream(). Overridden. Write the AXISPARENT chart substream. A Pie chart has no X or Y axis so we override this method to remove them.
def store_axisparent_stream # :nodoc: store_axisparent(*@config[:axisparent]) store_begin store_pos(*@config[:axisparent_pos]) store_chartformat_stream store_end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_xml\n builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|\n xml.send('c:chartSpace', :'xmlns:c' => XML_NS_C, :'xmlns:a' => XML_NS_A) {\n xml[:c].date1904 :val => Axlsx::Workbook.date1904\n xml[:c].style :val=>style\n xml[:c].chart {\n @title...
[ "0.5174809", "0.49344313", "0.49333224", "0.48437437", "0.47048783", "0.4627388", "0.46055394", "0.45998502", "0.45729837", "0.45229915", "0.45184213", "0.44338074", "0.4426349", "0.43217492", "0.43202817", "0.4269759", "0.4257218", "0.42558557", "0.42374235", "0.41882733", "...
0.8029582
0
Converts one filetype to the other
def filetype_conversion(options) @transform_tasks.push( add_transform_task('output', options) ) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_type_class\n self.file_type.downcase.split.join('-') + '-file'\n end", "def type t\n @files = @files.select { |file| File.exist?(file) && File.ftype(file) == t}\n self\n end", "def update_content_type\n if file.present? && file_changed?\n self.content_type = file.file.content_type\n...
[ "0.6699641", "0.66246897", "0.6442772", "0.64404196", "0.64225304", "0.64192474", "0.6317206", "0.6238761", "0.6227111", "0.61857367", "0.6141491", "0.6133514", "0.60959435", "0.6025811", "0.5969169", "0.58836544", "0.5876826", "0.5872552", "0.582588", "0.5819007", "0.5809501...
0.614568
10
Converts video or audio based on userprovided parameters
def av_convert(options) if @external_url return 'av_convert does not support external URLs. Please upload file first.' end @transform_tasks.push( add_transform_task('video_convert', options) ) response = UploadUtils.make_call(url, 'post') if response.code == 200 return AV.new(url, apikey: @apikey, security: @security) end JSON.parse(response.body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert(file_info)\n input_name = Shellwords.escape(file_info[:filename])\n input_suffix = File.extname input_name\n output_name = File.basename input_name, input_suffix\n output_suffix = \"mp4\"\n command = [ \"ffmpeg\", \"-y\", \"-i #{input_name}\", \"-max_muxing_queue_size 9999\", \"-map_chapters -1\" ...
[ "0.6938868", "0.6635411", "0.6513551", "0.64837646", "0.6384144", "0.63588923", "0.6340649", "0.6329003", "0.6306368", "0.62831634", "0.6236936", "0.61529404", "0.6118663", "0.6039648", "0.6009672", "0.5977794", "0.5940882", "0.5904802", "0.5895687", "0.58783036", "0.58403414...
0.6819266
1
Add debug parameter to get information on transformation image
def debug @transform_tasks.push( add_transform_task('debug') ) response = UploadUtils.make_call(url, 'get') JSON.parse(response.body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_image_transformation?\n true\n end", "def get_debug_string\n s = \"3D Camera: [ #{@x.round(2)}, #{@y.round(2)}, #{@z.round(2)} ]\\n\"\n s += \" T[ #{@tx.round(2)}, #{@ty.round(2)}, #{@tz.round(2)} ]\\n\"\n s += \"Fov: #{@fov.round(2)} View: #{@near.round(2)} -> #{@far.round(2)}\\n\\t\"\n...
[ "0.6138533", "0.5833899", "0.5806911", "0.5784997", "0.55208325", "0.55208325", "0.55208325", "0.55208325", "0.55108416", "0.5478344", "0.54262155", "0.5347938", "0.5347938", "0.52806526", "0.5216288", "0.5199178", "0.51805854", "0.51802915", "0.5172661", "0.51674354", "0.514...
0.6230256
0
Stores a transformation URL and returns a filelink
def store @transform_tasks.push( add_transform_task('store', {}) ) response = UploadUtils.make_call(url, 'get') response_body = JSON.parse(response.body) handle = response_body['url'].split('/').last FilestackFilelink.new(handle, apikey: @apikey, security: @security) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertUrlToStream(url, out_stream)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"convertUrlToStream::url\", \"pdf-to-text\", \"The supported protocols are http:// and https://.\", \"convert_url_to_stream\"), 470);\n ...
[ "0.5993629", "0.5924104", "0.5902358", "0.5900278", "0.5861543", "0.58524156", "0.58524156", "0.58390164", "0.5832023", "0.58243275", "0.58148485", "0.57751346", "0.5752952", "0.5736592", "0.57275695", "0.57275695", "0.56775725", "0.56716746", "0.564195", "0.5640427", "0.5639...
0.6447807
0
Override default method (best practice when overriding method_missing)
def respond_to_missing?(method_name, *) TransformConfig::TRANSFORMATIONS.include?(method_name.to_s || super) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(meth, *args); end", "def method_missing(method_name, *args); end", "def method_missing(method_name, *args); end", "def method_missing(name, *args, &block); end", "def method_missing(name, *args, &block); end", "def method_missing(name, *args, &block); end", "def method_missing(name, ...
[ "0.8236227", "0.81401527", "0.81401527", "0.81321037", "0.81321037", "0.81321037", "0.81321037", "0.8125404", "0.8125404", "0.8118093", "0.8118093", "0.8118093", "0.80988085", "0.8033045", "0.8026799", "0.80178005", "0.8013305", "0.800588", "0.800588", "0.7926243", "0.7904731...
0.0
-1
Creates a URL based on transformation instance state
def url base = [FilestackConfig::CDN_URL] if @transform_tasks.include? 'debug' @transform_tasks.delete('debug') base.push('debug') end base.push(@apikey) if @apikey && @external_url if @security policy = @security.policy signature = @security.signature security_string = "security=policy:#{policy},signature:#{signature}" base.push(security_string) end base += @transform_tasks base.push(@handle || @external_url) base.join('/') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_url(template); end", "def generate_url\n\t\tself.url ||= name.parameterize\n\tend", "def url_create(state_code, city_name)\n 'http://en.m.wikipedia.org/wiki/' + self.url_suffix_create(state_code, city_name)\n end", "def url\n self.compile\n url = \"#{properties[:endpoint]}/render/?widt...
[ "0.6690815", "0.6297288", "0.61537284", "0.61522096", "0.61232096", "0.61232096", "0.6055554", "0.6047978", "0.60457575", "0.6018218", "0.5964717", "0.59356177", "0.5923602", "0.5918802", "0.59133685", "0.5903214", "0.5898177", "0.58971846", "0.58752286", "0.58705646", "0.587...
0.0
-1
Gets hit by the SendGrid API
def create @correspondence = Correspondence.new_from_sendgrid(params) @correspondence.save render :text => "Saved", :status => 200 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mail(email)\n \n client = SendGrid::Client.new do |c|\n c.api_key = ENV['SENDGRID_API_KEY']\n end\n\n mail = SendGrid::Mail.new do |m|\n # Specify to whom you are sending with the Email object\n m.to = 'shefseth@gmail.com'\n m.from = email.c_email \n ...
[ "0.6953341", "0.6729336", "0.6402483", "0.61519945", "0.5960618", "0.58754337", "0.584071", "0.5828535", "0.5703552", "0.5695776", "0.56949216", "0.5654781", "0.5639799", "0.56355953", "0.56291264", "0.557974", "0.5551625", "0.5528122", "0.54911584", "0.54709023", "0.54628736...
0.5182727
40
Do generic database stuff
def doDB begin # Query the inventory inv = InventoryService.getInv(@@config) yield(inv) rescue Exception => ex error = "Inventory - Error connecting to the Inventory Database - '#{ex}''" raise HTTPStatus::InternalServerError, error end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orm; end", "def select(db); end", "def select(db); end", "def db; end", "def db; end", "def single_object_db; end", "def db(*args); data(1, args); end", "def db(*args)\n adapter = repository(:default).adapter\n args.first =~ /^select /i ? adapter.select(*args) : adapter.execute(*args)\n...
[ "0.70075333", "0.69723696", "0.69723696", "0.69383854", "0.69383854", "0.6653664", "0.6445549", "0.6409405", "0.6234449", "0.6224832", "0.60799253", "0.60697293", "0.60623735", "0.6059936", "0.6025676", "0.59740025", "0.5966069", "0.5921116", "0.5902026", "0.589543", "0.58954...
0.5498449
81
Returns the id of the particular testbed in the OMF inventory.
def getInvTestbedId(testbedName) result = Hash.new doDB { |inv| result = inv.getTestbedId(testbedName) } result['id'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def automation_id\n @attributes[:automation_id]\n end", "def getInvLocationId(name, x, y, z, testbedId)\n\t\t\tresult = Hash.new\n\t\t\t# Fill in the db id of the location of this node added in the db\n doDB { |inv|\n result = inv.getLocationId(name, ...
[ "0.61996126", "0.5984846", "0.5939659", "0.58910453", "0.58338696", "0.582442", "0.5739547", "0.566752", "0.56154394", "0.56071454", "0.5592836", "0.5592836", "0.5592836", "0.5585922", "0.5540718", "0.5528908", "0.55243576", "0.5474642", "0.542393", "0.53706956", "0.5362792",...
0.74814546
0
Returns the id of the particular location in the OMF inventory.
def getInvLocationId(name, x, y, z, testbedId) result = Hash.new # Fill in the db id of the location of this node added in the db doDB { |inv| result = inv.getLocationId(name, x, y, z, testbedId) } result['id'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location_id\n @location.id if @location.present?\n end", "def location\n ln = location_name\n return nil if ln == \"\" || ln == nil\n @engine.item_by_name(location_name)\n end", "def locationId\n if locationMode == Yext::Api::Enumerations::AddRequestLocationMode::NEW\n ...
[ "0.7403202", "0.7144191", "0.6892235", "0.65431225", "0.65259737", "0.64972156", "0.630877", "0.6279246", "0.6273052", "0.6268334", "0.6234642", "0.61621934", "0.61224884", "0.61220646", "0.6047226", "0.604611", "0.6029856", "0.598028", "0.5972476", "0.5957294", "0.59280485",...
0.6812678
3
Add a OMF testbed to the OMF inventory.
def addInvTestbed(testbedName) doDB { |inv| resultTestbed = inv.addTestbed(testbedName) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addItemToVest _obj, _args\n \"_obj addItemToVest _args;\" \n end", "def add_to_inventory(item)\n @inventory.push(item)\n update\n end", "def add_to_inventory(item)\n @items << item\n equip(item)\n items_weight\n end", "def add_ab_test(ab_test, opts = {})\n @transporter.wri...
[ "0.60642403", "0.6011623", "0.5907385", "0.58929735", "0.5730414", "0.5684033", "0.56762743", "0.56364465", "0.5620108", "0.5607303", "0.5595575", "0.55943716", "0.5570289", "0.555624", "0.5454128", "0.54482514", "0.5406886", "0.5404394", "0.54013205", "0.5373504", "0.5365399...
0.68506134
0
Add a OMF location, based on the CONFINE location, to the OMF inventory.
def addInvLocation(name, x, y, z, testbedId) location = makeInventoryLocation(name, x, y, z, testbedId) doDB do |inv| resultLocation = inv.addLocation(location) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(location)\n $LEDGER.add(location)\n end", "def add_location(path, line); end", "def location(value)\n @ole.Location = value\n nil\n end", "def add_location(name, location_type, parent_name=nil, default_item_type_name=nil)\n\t\t\tloc = Location.new\n\t\t\tloc.name = name\n\t\t\tlo...
[ "0.58918136", "0.5636241", "0.5633311", "0.5592083", "0.5559592", "0.552741", "0.55261445", "0.54571044", "0.54205734", "0.5417633", "0.5405386", "0.533996", "0.5336202", "0.5333745", "0.5321343", "0.52979887", "0.529477", "0.52861065", "0.52859235", "0.5215518", "0.52145964"...
0.62831306
0
Add a OMF node, based on the CONFINE sliver, to the OMF inventory.
def addInvNode(control_ip, control_mac, hostname, hrn, locationId) node = makeInventoryNode(control_ip, control_mac, hostname, hrn, locationId) doDB do |inv| resultNode = inv.addNode(node) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_node(node)\n #$DEBUG.puts \"Registering #{SNMPPass.num2oid(node.oid)} with #{node}\"\n @fields[node.oid]=node\n end", "def add_item(item, amount)\n # Check if the Entity already has that item\n # in the inventory. If so, just increase\n # the amount.\n @inventory....
[ "0.56742984", "0.5497115", "0.54929703", "0.5437522", "0.540488", "0.5373448", "0.53644323", "0.5340188", "0.52910554", "0.5290144", "0.526472", "0.51921314", "0.5173282", "0.5172374", "0.5161553", "0.5144879", "0.5093017", "0.5087404", "0.50822896", "0.50523186", "0.50340927...
0.6209716
0
Make up the location based on the CONFINE location of the sliver, for the OMF inventory.
def makeInventoryLocation(name, x, y, z, testbedId) location = Hash.new # Fill in that received from CONFINE Portal location['name'] = name location['x'] = x location['y'] = y location['z'] = z location['testbed_id'] = testbedId # DUMMY location['switch_ip'] = '10.0.0.201' location['switch_port'] = '1' # return location end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location_address\n begin\n \"#{cart.line_items.first.menu_section_item.menu_section.menu.location.\n address}, #{cart.line_items.first.menu_section_item.menu_section.menu.\n location.city}, #{cart.line_items.first.menu_section_item.menu_section.\n menu.location.region}\"\n rescu...
[ "0.58103305", "0.5683924", "0.56237704", "0.5618594", "0.5605452", "0.5591263", "0.5569881", "0.55562127", "0.55368865", "0.5530229", "0.5505586", "0.54201597", "0.53998035", "0.53924996", "0.5384654", "0.53754014", "0.5371212", "0.5369955", "0.53646576", "0.5359624", "0.5338...
0.6131656
0
Make up the node based on the CONFINE sliver, for the OMF inventory.
def makeInventoryNode(control_ip, control_mac, hostname, hrn, locationId) node = Hash.new # Fill in that received from CONFINE Portal node['control_ip'] = control_ip node['control_mac'] = control_mac node['hostname'] = hostname node['hrn'] = hrn node['location_id'] = locationId # DUMMY values. node['inventory_id'] = 1 node['chassis_sn'] = 'BOGUS SN 123' node['motherboard_id'] = 1 node['pxeimage_id'] = 1 node['disk'] = '/dev/sda' # return node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addInvNode(control_ip, control_mac, hostname, hrn, locationId)\n\t\t\tnode = makeInventoryNode(control_ip, control_mac, hostname, hrn, locationId)\n\t\t\tdoDB do |inv|\n\t\t\t\tresultNode = inv.addNode(node)\n\t\t\tend\n\t\tend", "def build_node\n Chef::Log.trace(\"Building node object for #{@node_name}...
[ "0.5573708", "0.5483965", "0.5400582", "0.53877926", "0.5267932", "0.5244332", "0.5167308", "0.5121926", "0.5055073", "0.5019252", "0.50184184", "0.50074005", "0.49931866", "0.49676597", "0.49610743", "0.49585003", "0.49441966", "0.494206", "0.4935568", "0.49232703", "0.49203...
0.68695194
0
asserts that no N+1s were detected during the block's execution
def assert_optimized_queries assert_nothing_raised { Prosopite.scan { yield } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_block_count_correct_false\n assert_equal(false, @bv.block_count_correct?(1, [1,2,3,4]))\n end", "def test_check_block_num_unequal\r\n assert_nil nil, @g.check_block_num(1, 0)\r\n end", "def test_block_count_correct_true\n assert @bv.block_count_correct?(1, [1,2,3,4,5])\n end", "def exact...
[ "0.6883966", "0.6857126", "0.67657816", "0.66795194", "0.623971", "0.61897767", "0.5944627", "0.5937596", "0.59225094", "0.5910601", "0.5860796", "0.5823285", "0.5821592", "0.5774631", "0.5769083", "0.5759987", "0.57579535", "0.57574755", "0.5719553", "0.5703769", "0.5698037"...
0.53826725
50
makes asserting earning simple! just format them like so: REGULAR_HOURS,20.0 DOUBLE_TIME,1.0 MEAL_ALLOWANCE,1.0 OVERTIME,2.0
def assert_earnings(expected, timesheet) actual = timesheet.earnings.group_by(&:code).map do |code, earning| [code, earning.sum(&:units)].join(",") end.join("\n") assert_equal expected, actual end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_earnings\n earnings.format(:no_cents_if_whole => true, :symbol => \"$\") if earnings?\n end", "def unit_formats(type)\n #find statements\n #if sales[0]< 1000 and tot assets[0] < 1000\n #$xxx,xxx.x\n #else\n #$xxx,xxx\n #end\n end", "def describe_price\r\n\t\ta = []\r\n\t\ta...
[ "0.6361034", "0.575668", "0.55459774", "0.5471489", "0.54420567", "0.54201895", "0.5391023", "0.53608847", "0.5344633", "0.5340655", "0.53374463", "0.53180474", "0.52955866", "0.52786577", "0.52186686", "0.52177477", "0.52098286", "0.52029014", "0.51876193", "0.5186689", "0.5...
0.6092925
1
allows safely calling `claimant_who_is_not_the_veteran["participantId|payeeCode"]` is not a way to test whether or not the veteran is the claimant. use `veteran_is_not_the_claimant?` for that
def claimant_who_is_not_the_veteran attributes["claimant"] || {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def participant_id\n case claimant_class_name\n when VeteranClaimant.name\n veteran.participant_id\n when OtherClaimant.name\n \"\"\n when HealthcareProviderClaimant.name\n \"\"\n else\n request_params[:claimant]\n end\n end", "def appellant_is_veteran\n !veteran_is_not_...
[ "0.6592609", "0.6357738", "0.60706544", "0.5881208", "0.5734849", "0.55024", "0.54333806", "0.54032403", "0.53919834", "0.5328937", "0.52663773", "0.52610284", "0.5257675", "0.5257263", "0.5257263", "0.5257221", "0.523365", "0.52276844", "0.5226714", "0.5207491", "0.5205826",...
0.70240396
1
array of allowed types (values) for params paths rubocop:disable Metrics/MethodLength
def types_and_paths [ [OBJECT, ["data"]], [["HigherLevelReview"], %w[data type]], [OBJECT, %w[data attributes]], [[String, nil], %w[data attributes receiptDate]], [BOOL, %w[data attributes informalConference]], [[Array, nil], %w[data attributes informalConferenceTimes]], [[String, nil], ["data", "attributes", "informalConferenceTimes", 0]], [[String, nil], ["data", "attributes", "informalConferenceTimes", 1]], [[nil], ["data", "attributes", "informalConferenceTimes", 2]], [[*OBJECT, nil], %w[data attributes informalConferenceRep]], *( if informal_conference_rep? # ... name and phoneNumber must be present [ [[String], %w[data attributes informalConferenceRep name]], [[String, Integer], %w[data attributes informalConferenceRep phoneNumber]] ] else [] end ), [[String, Integer, nil], %w[data attributes informalConferenceRep phoneNumberCountryCode]], [[String, Integer, nil], %w[data attributes informalConferenceRep phoneNumberExt]], [BOOL, %w[data attributes sameOffice]], [BOOL, %w[data attributes legacyOptInApproved]], [[String], %w[data attributes benefitType]], [OBJECT, %w[data attributes veteran]], [[String], %w[data attributes veteran ssn]], [[*OBJECT, nil], %w[data attributes claimant]], *( if claimant_object_present? # ... participantId and payeeCode must be present [ [[String], %w[data attributes claimant participantId]], [[String], %w[data attributes claimant payeeCode]] ] else [] end ), [[String, nil], %w[data attributes claimant addressLine1]], [[String, nil], %w[data attributes claimant addressLine2]], [[String, nil], %w[data attributes claimant city]], [[String, nil], %w[data attributes claimant stateProvinceCode]], [[String, nil], %w[data attributes claimant countryCode]], [[String, nil], %w[data attributes claimant zipPostalCode]], [[String, nil], %w[data attributes claimant phoneNumber]], [[String, nil], %w[data attributes claimant phoneNumberCountryCode]], [[String, nil], %w[data attributes claimant phoneNumberExt]], [[String, nil], %w[data attributes claimant emailAddress]], [[Array], ["included"]], # [OBJECT, ["included", 0]], # [["ContestableIssue"], ["included", 0, "type"]], # [[Integer, nil], ["included", 0, "attributes", "decisionIssueId"]], # [[String, nil], ["included", 0, "attributes", "ratingIssueId"]], # [[String, nil], ["included", 0, "attributes", "ratingDecisionIssueId"]], # [[Array, nil], ["included", 0, "attributes", "legacyAppealIssues"]] # [OBJECT, ["included", 1]], # [["ContestableIssue"], ["included", 1, "type"]], # [[Integer, nil], ["included", 1, "attributes", "decisionIssueId"]], # [[String, nil], ["included", 1, "attributes", "ratingIssueId"]], # [[String, nil], ["included", 1, "attributes", "ratingDecisionIssueId"]], # [[Array, nil], ["included", 1, "attributes", "legacyAppealIssues"]] # ... *for_array_at_path_enumerate_types_and_paths( # ^^^ array_path: ["included"], types_and_paths: [ [OBJECT, []], [["ContestableIssue"], ["type"]], [[String, Integer, nil], %w[attributes decisionIssueId]], [[String, Integer, nil], %w[attributes ratingIssueId]], [[String, Integer, nil], %w[attributes ratingDecisionIssueId]] ] ) ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def params() @param_types end", "def validate_paths(paths)\n paths = [paths] unless paths.is_a?(Array)\n raise 'The provided paths must all be Strings' \\\n ...
[ "0.682767", "0.6291914", "0.60052997", "0.5931734", "0.59296006", "0.5841406", "0.5835509", "0.58345854", "0.5827929", "0.58013344", "0.57973975", "0.57920426", "0.57650745", "0.5764036", "0.5717994", "0.5710983", "0.57043856", "0.5704126", "0.5704126", "0.5704126", "0.570412...
0.0
-1
rubocop:enable Metrics/MethodLength given the path to an array, prepends the path of each element of that array to types_and_paths given: array_path: [:class, :students], types_and_paths: [ [ [Hash], [] ], [ [String], [:first_name] ], [ [String], [:last_name] ], [ [Float], [:grade] ], ] returns: [ [ [Hash], [:class, :students, 0] ], [ [String], [:class, :students, 0, :first_name] ], [ [String], [:class, :students, 0, :last_name] ], [ [Float], [:class, :students, 0, :grade] ], [ [Hash], [:class, :students, 1] ], [ [String], [:class, :students, 1, :first_name] ], [ [String], [:class, :students, 1, :last_name] ], [ [Float], [:class, :students, 1, :grade] ], [ [Hash], [:class, :students, 2] ], [ [String], [:class, :students, 2, :first_name] ], [ [String], [:class, :students, 2, :last_name] ], [ [Float], [:class, :students, 2, :grade] ], ... ]
def for_array_at_path_enumerate_types_and_paths(array_path:, types_and_paths:) array = @params.dig(*array_path) array.each.with_index.reduce([]) do |acc, (_, index)| [ *acc, *self.class.prepend_path_to_paths( prepend_path: [*array_path, index], types_and_paths: types_and_paths ) ] end rescue StandardError [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def types_and_paths\n [\n [OBJECT, [\"data\"]],\n [[\"HigherLevelReview\"], %w[data type]],\n [OBJECT, %w[data attributes]],\n [[String, nil], %w[data attributes receiptDate]],\n [BOOL, %w[data attributes informalConference]],\n [[Array, nil], %w[data attribute...
[ "0.56976634", "0.5675323", "0.5508577", "0.52846366", "0.5265201", "0.51762027", "0.5119185", "0.5113895", "0.5100205", "0.5023137", "0.50219154", "0.50132513", "0.4990891", "0.49866837", "0.49828255", "0.49808463", "0.49582413", "0.49100077", "0.48523682", "0.48475063", "0.4...
0.72319835
0
curl v H "Accept: application/vnd.healthy_lunch" H "Contenttype: application/application/xwwwformurlencoded" H "Authorization:authentication_token"
def lunch @menu = Menu.current_lunch if @menu render json: @menu.show_lunch else if [6,7].include? Date.today.wday notice = ENV['NOT_SERVING_WEEKEND'] else notice = ENV['NOT_SERVING_WEEKDAY'] end render json: {notice: notice} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_curl\n `curl -X \"POST\" -H \"Authorization: Basic #{_encode}\" -d grant_type=client_credentials https://accounts.spotify.com/api/token`\n end", "def curl(url,params)\n uri = URI.parse(url)\n https = Net::HTTP.new(uri.host,uri.port)\n https.use_ssl = true\n base64h = Base64.strict_encode64(\"#{A...
[ "0.6755993", "0.6453583", "0.6035082", "0.58551824", "0.5843421", "0.58262885", "0.5818238", "0.57883954", "0.5740022", "0.56689763", "0.5601905", "0.5584902", "0.557723", "0.5566509", "0.55436176", "0.55436176", "0.5534908", "0.55328643", "0.55216277", "0.5516322", "0.551600...
0.0
-1
Adds specified username/password combination to current software instance
def add_user_password(username, password, options = {}) raise ArgumentError, "The new password cannot be nil" unless password raise ArgumentError, "The new username cannot be nil" unless username raise ArgumentError, "The new password cannot be empty" if password.empty? raise ArgumentError, "The new username cannot be empty" if username.empty? raise Exception, "Cannot add username password, a Software Password already exists for the provided username" if self.has_user_password?(username.to_s) add_user_pw_template = { 'softwareId' => self['id'].to_i, 'password' => password.to_s, 'username' => username.to_s } add_user_pw_template['notes'] = options['notes'].to_s if options.has_key?('notes') add_user_pw_template['port'] = options['port'].to_i if options.has_key?('port') softlayer_client[:Software_Component_Password].createObject(add_user_pw_template) @passwords = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_credential(db, username, password)\n @credentials ||= {}\n @credentials[db] = [ username, password ]\n apply_credentials\n end", "def add_password(password)\n @password = password\n end", "def register\n raw \"PASS #{@config[:password]}\" if @config.key? :password\n raw ...
[ "0.6591192", "0.65554434", "0.6377139", "0.6330864", "0.6289763", "0.6219732", "0.6216527", "0.6076121", "0.6065316", "0.6057965", "0.60131294", "0.6007186", "0.5989015", "0.59452933", "0.59267646", "0.591619", "0.58920234", "0.58640766", "0.5862162", "0.5855735", "0.5852864"...
0.66988856
0
Deletes specified username password from current software instance This is a final action and cannot be undone. the transaction will proceed immediately. Call it with extreme care!
def delete_user_password!(username) user_password = self.passwords.select { |sw_pw| sw_pw.username == username.to_s } unless user_password.empty? softlayer_client[:Software_Component_Password].object_with_id(user_password.first['id']).deleteObject @passwords = nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_with_password(current_password); end", "def delete_user(username)\n\t\t\t\t@session['datastore'][username] = nil\n\t\t\tend", "def delete_user(username)\n file_buffer = ''\n File.open(FTPUSERS_PATH, 'r') do |password_file|\n file_buffer = password_file.read\n end\n\n file...
[ "0.7447966", "0.6738042", "0.66543317", "0.6545343", "0.65413666", "0.65098435", "0.6502362", "0.64505446", "0.6305423", "0.629811", "0.6285516", "0.6275266", "0.6230837", "0.61516327", "0.61307436", "0.61194587", "0.61050826", "0.6102537", "0.6098176", "0.60909337", "0.60887...
0.7768837
0
Returns whether or not one of the Software Password instances pertains to the specified user
def has_user_password?(username) self.passwords.map { |sw_pw| sw_pw.username }.include?(username) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def passwords_match?\n context.user.password == context.password\n end", "def is_potential_user?\n\t\ttrue\n\tend", "def passwordy?\n # puts \"*****************----------------> Handling user as PASSWORDY.\"\n !self.has_oauth?\n end", "def user_check(resource)\n return true unless self[:name] =...
[ "0.65706915", "0.64844984", "0.648344", "0.64729273", "0.64175785", "0.64132977", "0.64103395", "0.6385126", "0.633983", "0.6309101", "0.62633795", "0.6263048", "0.6263048", "0.6263048", "0.62436193", "0.6154879", "0.6151323", "0.6120912", "0.61185443", "0.6087042", "0.608704...
0.69828796
0
Returns the service for interacting with this software component through the network API
def service softlayer_client[:Software_Component].object_with_id(self.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service\n @service\n end", "def service\n return @service\n end", "def service\n @service ||= fetcher.get(Service, service_id)\n end", "def service\n return softlayer_client[\"Virtual_Guest\"].object_with_id(self.id)\n end", "def service\n return s...
[ "0.70281386", "0.6914861", "0.6905515", "0.6841882", "0.6789678", "0.6738794", "0.6629946", "0.66140217", "0.6570975", "0.654383", "0.64628863", "0.63794637", "0.62201667", "0.61986864", "0.6152247", "0.6111111", "0.60840917", "0.60794586", "0.6012397", "0.5986052", "0.598496...
0.7643177
0
Make an API request to SoftLayer and return the latest properties hash for this object.
def softlayer_properties(object_mask = nil) my_service = self.service if(object_mask) my_service = my_service.object_mask(object_mask) else my_service = my_service.object_mask(self.class.default_object_mask) end my_service.getObject() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get\n\t\t\t@hash\n\t\tend", "def hash\n @hash ||= @client.get_hash(path)\n @hash\n end", "def hash\n @hash ||= @client.get_hash(path)\n @hash\n end", "def hash\n [id, type, name, is_active, external_url, external_authorization_type, external_user_name, external_password, ex...
[ "0.63635004", "0.613282", "0.613282", "0.595216", "0.5857636", "0.58122736", "0.57377756", "0.5706588", "0.56365913", "0.56166387", "0.5572106", "0.55394036", "0.5508698", "0.5488298", "0.5473986", "0.5457117", "0.54497766", "0.54428065", "0.544006", "0.5431518", "0.54171795"...
0.0
-1
GET /crew/category_partners GET /crew/category_partners.json
def index @crew_category_partners = CategoryPartner.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_part_by_category\n @categorys = PartsController::PartService.get_part_by_category(params[:param]);\n respond_to do |format|\n format.json { render json: @categorys }\n end \n end", "def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.html.erb\n ...
[ "0.68312067", "0.6397773", "0.62918174", "0.60981846", "0.6052716", "0.6021558", "0.5998123", "0.5985139", "0.5850687", "0.58014077", "0.56765246", "0.56660914", "0.5639221", "0.56014854", "0.55738676", "0.5567411", "0.5550006", "0.55343676", "0.5525544", "0.5488449", "0.5476...
0.7164783
0
GET /crew/category_partners/1 GET /crew/category_partners/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @crew_category_partners = CategoryPartner.all\n end", "def get_part_by_category\n @categorys = PartsController::PartService.get_part_by_category(params[:param]);\n respond_to do |format|\n format.json { render json: @categorys }\n end \n end", "def index\n @partners = Partner...
[ "0.7090048", "0.7060123", "0.6320533", "0.63172936", "0.6265342", "0.61632055", "0.61555827", "0.58971167", "0.58834684", "0.5874837", "0.5814553", "0.57189274", "0.5714947", "0.5676219", "0.56536263", "0.56192786", "0.5592234", "0.55876344", "0.5587398", "0.5583941", "0.5582...
0.0
-1
POST /crew/category_partners POST /crew/category_partners.json
def create @crew_category_partner = CategoryPartner.new(crew_category_partner_params) respond_to do |format| if @crew_category_partner.save format.html { redirect_to crew_category_partners_path, notice: 'Category partner was successfully created.' } format.json { render :show, status: :created, location: @crew_category_partner } else format.html { render :new } format.json { render json: @crew_category_partner.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crew_category_partner_params\n params.require(:category_partner).permit(:name)\n end", "def index\n @crew_category_partners = CategoryPartner.all\n end", "def create\n @practice = Practice.new(practice_params)\n if params[:recruiter_partner].present?\n @partner = Partner.find(params[...
[ "0.64640003", "0.6269952", "0.6052953", "0.60497016", "0.5964296", "0.5837719", "0.58303094", "0.5791857", "0.5791857", "0.57849234", "0.5783859", "0.5773217", "0.5721865", "0.5719794", "0.567816", "0.56750023", "0.56669843", "0.5649162", "0.5581409", "0.5579151", "0.556906",...
0.70171136
0
PATCH/PUT /crew/category_partners/1 PATCH/PUT /crew/category_partners/1.json
def update respond_to do |format| if @crew_category_partner.update(crew_category_partner_params) format.html { redirect_to @crew_category_partner, notice: 'Category partner was successfully updated.' } format.json { render :show, status: :ok, location: @crew_category_partner } else format.html { render :edit } format.json { render json: @crew_category_partner.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n json_update(category,category_params, Category)\n end", "def update\n respond_to do |format|\n # TODO: Make this more efficient, this is a little hacky\n if params[:category_ids]\n PartnerCategory.where(partnering_organization_id: @partnering_organization.id).delete_all\n ...
[ "0.68012464", "0.65082127", "0.6375713", "0.6292651", "0.61903816", "0.6137904", "0.6137127", "0.6120709", "0.61085415", "0.6091655", "0.6066401", "0.6055703", "0.6040047", "0.6005197", "0.6001784", "0.5997817", "0.59958637", "0.59955984", "0.5989613", "0.59893596", "0.596252...
0.68432015
0
DELETE /crew/category_partners/1 DELETE /crew/category_partners/1.json
def destroy @crew_category_partner.destroy respond_to do |format| format.html { redirect_to crew_category_partners_url, notice: 'Category partner was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n # @retailer_category = RetailerCategory.find(params[:id])\n @retailer_category.destroy\n respond_to do |format|\n format.html { redirect_to retailer_categories_url }\n format.j...
[ "0.6806315", "0.6795338", "0.67820114", "0.67805576", "0.6740692", "0.6726948", "0.6722321", "0.665271", "0.66501826", "0.66387033", "0.6634389", "0.6634389", "0.66263354", "0.66174185", "0.6615655", "0.6599572", "0.6585356", "0.6557574", "0.6548899", "0.6545354", "0.6537073"...
0.7066283
0
Use callbacks to share common setup or constraints between actions.
def set_crew_category_partner @crew_category_partner = CategoryPartner.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def crew_category_partner_params params.require(:category_partner).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
A hash of label to value for all the properties we want to display
def resource_properties { 'Path' => @resource.path, 'Output Path' => File.join(@resource.app.build_dir, @resource.destination_path), 'Url' => content_tag(:a, @resource.url, :href => @resource.url), #'Metadata' => @resource.metadata, 'Source' => @resource.source_file } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def values_for_properties; end", "def hash\n @label.hash\n end", "def formatted_attributes\n Hash[display_key.downcase.to_sym, values.collect { |el| el[:displayValue] }]\n end", "def property_label_text(property)\n case property.to_sym\n when :image_default then t(:image_url)\n when :web...
[ "0.7063521", "0.673239", "0.67084926", "0.6521323", "0.63689876", "0.6330536", "0.63224155", "0.63149774", "0.63108414", "0.62955683", "0.6270023", "0.6207364", "0.6207364", "0.6207364", "0.6207364", "0.6207364", "0.6207364", "0.6070271", "0.6053446", "0.604648", "0.60286576"...
0.0
-1
some very, very simple testing utilities
def colorize(text, color_code); "\e[#{color_code}m#{text}\e[0m"; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tests; end", "def tests; end", "def testing\n # ...\n end", "def my_tests\n end", "def test \n end", "def test_basic\n testbase = 'help'\n op = StringIO.new('', 'w')\n Dir.chdir(SRC_DIR) do \n script = File.join('data', \"#{testbase}.cmd\")\n Debugger.const_set('Versi...
[ "0.7621492", "0.7621492", "0.74522614", "0.7120814", "0.68665767", "0.68299735", "0.6815783", "0.68124396", "0.67885554", "0.67736477", "0.67736477", "0.67736477", "0.6753268", "0.6730533", "0.6730533", "0.665581", "0.6653117", "0.6633084", "0.6626436", "0.6618002", "0.661659...
0.0
-1
This is the same test but sampling with a different set of arrays that more closely resemble the data from the products table.
def test_integrate_calculation_methods_2b x = [["Router", "3", "Scan", "SLA1", "3", "99.99"], ["PC", "4", "Alert", "SLA2", "6", "199.99"]] assert_equal(1180.77, StubIntegration.new.integrate_calculation_methods_2(x)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_products\n i = 0\n while(i < @sample_size)\n product = possible_products[next_rand]\n @products[product.id] = product\n i += 1\n end\n @products = @products.values\n end", "def mk_products\n # create some test products\n @first_product = Product.create!(:name => \...
[ "0.6489358", "0.6267017", "0.6182372", "0.61586934", "0.6105622", "0.6020658", "0.58149725", "0.5778381", "0.57311255", "0.57225126", "0.5720943", "0.57160264", "0.57153857", "0.569251", "0.5650448", "0.56434536", "0.56396466", "0.56035376", "0.5601785", "0.55267507", "0.5525...
0.0
-1
Returns a Tempfile. Up to caller to close/unlink tempfile when done with it.
def create comment_file = tmp_comment_file! tmp_zipfile = tmp_zipfile! derivative_files = [] Zip::File.open(tmp_zipfile.path, Zip::File::CREATE) do |zipfile| # Add attribution as file and zip comment text zipfile.comment = comment_text zipfile.add("about.txt", comment_file) members_to_include.each_with_index do |member, index| filename = "#{format '%03d', index+1}-#{DownloadFilenameHelper.filename_base_from_parent(member)}.jpg" uploaded_file = file_to_include(member.leaf_representative) # While it would be nice to stream directly from remote storage into the zip, we couldn't # get this to work with the combo of ruby-zip and shrine api's without downloading it # to local disk first. There may be a way we haven't figured out. May be able # to pass derivative.file.open to it instead for slightly better perf # once https://github.com/janko/down/issues/26 file_obj = uploaded_file.download derivative_files << file_obj # We want to add to zip as "STORED", not "DEFLATE", since our JPGs # won't compress under DEFLATE anyway, save the CPU. Ruby zip does not # give us a GREAT api to do that, but it gives us a way. # # https://github.com/rubyzip/rubyzip/blob/05af1231f49f2637b577accea2b6b732b7204bbb/lib/zip/file.rb#L271 # https://github.com/rubyzip/rubyzip/blob/05af1231f49f2637b577accea2b6b732b7204bbb/lib/zip/entry.rb#L53 entry = ::Zip::Entry.new(zipfile.name, filename, nil, nil, nil, nil, ::Zip::Entry::STORED) zipfile.add(entry, file_obj) # We don't really need to update on every page, the front-end is only polling every two seconds anyway if callback && (index % 3 == 0 || index >= members_to_include.count - 1) callback.call(progress_total: members_to_include.count, progress_i: index + 1) end end end # tell the Tempfile to (re)open so it has a file handle open that can see what ruby-zip wrote tmp_zipfile.open return tmp_zipfile ensure (derivative_files || []).each do |tmp_file| tmp_file.close tmp_file.unlink end if comment_file comment_file.close comment_file.unlink end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tempfile\n io = Tempfile.new(@basename, @tmpdir, @open_options)\n io.unlink\n io\n end", "def tempfile\n unless @tempfile\n @tempfile = Tempfile.new(binmode: true)\n @tempfile.write(@read || read_from(closest))\n @tempfile.open\n end\n ...
[ "0.8147029", "0.80323064", "0.7826578", "0.76249504", "0.75759447", "0.7504523", "0.74470645", "0.73152196", "0.7309935", "0.7263598", "0.71887934", "0.71417385", "0.70666546", "0.703381", "0.70140636", "0.69620425", "0.68869805", "0.68850535", "0.68810004", "0.68633974", "0....
0.0
-1
published members. preloads leaf_representative derivatives. Limited to members whose leaf representative has a download_full derivative Members will have derivatives preloaded.
def members_to_include @members_to_include ||= work. members. includes(:leaf_representative). where(published: true). order(:position). select do |m| m.leaf_representative.content_type == "image/jpeg" || m.leaf_representative&.file_derivatives(:download_full) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_members\n @all_members ||= begin\n members = work.members.includes(:leaf_representative)\n\n unless can_see_unpublished_records?\n members = members.where(published: true)\n end\n\n members = members.strict_loading # prevent accidental n+1 lazy-loading.\n members.order(:p...
[ "0.60017693", "0.56515074", "0.51981527", "0.5187353", "0.5185061", "0.51598805", "0.5136127", "0.50696236", "0.49961883", "0.495845", "0.4948948", "0.49079594", "0.49011508", "0.48758703", "0.4830166", "0.4822564", "0.4743451", "0.47218892", "0.47218892", "0.47218892", "0.47...
0.64027566
0
name | scenario | passed | failed | pending | result | | | | |
def scenarios @@scenarios ||= ( ss = [] feature = feature_build(feature_a) examples = run_feature(feature, '/path/to/test1.feature') ss << TurnipFormatter::Resource::Scenario::Pass.new(examples[0]) ss << TurnipFormatter::Resource::Scenario::Failure.new(examples[1]) feature = feature_build(feature_b) examples = run_feature(feature, '/path/to/test2.feature') ss << TurnipFormatter::Resource::Scenario::Pending.new(examples[0]) feature = feature_build(feature_c) examples = run_feature(feature, '/path/to/test3.feature') ss << TurnipFormatter::Resource::Scenario::Pass.new(examples[0]) ss << TurnipFormatter::Resource::Scenario::Pass.new(examples[1]) ss ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status\n if (!plan_results || plan_results == [])\n return 'no_tests'\n end\n if (plan_results['state'] == \"Successful\")\n return 'pass'\n end\n if (plan_results['state'] != \"Successful\")\n return 'fail'\n end\n return 'no_tests'\n end", "def step_result; end", "def...
[ "0.64807844", "0.643095", "0.6429154", "0.6415654", "0.6376603", "0.6359231", "0.63587785", "0.629693", "0.6261748", "0.6260855", "0.62587965", "0.62587965", "0.6207284", "0.61709565", "0.6134171", "0.61297894", "0.61281896", "0.61148816", "0.61148816", "0.61148816", "0.61096...
0.601309
24
add workflow triggered methods that run when corresponding event is triggered as necessary
def new_allocation allocate! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_custom_method\n # da implementare per eventuali estensioni\n end", "def workflow\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute]...
[ "0.6767924", "0.6590258", "0.6306053", "0.6273421", "0.6253403", "0.6125355", "0.61116534", "0.61116534", "0.61116534", "0.61116534", "0.61116534", "0.61116534", "0.61116534", "0.61116534", "0.60709643", "0.6016223", "0.596318", "0.5944855", "0.5931129", "0.5931129", "0.59297...
0.0
-1
These methods need an id parameter. Ruby Kernel__callee__ gets the method name being called. verb = :aget ver[1..1] => "get" aget(id, merge_params(id, params))
def amethod_with_id(id, params={}, &payload) verb = send(:__callee__)[1..-1] pio.async(payload) { self.send(verb, id, merge_params(id, params)) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get\n @get ||= Verb.new do |verb|\n verb.entity :air, :lodging, :car, :rail, :transport, \\\n :cruise, :restaurant, :activity, :note, :map, :directions, \\\n :points_program \\\n do |entity, id|\n do_request('get', entity, {:id=>id}, nil...
[ "0.695279", "0.65962714", "0.6335788", "0.6249612", "0.62225884", "0.6186497", "0.61675584", "0.61400354", "0.60772324", "0.6070931", "0.60554856", "0.6050929", "0.5976037", "0.5937177", "0.5927827", "0.5912216", "0.58981645", "0.58951724", "0.58734953", "0.5818319", "0.58106...
0.63229954
3
Each xmain will create many run_seq as many as steps and form_steps ]
def create_runseq(xmain) @xvars= xmain.xvars default_role= get_default_role xml= xmain.service.xml root = REXML::Document.new(xml).root i= 0; j= 0 # i= step, j= form_step root.elements.each('node') do |activity| text= activity.attributes['TEXT'] next if ma_comment?(text) next if text =~/^rule:\s*/ action= freemind2action(activity.elements['icon'].attributes['BUILTIN']) if activity.elements['icon'] return false unless action i= i + 1 output_ma_display= false if action== ('output'|| 'list' ||'folder') ma_display= get_option_xml("display", activity) if ma_display && !affirm(ma_display) output_ma_display= false else output_ma_display= true end end j= j + 1 if (action=='form' || output_ma_display) @xvars['referer'] = activity.attributes['TEXT'] if action=='redirect' if action!= 'if' && !text.blank? scode, name= text.split(':', 2) name ||= scode; name.strip! code= name2code(scode) else code= text name= text end role= get_option_xml("role", activity) || default_role rule= get_option_xml("rule", activity) || "true" runseq= Jinda::Runseq.create :xmain=>xmain.id, :name=> name, :action=> action, :code=> code, :role=>role.upcase, :rule=> rule, :rstep=> i, :form_step=> j, :status=>'I', :xml=>activity.to_s xmain.current_runseq= runseq.id if i==1 end @xvars['total_steps']= i @xvars['total_form_steps']= j end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_steps\n\t#make calls to step here...\nend", "def test_steps; end", "def test_steps; end", "def add_step(step,sample)\t\n\n\t\t\t\t# setting job working directory\n\t\t\t\tworking_dir = \"\"\t\n\t\t\t\tif self.local \n\t\t\t\t\tworking_dir = self.local+\"/\"+self.name\n\t\t\t\telse\n\t\t\t\t\tworking_...
[ "0.6226016", "0.57974505", "0.57974505", "0.5615313", "0.55760384", "0.5518346", "0.5513413", "0.5485281", "0.54351246", "0.5385154", "0.53595537", "0.5353766", "0.53498465", "0.53372645", "0.53364813", "0.5308568", "0.53064734", "0.53033334", "0.5302176", "0.52902144", "0.52...
0.736912
0
returns false. Stop searching the first time the block returns false. Write a method called all? that behaves similarly for Arrays. Should return true if the array is empty.
def all?(collection) collection.each { |item| return false if !yield(item) } true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all?(&block)\n n = 0\n lim = size\n if block_given?\n while n < lim\n unless yield(self.__at(n)) ; return false ; end\n n = n + 1\n end\n else\n while n < lim\n unless self.__at(n) ; return false ; end\n n = n + 1\n end\n end\n true\n end", "...
[ "0.8125602", "0.7620637", "0.75627947", "0.7521884", "0.751895", "0.75036246", "0.7461377", "0.744715", "0.74178237", "0.7372185", "0.73671174", "0.7350128", "0.73386264", "0.7287544", "0.72684443", "0.726438", "0.7262817", "0.72156686", "0.71917385", "0.7177755", "0.7172164"...
0.6858307
49
TODO: default eligible_item_service from 4033
def initialize(resource_id:, eligible_item_service:, change_set_persister:) @resource_id = resource_id @eligible_item_service = eligible_item_service @change_set_persister = change_set_persister resource_charge_list.clear_expired_charges! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_request(service); end", "def eligible_inventory_item_ids\n where_hash = {\n vendor: promotion.vendor_ids,\n service_id: preferred_service_id,\n item_id: preferred_item_id,\n item_type_id: preferences[:item_type_id]\n }\n @eligible_...
[ "0.58373576", "0.5758303", "0.5719049", "0.5702834", "0.56762964", "0.5660141", "0.55610645", "0.5552717", "0.5551457", "0.5551457", "0.5532734", "0.5521943", "0.5496442", "0.54834175", "0.54799235", "0.54724634", "0.5470479", "0.5444505", "0.5443673", "0.54296976", "0.540326...
0.5034547
99
GET /admin/solutions or admin_solutions_path
def index @solutions = Solution.all.paginate(:page => params[:page]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path(*args)\n render_path(:admin, args)\n end", "def index\n @solutions = Solution.all\n end", "def index\n @solutions = Solution.all\n end", "def index\n @solutions = Solution.all\n end", "def admin_routes\n if admin?\n [\n [ new_help_path, 'New Help' , 'helps' ],\...
[ "0.5869873", "0.5787353", "0.5787353", "0.5787353", "0.57679534", "0.56829405", "0.5676829", "0.56346035", "0.56345123", "0.5622203", "0.53823394", "0.5372288", "0.53691924", "0.5360022", "0.5341985", "0.5325785", "0.53091323", "0.530597", "0.5285104", "0.52795", "0.5262125",...
0.55134374
10
GET /admin/solutions/:id/edit or edit_admin_solution_path
def edit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_path\n \"/answers/#{object.id}/edit\"\n end", "def edit\n @problem = @solution.problem\n @languages = Language.all\n breadcrumbs\n add_breadcrumb \"Edit Solution\"\n end", "def edit\n find_admin_by_id\n end", "def edit\n @resource = Admin.find(params[:id])\n end", "def edi...
[ "0.7136057", "0.7039822", "0.681941", "0.6751952", "0.66999936", "0.6554603", "0.6407349", "0.63712865", "0.63529664", "0.6334892", "0.633301", "0.6327482", "0.6319841", "0.6319841", "0.6319841", "0.6315453", "0.63057196", "0.6305072", "0.6287706", "0.6280186", "0.62761766", ...
0.0
-1
PATCH/PUT /admin/solutions/:id or admin_solution_path AJAX
def update if @solution.update_attributes(update_solution_params) alert_js('SUCCESS solution updated.') else alert_js('!!!ERROR updating solution!!!') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @solution.update(solution_params)\n format.html { redirect_to @solution, notice: 'Solution was successfully updated.' }\n format.json { render :show, status: :ok, location: @solution }\n format.js \n else\n format.html { render :edit...
[ "0.7323371", "0.7013389", "0.6855448", "0.6778403", "0.66757756", "0.6632259", "0.6627208", "0.6416595", "0.6363618", "0.6300785", "0.6259604", "0.6244589", "0.6212094", "0.6190753", "0.6149305", "0.6129834", "0.61275864", "0.6119496", "0.61144036", "0.6109143", "0.6084728", ...
0.6805077
3
DELETE /admin/solutions/:id or admin_solution_path AJAX
def destroy if @solution.destroy alert_js('SUCCESS solution deleted.') else alert_js('!!!ERROR deleting solution!!!') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @solution = Solution.find(params[:id])\n @solution.destroy\n\n render json: { text: \"success\" }\n end", "def destroy\n @solution.destroy\n respond_to do |format|\n format.html { redirect_to(admin_solutions_url) }\n format.xml { head :ok }\n end\n website.add_log(u...
[ "0.7611594", "0.75602776", "0.75415486", "0.7489248", "0.7486619", "0.7264953", "0.7264953", "0.71954066", "0.7139925", "0.7117763", "0.7073571", "0.700038", "0.6998077", "0.69672996", "0.68717396", "0.68514323", "0.68483055", "0.68396723", "0.68216014", "0.6775228", "0.67594...
0.7221511
7
will raise an exception on failed decryption
def load(password=nil) reset(password) if password data = @yzb.load(@dumpfile) # Sanity check... load will raise CipherError on decription error. raise CONFIG[:CipherError] unless data.class == Hash @data = data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt; end", "def decrypt\n self\n end", "def decrypt(alg, password, cipher)\n \n begin\n case alg\n when \"3DES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'des3')\n when \"AES\" then key = EzCrypto::Key.with_password(passwo...
[ "0.7536875", "0.67451257", "0.6645803", "0.66172016", "0.6562857", "0.6429574", "0.63824034", "0.63176477", "0.63117486", "0.6257261", "0.62366974", "0.6212731", "0.6196867", "0.619491", "0.6146825", "0.61222184", "0.60974205", "0.6076279", "0.6036688", "0.6028061", "0.600170...
0.0
-1
Return the cluster status
def clusterstatus(as_json: false) # don't cache it status = Utils.solr_request(connection, 'CLUSTERSTATUS') if as_json status.to_json else status end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_status\n report_metric 'Cluster Status/Partitioned', 'nodes', rmq_manager.nodes.count { |n| Array(n['partitions']).any? }\n report_metric 'Cluster Status/Stopped', 'nodes', rmq_manager.nodes.count { |n| !n['running'] }\n end", "def read_cluster_status(opts = {})\n data, _statu...
[ "0.83505356", "0.7620132", "0.7598819", "0.73326105", "0.726689", "0.71325547", "0.70868975", "0.7084241", "0.70763725", "0.707241", "0.69856614", "0.6963993", "0.68929404", "0.68446666", "0.67671984", "0.67463964", "0.65773004", "0.65694827", "0.6547558", "0.64864856", "0.64...
0.83396685
1
Generate a report of the current collection/shards status as: type of rapresentation :native :table (default) :json :simple using_persisted: if true doesn't make a request to SOLR but use the persisted state
def report_clusterstatus(as: :table, using_persisted: false) rows = using_persisted ? restore_solr_status : check_cluster case as when :table # order first by STATUS then by COLLECTION (name) rows = sort_rows(rows) table = Terminal::Table.new( headings: [ 'Collection', 'Replica Factor', 'Shards', 'Shard Active', 'Shard Down', 'Shard Good', 'Shard Bad', 'Replica UP', 'Replica DOWN', 'Status', 'Recoverable' ], rows: rows.map do |row| [ row[:collection], row[:num_replicas], row[:num_shards], row[:shard_active], row[:shard_non_active], row[:shard_good], row[:shard_bad], row[:replicas_up], row[:replicas_down], row[:gstatus] ? 'OK' : 'BAD', row[:recoverable] ? 'YES' : 'NO' ] end ) puts table when :native status = rows.each_with_object({}) do |row, acc| name = row[:collection] row.delete(:collection) acc[name] = row end status when :json status = rows.each_with_object({}) do |row, acc| name = row[:collection] row.delete(:collection) acc[name] = row end status.to_json when :simple status = 'green' bad_collections = [] rows.each do |row| if row[:status] == :bad && row[:recoverable] == false status = 'red' bad_collections << { collection: row[:collection], base_url: row[:bad_urls], recoverable: false } elsif row[:status] == :bad && row[:recoverable] == true status = 'orange' unless status == 'red' bad_collections << { collection: row[:collection], base_url: row[:bad_urls], recoverable: true } elsif row[:bad_urls].count > 0 bad_collections << { collection: row[:collection], base_url: row[:bad_urls], recoverable: true } end end { status: status, bad_collections: bad_collections } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(memoize = true)\n if @status[:updated].nil? or not memoize or (memoize and not @status[:updated].nil? and \n ((Time.now - @status[:updated]) >= self.class.status_update_threshold))\n response = Crocodoc.connection.get 'document/status', :uuids => @uuid\n response = response.bod...
[ "0.63049984", "0.6267864", "0.6119953", "0.61172706", "0.60531193", "0.5971388", "0.59207785", "0.58810276", "0.5837148", "0.5837148", "0.57742393", "0.57229936", "0.5695624", "0.56769913", "0.56360763", "0.563186", "0.56289184", "0.5622324", "0.56064737", "0.55927396", "0.55...
0.7405822
0
Persist SOLR status to file (using pstore)
def persist_solr_status cluster = clusterstatus rows = check_cluster(status: cluster) # store to disk the current status store = PStore.new('cluster_stauts.pstore') store.transaction do # only for debug store['solr_cluster_status'] = cluster # save rows store['solr_cluster_status_rows'] = rows store['replicas_not_active'] = @replicas_not_active end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_status(file_path)\n begin\n Pathname.new(file_path).open('wb') do |f|\n @saved_at = Fluent::Engine.now\n @saved_duration = @saved_at - @last_checked\n Marshal.dump({\n :counts => @counts,\n :saved_at => @saved_at,\n :saved_duration ...
[ "0.6683733", "0.6654808", "0.62895614", "0.6160266", "0.61195916", "0.6115857", "0.5925022", "0.5899902", "0.5898409", "0.5880214", "0.5867806", "0.5847143", "0.58341646", "0.58176476", "0.57847404", "0.57520497", "0.571825", "0.57130885", "0.57069904", "0.5695444", "0.569264...
0.7014388
0