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 |
|---|---|---|---|---|---|---|
return the fields for this hit type | def fields
self.class::FIELDS
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fields\n FIELDS\n end",
"def fields\n @fields\n end",
"def fields\n FIELDS\n end",
"def fields\n @fields.keys\n end",
"def fields\n @fields.keys\n end",
"def fields\n FIELDS\n end",
"def fields\n @fields\n ... | [
"0.7645273",
"0.76416165",
"0.7637241",
"0.7635078",
"0.7635078",
"0.76157457",
"0.76152307",
"0.76152307",
"0.7572101",
"0.75109094",
"0.746728",
"0.7463529",
"0.73756874",
"0.73756874",
"0.73756874",
"0.7372374",
"0.7370972",
"0.7326207",
"0.72742087",
"0.72742087",
"0.7274... | 0.690589 | 48 |
collects the parameters from options for this hit type | def params
base_params.
merge(tracker_default_params).
merge(global_options_params).
merge(hit_params).
merge(custom_dimensions).
merge(custom_metrics).
merge(custom_params).
reject {|_,v| v.nil?}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gather_options\n @_options\n end",
"def process_options\n \n end",
"def process_options\n \n end",
"def process_options\n \n end",
"def options_from_params\n case params[:view]\n when 'scouts'\n {:order => \"laa_#{@shot_sample} desc, id asc\", :include => :\"d... | [
"0.66778797",
"0.6570842",
"0.6570842",
"0.6570842",
"0.6388879",
"0.6333787",
"0.62315786",
"0.62315786",
"0.618525",
"0.6041518",
"0.60082567",
"0.5978573",
"0.59670615",
"0.5961832",
"0.5956225",
"0.5861442",
"0.5816048",
"0.58157766",
"0.58137465",
"0.5805722",
"0.5791836... | 0.56358767 | 37 |
send the hit to the tracker | def track!
tracker.track(params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hit; end",
"def add_hit\n @hits += 1\n :hit\n end",
"def hit\n @printer = []\n @printer << \"You Hit.\"\n deal_player\n pl_total\n if session[:player].bust? || session[:player].hand_total == 21\n @action = :end\n run_dealer\n else\n @action = :choice\n end\n chat\... | [
"0.6726814",
"0.65684915",
"0.6488638",
"0.64835596",
"0.6377334",
"0.6054198",
"0.6015596",
"0.6001678",
"0.59378296",
"0.59305954",
"0.59237725",
"0.5904275",
"0.5889381",
"0.58527577",
"0.58527577",
"0.57784396",
"0.5755595",
"0.5711339",
"0.57055676",
"0.56922287",
"0.569... | 0.64693743 | 5 |
=begin rdoc Parses a Flex SDK download page into a hash =end | def parse( page )
{ }.tap do |result|
sections_for( page ).each do |title, table|
result[ format.title title ] = format.table table
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_remote(md5_hash)\n unhash_data = Scrubyt::Extractor.define do\n fetch \"http://gdataonline.com/qkhash.php?mode=txt&hash=#{md5_hash}\"\n unhash \"//table/tr[2]/td[2]/b\"\n end\n \n doc = Nokogiri::HTML.parse(unhash_data.to_xml)\n doc.xpath('//root/unhash').text.strip rescue nil\n... | [
"0.5929118",
"0.56314516",
"0.5603317",
"0.5596564",
"0.5501688",
"0.5428691",
"0.5416669",
"0.5288479",
"0.52819824",
"0.5253896",
"0.52538323",
"0.52437204",
"0.5204317",
"0.52003354",
"0.51962614",
"0.5191158",
"0.51784325",
"0.5170254",
"0.5168821",
"0.5148992",
"0.512005... | 0.0 | -1 |
=begin rdoc The manipulator for this parser =end | def format
@format ||= Manipulator.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parser; end",
"def parser; end",
"def parser; end",
"def parser; end",
"def parse()\n #This is a stub, used for indexing\n end",
"def parser=(_arg0); end",
"def parsed; end",
"def parsed; end",
"def parse; end",
"def parse; end",
"def parse; end",
"def pluggable_... | [
"0.6589537",
"0.6589537",
"0.6589537",
"0.6589537",
"0.6331771",
"0.6292007",
"0.6195393",
"0.6195393",
"0.6169178",
"0.6169178",
"0.6169178",
"0.61627644",
"0.61388224",
"0.61388224",
"0.61388224",
"0.61388224",
"0.6035926",
"0.59980786",
"0.59980786",
"0.59739083",
"0.59739... | 0.0 | -1 |
=begin rdoc Zips up table titles with their tables =end | def sections_for( page )
titles_for( page ).zip( tables_for( page ) )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block_docbook_table( text ) \n text.gsub!( TABLE_RE ) do |matches|\n\n caption, id, tatts, fullrow = $~[1..4]\n tatts = docbook_pba( tatts, caption ? 'table' : 'informaltable' )\n tatts = shelve( tatts ) if tatts\n rows = []\n\n found_first = false\... | [
"0.69189847",
"0.6427808",
"0.64089817",
"0.6391642",
"0.63754755",
"0.6256279",
"0.6203045",
"0.618743",
"0.61863244",
"0.61863244",
"0.61863244",
"0.61863244",
"0.61732215",
"0.6078295",
"0.60748756",
"0.6072713",
"0.6072398",
"0.60484165",
"0.6041202",
"0.6014595",
"0.5973... | 0.0 | -1 |
=begin rdoc Finds all table titles in order =end | def titles_for( page )
page.xpath( HEADER_XPATH )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table title\r\n @xml.table do\r\n @xml.tr do @xml.th(title, :colspan => 3) end\r\n yield self\r\n end\r\n end",
"def summary_table_headers(args={})\n\n\t\tif args[\"root\"] =~ /order/\n\t\t\t'\n\t\t\t\t<thead>\n\t\t <tr>\n\t\t <th>Name</th>\n\t\t <th>Result... | [
"0.68700325",
"0.65143055",
"0.64094007",
"0.6365656",
"0.63513833",
"0.6305143",
"0.6266858",
"0.6246675",
"0.6226823",
"0.6135057",
"0.60829943",
"0.6069883",
"0.6039444",
"0.6014546",
"0.60016125",
"0.5979909",
"0.59376186",
"0.59277266",
"0.5918705",
"0.5905623",
"0.59045... | 0.6033821 | 13 |
=begin rdoc Finds all tables in order =end | def tables_for( page )
page.xpath( TABLE_XPATH )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tables\n table_names.map { |tn| table(tn) }\n end",
"def tables\n [\n ]\n end",
"def tables\n []\n end",
"def show_tables\r\n tables = Document.new(self).get_tables\r\n puts \"There are #{tables.length} tables\"\r\n index = 1\r\n tables.each ... | [
"0.68548024",
"0.6852993",
"0.6850389",
"0.67940825",
"0.67509234",
"0.6678684",
"0.66400427",
"0.66261095",
"0.6572255",
"0.65670514",
"0.6419325",
"0.63678384",
"0.6335096",
"0.6270344",
"0.6270344",
"0.6270344",
"0.6270344",
"0.6234438",
"0.6231125",
"0.62168884",
"0.62074... | 0.6801456 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_appointment
@appointment = Appointment.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 appointment_params
params.require(:appointment).permit(
:start_time, :patient_id, :doctor_id, :visit_id, :place_id,
patient_attributes: [:id, :clinical_history, :clinical_history_entry],
pending_activity_ids:[]
)
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 |
METODOS PARA CADASTRO E EDICAO DE FILTRO DE MENSAGEM | def incluir_filtro
incluir_filtro_btn.click
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def medir_indicador_efecto(mind, ind, fini, ffin, resf)\n idefs = []\n idefs = Cor1440Gen::MindicadorespfController.calcula_listado_ef(\n mind.indicadorpf_id, fini, ffin\n )\n if mind.funcionresultado.to_s != \"\"\n # Medir con esp de medicionin... | [
"0.6210308",
"0.6132977",
"0.6079711",
"0.5883285",
"0.5817852",
"0.58169866",
"0.58169866",
"0.58149546",
"0.5800758",
"0.57836777",
"0.5740952",
"0.5681182",
"0.56579673",
"0.5619817",
"0.5617241",
"0.56114566",
"0.5603835",
"0.5603461",
"0.55785125",
"0.55687225",
"0.55483... | 0.0 | -1 |
METODOS PARA CONSULTA DE FILTRO DE MENSAGEM | def selecionar_email_consulta(email_consulta)
email_filtro_consulta_select.select(email_consulta)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def medir_indicador_efecto(mind, ind, fini, ffin, resf)\n idefs = []\n idefs = Cor1440Gen::MindicadorespfController.calcula_listado_ef(\n mind.indicadorpf_id, fini, ffin\n )\n if mind.funcionresultado.to_s != \"\"\n # Medir con esp de medicionin... | [
"0.6248017",
"0.61615527",
"0.6125661",
"0.60857487",
"0.5996195",
"0.59484226",
"0.5893311",
"0.58770335",
"0.5805958",
"0.57563764",
"0.5751449",
"0.5751449",
"0.5733698",
"0.5700699",
"0.5694528",
"0.568463",
"0.56560045",
"0.56531906",
"0.56469136",
"0.56412727",
"0.56347... | 0.0 | -1 |
METODOS PARA DETALHAMENTO DE FILTRO DE MENSAGEM | def detalhar_filtro(nome_filtro)
@tamanho_lista = detalhar_btns.size
@indice = 0
while(@indice < @tamanho_lista)
puts @tamanho_lista
puts linhas_registros_tds[@indice].text
if(linhas_registros_tds[@indice].text == "filtro_automacao")
detalhar_btns[@indice].click
@indice = @tamanho_lista
end
@indice += 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_fichacortum\n @fichacortum = Fichacortum.find(params[:id])\n end",
"def set_ficha_musc\n @ficha_musc = FichaMusc.find(params[:id])\n end",
"def set_exercicios_ficha_musc\n @exercicios_ficha_musc = ExerciciosFichaMusc.find(params[:id])\n end",
"def file name\n \n end",
... | [
"0.5937577",
"0.59107447",
"0.5828911",
"0.5807256",
"0.57807195",
"0.57805365",
"0.57296556",
"0.57296556",
"0.57296556",
"0.57296556",
"0.57296556",
"0.57296556",
"0.572532",
"0.57189786",
"0.57118076",
"0.5710473",
"0.57063067",
"0.57044965",
"0.5698578",
"0.5698578",
"0.5... | 0.0 | -1 |
METODOS PARA EDICAO DE FILTRO DE MENSAGEM | def editar_filtro(nome_filtro)
@tamanho_lista = editar_btns.size
@indice = 0
while(@indice < @tamanho_lista)
puts @tamanho_lista
puts linhas_registros_tds[@indice].text
if(linhas_registros_tds[@indice].text == "filtro_automacao")
editar_btns[@indice].click
@indice = @tamanho_lista
end
@indice += 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def medir_indicador_efecto(mind, ind, fini, ffin, resf)\n idefs = []\n idefs = Cor1440Gen::MindicadorespfController.calcula_listado_ef(\n mind.indicadorpf_id, fini, ffin\n )\n if mind.funcionresultado.to_s != \"\"\n # Medir con esp de medicionin... | [
"0.6143535",
"0.604279",
"0.59571385",
"0.59111804",
"0.5841713",
"0.58121854",
"0.5799845",
"0.5799845",
"0.57957816",
"0.5743718",
"0.56812966",
"0.5658506",
"0.5654414",
"0.56494814",
"0.5648353",
"0.5643956",
"0.56387025",
"0.56022453",
"0.5598658",
"0.5576127",
"0.552651... | 0.0 | -1 |
METODOS PARA EXCLUSAO DO FILTRO | def excluir_filtro(nome_filtro)
@tamanho_lista = excluir_filtro_btns.size
@indice = 0
while(@indice < @tamanho_lista)
puts @tamanho_lista
puts linhas_registros_tds[@indice].text
if(linhas_registros_tds[@indice].text == "filtro_automacao")
excluir_filtro_btns[@indice].click
@indice = @tamanho_lista
end
@indice += 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entrar_arquivo\n end",
"def inizializza_file_path\n lista_file\n check_file\n end",
"def deco_file; end",
"def processa_arquivo(caminho_logs = nil, caminho_ips_ignorados = nil)\n if caminho_logs.nil?\n imprime_banner\n else\n begin\n lista_requisicoes = []\n lista_ips_ignor... | [
"0.63648146",
"0.6318361",
"0.6275457",
"0.6202166",
"0.618545",
"0.61468977",
"0.60526764",
"0.6024054",
"0.60043216",
"0.60043216",
"0.60043216",
"0.60043216",
"0.60043216",
"0.60043216",
"0.60043216",
"0.60043216",
"0.60043216",
"0.60043216",
"0.60043216",
"0.5990395",
"0.... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_user
@user = User.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 user_params
params.require(:user).permit(:first_name, :last_name,
:email, :mobile, :age, :dob,
locations_attributes: [ :address, :location_name, :phone_number,
:district, :city, :postcode, :country, :lat, :lng]
)
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.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
same as line 5 | def method_name(parameters)
# code to be executed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def anchored; end",
"def schubert; end",
"def terpene; end",
"def berlioz; end",
"def trd; end",
"def p15\n\t\nend",
"def stderrs; end",
"def offences_by; end",
"def loc; end",
"def loc; end",
"def loc; end",
"def mambo_no_5; end",
"def verdi; end... | [
"0.6883595",
"0.6734226",
"0.6433587",
"0.63631094",
"0.6304676",
"0.6270792",
"0.6259141",
"0.6224319",
"0.6149033",
"0.61304885",
"0.61078763",
"0.61078763",
"0.61078763",
"0.60289454",
"0.6024098",
"0.6022035",
"0.6022035",
"0.6022035",
"0.6022035",
"0.6022035",
"0.6022035... | 0.0 | -1 |
get every test to pass before coding runner below | def runner
welcome
card_total = initial_round
until card_total > 21
card_total = hit?(card_total)
display_card_total(card_total)
end
end_game(card_total)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do |plugin|\n result = @expectation.check(plugin, response, test_case)\n if no... | [
"0.7274132",
"0.7200911",
"0.71905994",
"0.7134598",
"0.7127439",
"0.70358455",
"0.6860759",
"0.68229115",
"0.68049264",
"0.6790065",
"0.6790065",
"0.6768047",
"0.65728307",
"0.65551996",
"0.65487796",
"0.65460235",
"0.65293026",
"0.64595217",
"0.6447049",
"0.6447049",
"0.644... | 0.0 | -1 |
To make debugging easier, we have a custom exception here | def prefixed_working_directory
# We fall back to "*", which means certificates and profiles
# from all teams that use this bucket would be installed. This is not ideal, but
# unless the user provides a `team_id`, we can't know which one to use
# This only happens if `readonly` is activated, and no `team_id` was provided
@_folder_prefix ||= currently_used_team_id
if @_folder_prefix.nil?
# We use a `@_folder_prefix` variable, to keep state between multiple calls of this
# method, as the value won't change. This way the warning is only printed once
UI.important("Looks like you run `match` in `readonly` mode, and didn't provide a `team_id`. This will still work, however it is recommended to provide a `team_id` in your Appfile or Matchfile")
@_folder_prefix = "*"
end
return File.join(working_directory, @_folder_prefix)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def original_exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def wrapped_exception; end",
"def underlying_exception; end",
"def continued_exception; end",
"def rescue_from(exception); end",
"def exception\n raise... | [
"0.7785424",
"0.7690376",
"0.7690376",
"0.7690376",
"0.7690376",
"0.7690376",
"0.7653998",
"0.7653497",
"0.7560678",
"0.742731",
"0.7320475",
"0.72022814",
"0.71863467",
"0.717881",
"0.71495044",
"0.7130402",
"0.7076592",
"0.7063923",
"0.6971781",
"0.6895038",
"0.6895038",
... | 0.0 | -1 |
Call this method for the initial clone/download of the user's certificates & profiles As part of this method, the `self.working_directory` attribute will be set | def download
# Check if we already have a functional working_directory
return if @working_directory && Dir.exist?(@working_directory)
# No existing working directory, creating a new one now
self.working_directory = Dir.mktmpdir
s3_client.find_bucket!(s3_bucket).objects.each do |object|
file_path = object.key # :team_id/path/to/file
download_path = File.join(self.working_directory, file_path)
FileUtils.mkdir_p(File.expand_path("..", download_path))
UI.verbose("Downloading file from S3 '#{file_path}' on bucket #{self.s3_bucket}")
object.download_file(download_path)
end
UI.verbose("Successfully downloaded files from S3 to #{self.working_directory}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initial_path_setup\n repo_name = @repo.repo_name.gsub(/[.]+/, '-') || @repo.repo_name\n repo_path = Rails.root.join('storage', 'repos', @repo.username, @repo.supplier_project_id.to_s, repo_name)\n FileUtils.mkdir_p(repo_path) unless File.directory?(repo_path)\n Dir.chdir(repo_path)\n A... | [
"0.5958381",
"0.57938594",
"0.56460387",
"0.54528373",
"0.53806716",
"0.5253887",
"0.5232536",
"0.5232308",
"0.52169704",
"0.5206954",
"0.51610565",
"0.5159421",
"0.51348597",
"0.5126791",
"0.5090989",
"0.50901777",
"0.5054395",
"0.503115",
"0.50116074",
"0.5000316",
"0.49932... | 0.47823083 | 51 |
Returns a short string describing + identifing the current storage backend. This will be printed when nuking a storage | def human_readable_description
return "S3 Bucket [#{s3_bucket}] on region #{s3_region}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storage_name\n @storage_name || name\n end",
"def print_storage_info()\n # empty --> this is like an abstract class method\n end",
"def current_storage\n @attributes[:current_storage]\n end",
"def backend_name\n self.class.name.split(\"::\")[-1].split(\"Store\")[0].downcase\n ... | [
"0.68942076",
"0.6723",
"0.66401803",
"0.6499238",
"0.6445016",
"0.63945097",
"0.63945097",
"0.629973",
"0.6255627",
"0.61572444",
"0.61153036",
"0.60738266",
"0.6068345",
"0.6058942",
"0.6053703",
"0.6053703",
"0.60318244",
"0.60283214",
"0.6027944",
"0.6024881",
"0.60093665... | 0.0 | -1 |
Implement this for the `fastlane match init` command This method must return the content of the Matchfile that should be generated | def generate_matchfile_content(template: nil)
return "s3_bucket(\"#{self.s3_bucket}\")"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_matchfile_content(template: nil)\n project = UI.input(\"What is your GitLab Project (i.e. gitlab-org/gitlab): \")\n\n return \"gitlab_project(\\\"#{project}\\\")\"\n end",
"def run\n program :name, 'ManualMatchManager'\n program :version, MANUAL_MATCH_MANAGER... | [
"0.70024925",
"0.6103736",
"0.5543133",
"0.5498568",
"0.5474934",
"0.5429014",
"0.5352226",
"0.5344122",
"0.5323772",
"0.52744156",
"0.52618515",
"0.5233628",
"0.52301925",
"0.5217086",
"0.5215936",
"0.51432997",
"0.5121102",
"0.5105284",
"0.5102395",
"0.5080261",
"0.50686455... | 0.5997861 | 2 |
Eager load the inclusions for the provided documents. | def eager_load(docs)
criteria.inclusions.reject! do |metadata|
metadata.eager_load(eager_loaded_ids(docs, metadata)) if !docs.empty?
end
self.eager_loaded = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eager_load(docs)\n docs.tap do |d|\n if eager_loadable?\n preload(criteria.inclusions, d)\n end\n end\n end",
"def preload(associations, docs)\n assoc_map = associations.group_by(&:inverse_class_name)\n docs_map = {}\n queue = [ klass.to_s ... | [
"0.7961708",
"0.7189925",
"0.71194655",
"0.67525935",
"0.6457974",
"0.5974804",
"0.5782307",
"0.57713246",
"0.5672247",
"0.56202644",
"0.5588762",
"0.5567512",
"0.5559808",
"0.5550628",
"0.5550299",
"0.54679507",
"0.5458448",
"0.5411506",
"0.5410671",
"0.53934044",
"0.5354763... | 0.7825022 | 1 |
Get the ids that to be used to eager load documents. | def eager_loaded_ids(docs, metadata)
if metadata.stores_foreign_key?
docs.flat_map{ |doc| doc.send(metadata.foreign_key) }
else
docs.map(&:id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ids\n pluck(:id)\n end",
"def ids\n @ids ||= []\n end",
"def list_ids\n @documents.keys\n end",
"def ids; @docs.keys end",
"def ids_reader\n if loaded?\n target.pluck(reflection.association_primary_key)\n elsif !target.empty?\n loa... | [
"0.7399233",
"0.71266544",
"0.69960755",
"0.69870645",
"0.6968951",
"0.68956256",
"0.6885342",
"0.6851249",
"0.6733995",
"0.6733995",
"0.66956615",
"0.6689642",
"0.66720366",
"0.66556054",
"0.6654067",
"0.664867",
"0.66382426",
"0.66186136",
"0.6565304",
"0.6548871",
"0.65374... | 0.82438326 | 0 |
Is this context able to be eager loaded? | def eager_loadable?
!eager_loaded && !criteria.inclusions.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eager_load; end",
"def eager_load; end",
"def eager_load; end",
"def eager_load!; end",
"def eager_load!; end",
"def eager_load!; end",
"def eager_load!; end",
"def eagerly_apply_sideload?(sideload)\n # TODO: Maybe handle this in graphiti-rails\n if defined?(::Rails) && (app = :... | [
"0.7394642",
"0.7394642",
"0.7394642",
"0.7300624",
"0.7300624",
"0.7300624",
"0.7300624",
"0.72637445",
"0.7181542",
"0.7149233",
"0.7087576",
"0.70119905",
"0.69184154",
"0.6863344",
"0.6618614",
"0.66065854",
"0.6516241",
"0.6482455",
"0.6482455",
"0.648157",
"0.64795446",... | 0.7465128 | 0 |
If the provided document exists, eager load its dependencies or return nil. | def with_eager_loading(document)
selecting do
return nil unless document
doc = Factory.from_db(klass, document, criteria.object_id)
eager_load([ doc ]) if eager_loadable?
doc
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eager_load(docs)\n docs.tap do |d|\n if eager_loadable?\n preload(criteria.inclusions, d)\n end\n end\n end",
"def eager_load(docs)\n criteria.inclusions.reject! do |metadata|\n metadata.eager_load(eager_loaded_ids(docs, metadata)) if !docs.empt... | [
"0.6579142",
"0.6222745",
"0.5713307",
"0.5503678",
"0.5422323",
"0.54137653",
"0.54137653",
"0.54137653",
"0.54137653",
"0.5335207",
"0.53014153",
"0.5300445",
"0.52242017",
"0.52242017",
"0.52242017",
"0.51282054",
"0.51129645",
"0.51118416",
"0.5066751",
"0.5036758",
"0.50... | 0.7237734 | 0 |
active record does not recommend scopes if you pass a parameter scope : | def release_date_is_in_the_past
if release_date.present?
errors.add(:release_date, "should be in the past") if release_date > Date.today
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scope_options; end",
"def scope_options; end",
"def scope\n finder_or_run(:scope)\n end",
"def apply_to_scope(scope)\n scope\n end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
... | [
"0.72447395",
"0.72447395",
"0.710573",
"0.7054234",
"0.70155907",
"0.70155907",
"0.70155907",
"0.70155907",
"0.70155907",
"0.70155907",
"0.70155907",
"0.70155907",
"0.70155907",
"0.70155907",
"0.6992527",
"0.6973862",
"0.6972064",
"0.6972064",
"0.6782437",
"0.6767102",
"0.67... | 0.0 | -1 |
Delete all the result data for this competition. Note: only works for Time Results and External Results.... (Judged events do not work). | def destroy_all_results
authorize @competition
results = @competition.scoring_helper.all_competitor_results
if results.present?
Competition.transaction do
results.each(&:destroy)
end
flash[:notice] = "Deleted all data for this competition"
else
flash[:alert] = "No results to be deleted"
end
redirect_to @competition
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @external_result.destroy\n\n respond_to do |format|\n format.html { redirect_to competition_external_results_path(@competition) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_result.destroy\n\n respond_to do |format|\n format.html { redirect_t... | [
"0.66776633",
"0.6654998",
"0.6604729",
"0.652609",
"0.650969",
"0.6457385",
"0.62956434",
"0.62074876",
"0.6196466",
"0.6192479",
"0.61584574",
"0.61348474",
"0.6123614",
"0.6123006",
"0.611536",
"0.611536",
"0.61077696",
"0.61077696",
"0.60713124",
"0.60713124",
"0.60713124... | 0.7805588 | 0 |
Link to user's page ('users/1') By default, their login is used as link text and link title (tooltip) Takes options :content_text => 'Content text in place of user.login', escaped with the standard h() function. :content_method => :user_instance_method_to_call_for_content_text :title_method => :user_instance_method_to_call_for_title_attribute as well as link_to()'s standard options Examples: | def link_to_user(user, options={})
raise "Invalid user" unless user
options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname
content_text = options.delete(:content_text)
content_text ||= user.send(options.delete(:content_method))
options[:title] ||= user.send(options.delete(:title_method))
link_to h(content_text), user_path(user), options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_to_user(user, options={})\n raise I18n.t(\"Invalid user\", :default => \"Invalid user\") unless user\n options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname\n content_text = options.delete(:content_text)\n content_text ||= user.send(options.dele... | [
"0.82731956",
"0.76458555",
"0.7575097",
"0.7575097",
"0.7575097",
"0.7501613",
"0.7118422",
"0.69058424",
"0.69058424",
"0.69058424",
"0.69058424",
"0.69058424",
"0.6853651",
"0.68350726",
"0.66663975",
"0.66597277",
"0.6569704",
"0.6567823",
"0.65475714",
"0.65009093",
"0.6... | 0.83703524 | 0 |
Link to login page using remote ip address as link content The :title (and thus, tooltip) is set to the IP address Examples: link_to_login_with_IP => 169.69.69.69 link_to_login_with_IP :content_text => 'not signed in' => not signed in | def link_to_login_with_IP content_text=nil, options={}
ip_addr = request.remote_ip
content_text ||= ip_addr
options.reverse_merge! :title => ip_addr
if tag = options.delete(:tag)
content_tag tag, h(content_text), options
else
link_to h(content_text), login_path, options
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_to_current_user(options={})\n if logged_in?\n link_to_user current_user, options\n else\n content_text = options.delete(:content_text) || 'not signed in'\n # kill ignored options from link_to_user\n [:content_method, :title_method].each{|opt| options.delete(opt)} \n link_to_... | [
"0.6607851",
"0.6566664",
"0.6566664",
"0.6566664",
"0.6497042",
"0.64544654",
"0.63060236",
"0.6305259",
"0.6305259",
"0.6305259",
"0.622738",
"0.6166231",
"0.5747296",
"0.56597656",
"0.56208557",
"0.55632466",
"0.546215",
"0.5421976",
"0.5421976",
"0.54186374",
"0.54111195"... | 0.86577135 | 3 |
Link to the current user's page (using link_to_user) or to the login page (using link_to_login_with_IP). | def link_to_current_user(options={})
if logged_in?
link_to_user current_user, options
else
content_text = options.delete(:content_text) || 'not signed in'
# kill ignored options from link_to_user
[:content_method, :title_method].each{|opt| options.delete(opt)}
link_to_login_with_IP content_text, options
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_to_current_user(options={})\n if current_user\n link_to_user current_user, options\n else\n content_text = options.delete(:content_text) || I18n.t(\"not signed in\", :default => \"not signed in\")\n # kill ignored options from link_to_user\n [:content_method, :title_method].each{... | [
"0.80740875",
"0.8023548",
"0.8023548",
"0.8023548",
"0.75909233",
"0.7460318",
"0.74271417",
"0.7180359",
"0.7107796",
"0.7106657",
"0.7106657",
"0.7106657",
"0.7071415",
"0.69571424",
"0.6945969",
"0.6923482",
"0.691113",
"0.691113",
"0.691113",
"0.691113",
"0.691113",
"0... | 0.80252796 | 1 |
This hook allows other tracing in Hometown to get a whack at an object after it's been created without forcing them to patch new themselves | def update_on_instance_created(clazz, on_instance_created)
return unless on_instance_created
clazz.instance_eval do
def instance_hooks
hooks = (self.ancestors + [self]).map do |target|
target.instance_variable_get(:@instance_hooks)
end
hooks.flatten!
hooks.compact!
hooks.uniq!
hooks
end
@instance_hooks ||= []
@instance_hooks << on_instance_created
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hook_owner; end",
"def after_create(obj); end",
"def decorated_object_behavior\n #code\n end",
"def tracing()\n #This is a stub, used for indexing\n end",
"def patch_instance(obj)\n meta = (class << obj; self end)\n patch_class(meta)\n end",
"def extend_object( hook... | [
"0.58294636",
"0.58237195",
"0.5786408",
"0.5751352",
"0.5708014",
"0.56771386",
"0.5612979",
"0.55999404",
"0.5575562",
"0.55438495",
"0.54779667",
"0.5460122",
"0.54478216",
"0.5441534",
"0.54261696",
"0.53643537",
"0.53600675",
"0.5336947",
"0.5315662",
"0.530611",
"0.5300... | 0.0 | -1 |
Gets called when you call the new method to create an instance deck = Deck.new | def initialize
@ranks = %w(A 2 3 4 5 6 7 8 9 10 J Q K)
@suits = %w(Spades Diamonds Clubs Hearts)
@cards = []
generate_deck
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @deck = Deck.new\n end",
"def new\n @current_deck = Deck.new\n end",
"def init_deck\n @deck = Deck.new\nend",
"def new\n @decklist = Decklist.new\n end",
"def initialize(deck)\n @deck = deck\n end",
"def newDeck(name, template = @cur_deck_name)\n\n end",
"def initi... | [
"0.90065753",
"0.8454829",
"0.80933964",
"0.7977498",
"0.77437425",
"0.7528519",
"0.73254085",
"0.73129267",
"0.7186925",
"0.7186925",
"0.7104639",
"0.71020037",
"0.7019283",
"0.70129734",
"0.69164526",
"0.6889352",
"0.68698156",
"0.6858069",
"0.68431175",
"0.68344676",
"0.68... | 0.67537975 | 25 |
=begin Script and functions for getting functions for ChemInfo. Given a directory containing JS function definition scripts Get all function definitions and names Place all in a JS script =end Function definitions Get entries in directory by extension regex | def dirExt(dir, ext = /\.js$/)
return(Dir.entries(dir).select{|e| e.match?(ext)})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_functions src_file\n code = IO.readlines(src_file)\n functions = []\n puts src_file\n code.each do |line|\n /^\\s*def\\s+([^\\s\\(]+)\\s?.*/ =~ line\n functions << $1 if $1\n end \n functions\n end",
"def read_js_funcs \n Dir[\"#{@mjs_path}/_*.mjs\"].each do | file ... | [
"0.6568727",
"0.64687216",
"0.6135868",
"0.59862",
"0.5792973",
"0.5669392",
"0.5665943",
"0.5624369",
"0.5549512",
"0.5513667",
"0.5466103",
"0.5456521",
"0.5324806",
"0.52896625",
"0.52679735",
"0.52263314",
"0.52001303",
"0.51537544",
"0.51531917",
"0.5088504",
"0.50870085... | 0.50463474 | 24 |
Strip line and inline comments from a newlinesplit source file | def removeComments(text)
# Currently hardcoded for JS comments and the two-space inline convention
expr = {:line => /^(\s+)?[\/\*]/, :inline => / \/.+$/}
return(
text.reject{|t| t.match?(expr[:line])}.map{|t| t.gsub(expr[:inline], '')}
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_comments\n in_str = false\n @src_lines.each do |line|\n pos = line.each_char.with_index do |ch,i|\n if ch == '\"'\n if in_str\n in_str = false\n else\n in_str = true\n end\n end\n \n if ch == \... | [
"0.7361518",
"0.7066754",
"0.70038074",
"0.70028514",
"0.6918206",
"0.68835986",
"0.6832823",
"0.6810613",
"0.6759957",
"0.67219704",
"0.67066383",
"0.6681844",
"0.6674732",
"0.66743565",
"0.6660861",
"0.6633991",
"0.66184247",
"0.65911067",
"0.6587987",
"0.6561184",
"0.65299... | 0.6417817 | 26 |
Get the top / header line of a function definition file, and get function name and swapped form | def getTopLine(text)
functionName = text.match(/(?<=function )([^\(]+)/)[0]
swapped = "#{functionName}: #{text.gsub(/(?<=function) [^\(]+/, '')}"
return({:name => functionName, :swap => swapped})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def function_header\n if token_is_not? :def\n return nil\n end\n require :def\n method_name = require :id\n require :open_parentheses\n argument_list = argument_list()\n require :close_parentheses\n { method_name: method_name.content, argument_list: argument_list }\n ... | [
"0.7030817",
"0.6795978",
"0.6788353",
"0.6640568",
"0.660048",
"0.6465643",
"0.62303877",
"0.6204543",
"0.6111567",
"0.61023253",
"0.60288215",
"0.6012504",
"0.58947355",
"0.5858136",
"0.5806586",
"0.57749474",
"0.5772479",
"0.57703614",
"0.57703614",
"0.57703614",
"0.577036... | 0.7294665 | 0 |
Main class invoked by the client (i.e. dsl/ methods) | def load!(args, expand_by: 1, layout: {}, dpi: 300, cell_px: 37.5)
@dpi = dpi
@cell_px = cell_px
args[:layout] = prep_layout_args(args[:layout], expand_by: expand_by)
expand_and_set_and_defaultify(args: args, by: expand_by, layout: layout)
validate
convert_units dpi: dpi, cell_px: cell_px
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entrypoint\n client.entrypoint\n end",
"def run\n client.run\n end",
"def main\n end",
"def main\n\n end",
"def run_main\n end",
"def main\n @app.main\n end",
"def main; end",
"def main\n self\n end",
"def client; end",
"def client; end",
"def run\n end",... | [
"0.73047614",
"0.71260446",
"0.70846826",
"0.7067535",
"0.69293535",
"0.69203347",
"0.68987966",
"0.6771679",
"0.6685519",
"0.6685519",
"0.6504409",
"0.6504409",
"0.6504409",
"0.6504409",
"0.6504409",
"0.6504409",
"0.6504409",
"0.64758414",
"0.64666927",
"0.6465547",
"0.64300... | 0.0 | -1 |
Must be: (a) an expanding parameter, and (b) a singleton already (i.e. doesn't respond to :each) | def expandable_singleton?(p, arg)
self.class.expanding_parameters.include?(p) && !arg.respond_to?(:each)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expand\n end",
"def double_collections_by_parameter_name; end",
"def double_collections_by_parameter_name; end",
"def expanded; end",
"def splat_mth(*mult_arg)\n p mult_arg #it's array :) !\n p mult_arg.class\n p mult_arg.object_id\n mult_arg.map {|arg| }\n end",
"def my_inject(arg = nil)\n\... | [
"0.5670332",
"0.55736846",
"0.55736846",
"0.5334335",
"0.5330755",
"0.53165853",
"0.5289883",
"0.5279621",
"0.52580595",
"0.5232545",
"0.5201416",
"0.51912737",
"0.5169503",
"0.5152025",
"0.5152025",
"0.5133091",
"0.51196957",
"0.5116818",
"0.5108777",
"0.50890464",
"0.505195... | 0.72003657 | 0 |
Incorporate defaults and layouts (1) Use whatever is specified if it is (2) Go over all layout specifications (if any) and look them up Use layout when it's specified for that card Use "default" if no layout was specified, or the layout itself did not specify | def defaultify(p, args, layout)
return args[p] if args.key? p # arg was specified, no defaults used
defaults = self.class.parameters.merge(@dsl_method_defaults || {})
args[:layout].map do |layout_arg|
return defaults[p] if layout_arg.nil? # no layout specified, use default
unless layout.key? layout_arg.to_s # specified a layout, but it doesn't exist in layout. Oops!
Squib.logger.warn("Layout \"#{layout_arg.to_s}\" does not exist in layout file - using default instead")
return defaults[p]
end
if layout[layout_arg.to_s].key?(p.to_s)
layout[layout_arg.to_s][p.to_s] # param specified in layout
else
defaults[p] # layout specified, but not this param
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_layout\n contributable = (@workflow || @pack || @blob)\n layout = nil\n\n # For testing skins\n if params[\"layout_preview\"]\n layout = Conf.layouts[params[\"layout_preview\"]]\n # Skins on resources\n elsif contributable && contributable.contribution && contributable.contribu... | [
"0.68360704",
"0.68346846",
"0.6634237",
"0.6630903",
"0.6449148",
"0.62766546",
"0.6205794",
"0.6141227",
"0.61394477",
"0.61388487",
"0.6134996",
"0.6134262",
"0.6133886",
"0.613165",
"0.612362",
"0.6081673",
"0.60788095",
"0.60788095",
"0.6077229",
"0.60133034",
"0.5984944... | 0.60888517 | 15 |
Do singleton expansion on the layout argument as well Treated differently since layout is not always specified | def prep_layout_args(layout_args, expand_by: 1)
unless layout_args.respond_to?(:each)
layout_args = [layout_args] * expand_by
end
layout_args || []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout=(_arg0); end",
"def _layout(*_arg0); end",
"def layouts=(_arg0); end",
"def layouts=(_arg0); end",
"def layout(name)\n $stderr.puts \"Overwriting Layout: #{self.class.def_layout.inspect} with #{name}\"\n @_layout = name\n end",
"def _implied_layout_name; end",
"def layout(name=:layout, &... | [
"0.7144845",
"0.6958299",
"0.6557373",
"0.6557373",
"0.61514217",
"0.60879487",
"0.603812",
"0.58996063",
"0.5899588",
"0.58611",
"0.57894075",
"0.5712203",
"0.56614596",
"0.5648441",
"0.56446177",
"0.5644138",
"0.56434155",
"0.56402713",
"0.5627016",
"0.5623294",
"0.55639523... | 0.6182912 | 4 |
For each parameter/attribute foo we try to invoke a validate_foo | def validate
self.class.parameters.each do |param, default|
method = "validate_#{param}"
if self.respond_to? method
attribute = "@#{param}"
val = instance_variable_get(attribute)
if val.respond_to? :each
new_val = val.map.with_index{ |v, i| send(method, v, i) }
instance_variable_set(attribute, new_val)
else
instance_variable_set(attribute, send(method, val))
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_params\n validate_size\n validate_mine_density\n validate_first_click\n type_specific_checks\n end",
"def validate_command_attrs\n self.class.validation_logics.each do |attr, logics|\n val = self.instance_variable_get(\"@#{attr}\".to_sym)\n logics.each do |l|\n ... | [
"0.6917412",
"0.6889291",
"0.6879437",
"0.67552453",
"0.6426025",
"0.63697535",
"0.63275874",
"0.63139665",
"0.6313552",
"0.6290666",
"0.6276874",
"0.6274135",
"0.624592",
"0.618856",
"0.616144",
"0.6161068",
"0.6160548",
"0.6153382",
"0.6152803",
"0.6128364",
"0.61013705",
... | 0.7319916 | 0 |
Access an individual arg for a given card | def [](i)
card_arg = OpenStruct.new
self.class.expanding_parameters.each do |p|
p_val = instance_variable_get("@#{p}")
card_arg[p] = p_val[i]
end
card_arg
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argument(args)\n args.first\n end",
"def arg(arg)\n self[arg]\n end",
"def arg(name)\n args = elements[\"arguments\"]\n args.each do |arg|\n arg_name = arg.elements[\"name\"].text\n if arg_name == name\n return arg.elements[\"value\"].tex... | [
"0.6561551",
"0.6478994",
"0.61619395",
"0.613372",
"0.61166245",
"0.60244906",
"0.5936663",
"0.58914363",
"0.5890595",
"0.5808551",
"0.5801407",
"0.5786349",
"0.57824296",
"0.57738525",
"0.57738525",
"0.57697713",
"0.5732909",
"0.57252127",
"0.5689736",
"0.5675328",
"0.56634... | 0.5902008 | 7 |
Return the deck's configuration | def deck_conf
@deck.conf
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config\n @options[:config]\n end",
"def config\n configuration\n end",
"def config\r\n @configuration\r\n end",
"def configuration\n Configuration::get\n end",
"def configuration\n Configuration::get\n end",
"def get_config\n\t\tend",
"def get_act... | [
"0.692501",
"0.68117595",
"0.67992246",
"0.6711172",
"0.6711172",
"0.67032176",
"0.66439056",
"0.66324276",
"0.6619618",
"0.6603068",
"0.6548771",
"0.65445405",
"0.65445405",
"0.65445405",
"0.65445405",
"0.65445405",
"0.65445405",
"0.64680886",
"0.6447232",
"0.6406319",
"0.63... | 0.8935062 | 0 |
NOTE : I think this api is very badly designed. 1. parameter : giving 'id' parameter will filter by chat id. so instead of 'id' it should use 'chat_id' to make it more clear 2. response : I would probably return list and does group_by on the client side, or I would create another end point that returns grouped_by results. | def index
list = current_user.chats.pluck :id
options = filter_params
options[:id] = filter_params[:id] == 'all' ? list : [filter_params[:id]]
@messages = ChatMessage.filter options
@messages = @messages.group_by(&:chat_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groupchats\n @groupchat = []\n @group_comments = GroupComment.all\n @group_comments.each { |comment|\n if (comment.studygroup_id == group_comment_params[:studygroup_id].to_f)\n @groupchat.push(comment)\n end\n }\n render json: @groupchat\n end",
"def get_group_chat\n\t \tp\"-... | [
"0.70226955",
"0.6886226",
"0.6831614",
"0.62992144",
"0.6281334",
"0.6204657",
"0.62001276",
"0.6123886",
"0.60300833",
"0.5910145",
"0.5904673",
"0.5839655",
"0.5807279",
"0.57862145",
"0.5782848",
"0.57684755",
"0.5758375",
"0.5756378",
"0.5749425",
"0.5695322",
"0.5617327... | 0.70540565 | 0 |
shop Get simple product info | def products(first:, query:)
GQLi::DSL.query{
products(first: first, query: query) {
edges {
node {
productType
title
id
}
}
}
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_info\n params['productinfo']\n end",
"def get_product_info\n @client.call(self.class, __callee__.to_s, @call_params)\n end",
"def product_info\n params['productinfo']\n end",
"def product\n nic_view.product\n end",
"def product(name)\n... | [
"0.7456484",
"0.739109",
"0.7381952",
"0.72075814",
"0.71228164",
"0.7064285",
"0.70357746",
"0.6923677",
"0.68974096",
"0.6881719",
"0.68675363",
"0.6842657",
"0.68301547",
"0.6789462",
"0.6777969",
"0.6776377",
"0.6770001",
"0.6755967",
"0.67533505",
"0.67500466",
"0.672973... | 0.0 | -1 |
Merge `s` and `t` the brute force way (nonrecursive, no edgemerge) | def merge_states(glts, s, t)
data = STATE_AGGREGATOR.merge(s.data, t.data)
# reconnect `t`'s edges to s
t.in_edges.each do |in_edge|
source = (in_edge.source == t ? s : in_edge.source)
glts.connect(source, s, in_edge.data)
end
t.out_edges.each do |out_edge|
target = (out_edge.target == t ? s : out_edge.target)
glts.connect(s, target, out_edge.data)
end
# drop `t` and mark `s` as its representor
glts.drop_state(t)
t[:representor] = s
# set new marks on s
data.each_pair{|k,v| s[k] = v}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def growEqualityGraph(s_vertices, t_vertices, s_neighbors, s_neighbors_not_in_t) #weights, s_vertices, t_vertices, s_neighbors_not_in_t, s_neighbors)\n\t\t\n\t\t#update labels\n\t\t\n\t\t\n\t\tlabelUpdateVal = nil\n\t\t\n\t\t#We want to grow T in order to up the chance we can have a match\n\t\t\n\t\tunconnected_y_... | [
"0.5686777",
"0.54360306",
"0.53057736",
"0.52859104",
"0.5245384",
"0.5243138",
"0.52025",
"0.5177024",
"0.5161093",
"0.5135283",
"0.51323295",
"0.50953436",
"0.50946754",
"0.50888425",
"0.5086928",
"0.5063346",
"0.50549257",
"0.5026138",
"0.5018362",
"0.50092363",
"0.500242... | 0.701275 | 0 |
GET /guest_books GET /guest_books.xml | def index
@guest_books = GuestBook.find(:all, :order=>'created_at desc')
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @guest_books }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @guest_book = GuestBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @guest_book }\n end\n end",
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml... | [
"0.7130327",
"0.68204415",
"0.68204415",
"0.6807553",
"0.67116266",
"0.6677689",
"0.66416866",
"0.65895504",
"0.65624106",
"0.65172786",
"0.65131605",
"0.65096414",
"0.65096414",
"0.65096414",
"0.65096414",
"0.65096414",
"0.65096414",
"0.65096414",
"0.65096414",
"0.6451227",
... | 0.7318075 | 0 |
GET /guest_books/1 GET /guest_books/1.xml | def show
@guest_book = GuestBook.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @guest_book }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @guest_books = GuestBook.find(:all, :order=>'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @guest_books }\n end\n end",
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.ht... | [
"0.7145942",
"0.67945766",
"0.67945766",
"0.66933763",
"0.6691467",
"0.6650903",
"0.66507",
"0.66507",
"0.66507",
"0.66507",
"0.66507",
"0.66507",
"0.66507",
"0.66507",
"0.66215044",
"0.6621058",
"0.65922284",
"0.65820754",
"0.64961845",
"0.649307",
"0.6476968",
"0.6428486"... | 0.7091885 | 1 |
GET /guest_books/new GET /guest_books/new.xml | def new
@guest_book = GuestBook.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @guest_book }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @book = Book.new :copies => 1\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n... | [
"0.7646644",
"0.75112015",
"0.74705714",
"0.7469237",
"0.7469237",
"0.7469237",
"0.7469237",
"0.7469237",
"0.7469237",
"0.7469237",
"0.7469237",
"0.7461468",
"0.7283416",
"0.7281681",
"0.7173729",
"0.7120703",
"0.7113117",
"0.7088467",
"0.7078703",
"0.7078703",
"0.70169955",
... | 0.7656112 | 0 |
POST /guest_books POST /guest_books.xml | def create
@guest_book = GuestBook.new(params[:guest_book])
respond_to do |format|
if @guest_book.save
flash[:notice] = 'Thank you for signing the guestbook'
# format.html { redirect_to(@guest_book) }
format.html { render :action => "created" }
format.xml { render :xml => @guest_book, :status => :created, :location => @guest_book }
else
flash[:notice] = @guest_book.errors[:name] || @guest_book.errors[:comment]
flash[:notice] = @guest_book.errors[:name] + '<br/>'+ @guest_book.errors[:comment] if @guest_book.errors[:name] && @guest_book.errors[:comment]
format.html { render :action => "new" }
format.xml { render :xml => @guest_book.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @guest_book = GuestBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @guest_book }\n end\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <na... | [
"0.6128191",
"0.5912338",
"0.58980846",
"0.5892739",
"0.5871913",
"0.5871913",
"0.5859612",
"0.5838711",
"0.5838711",
"0.5838711",
"0.57950014",
"0.57874006",
"0.57766145",
"0.57479924",
"0.572443",
"0.57202256",
"0.56504256",
"0.56315106",
"0.562869",
"0.5608863",
"0.560264"... | 0.5929783 | 1 |
PUT /guest_books/1 PUT /guest_books/1.xml | def update
@guest_book = GuestBook.find(params[:id])
respond_to do |format|
if @guest_book.update_attributes(params[:guest_book])
flash[:notice] = 'GuestBook was successfully updated.'
format.html { redirect_to(@guest_book) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @guest_book.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n #expire_page :controller => 'guestbook', :action => 'index'\n @guestbook = Guestbook.find(params[:id])\n\n respond_to do |format|\n if @guestbook.update_attributes(params[:guestbook])\n flash[:notice] = 'Guestbook was successfully updated.'\n format.html { redirect_to admin... | [
"0.6542057",
"0.6459722",
"0.6334024",
"0.62971467",
"0.6255734",
"0.6221573",
"0.620879",
"0.620879",
"0.620879",
"0.620879",
"0.620857",
"0.61897933",
"0.61847293",
"0.61847293",
"0.61847293",
"0.61836815",
"0.615289",
"0.6137634",
"0.6111244",
"0.6051023",
"0.6038135",
"... | 0.68086034 | 0 |
DELETE /guest_books/1 DELETE /guest_books/1.xml | def destroy
@guest_book = GuestBook.find(params[:id])
@guest_book.destroy
respond_to do |format|
format.html { redirect_to(guest_books_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n #expire_page :controller => 'guestbook', :action => 'index'\n @guestbook = Guestbook.find(params[:id])\n @guestbook.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_guestbooks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Boo... | [
"0.69296926",
"0.68356967",
"0.6834604",
"0.679162",
"0.679162",
"0.679162",
"0.679162",
"0.679162",
"0.679162",
"0.679162",
"0.679162",
"0.679162",
"0.679162",
"0.67577416",
"0.67310137",
"0.6678191",
"0.66632473",
"0.665211",
"0.6614338",
"0.6597356",
"0.659321",
"0.65827... | 0.7215945 | 0 |
Structure to define a slot data type Initialize an empty Linked list | def initialize size = nil, node = nil
@count = 0
@size = size
if node == nil
@head = nil
@tail = nil
else
@head = node
current = @head
until current == nil
if current.next == nil
@tail = current
end
current = current.next
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize( type, slot_names = [] )\n super( type, nil )\n @slots = Struct::new( *slot_names )\n end",
"def initialize\n @Node = Struct.new(:value, :next, :prev)\n\t\t@head = nil\n @tail = nil\n end",
"def initialize:\n\t\t@slots = []",
"def ll_create()\n return Lin... | [
"0.6636881",
"0.65847456",
"0.6563254",
"0.65473515",
"0.63853115",
"0.63545996",
"0.63524306",
"0.6297186",
"0.62348884",
"0.62249285",
"0.62211335",
"0.6212109",
"0.62022144",
"0.618217",
"0.61510986",
"0.61430466",
"0.61255974",
"0.610065",
"0.60947675",
"0.60449463",
"0.6... | 0.5695468 | 46 |
Empties the linked list | def purge
@head = nil
@tail = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear\n @head = nil\n @tail = nil\n @size = 0\n end",
"def clear\n @count = 0\n @head = nil\n end",
"def ll_clear()\n @head = nil\n @tail = nil\n @num_nodes = 0\n end",
"def clear!()\n @list = nil\n end",
"def clear\n @count = 0\n @head = nil\n @tail = n... | [
"0.80298406",
"0.79677796",
"0.79407054",
"0.7905829",
"0.7834023",
"0.7678511",
"0.7678511",
"0.7678511",
"0.75932753",
"0.75124",
"0.7496247",
"0.7494362",
"0.74829936",
"0.7481801",
"0.73772174",
"0.72766286",
"0.70821",
"0.702882",
"0.69153404",
"0.68513733",
"0.6825669",... | 0.7192034 | 16 |
Returns boolean value showing if the list is empty or not | def empty?
@head.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty?\n @list.empty?\n end",
"def empty?\n @exact.empty? && @list.empty?\n end",
"def list_empty?\n return (@first_node == nil) ? true : false\n end",
"def is_empty()\n return @items.empty?\n end",
"def empty?\n items.empty?\n end",
"def is_list_empty?... | [
"0.87316144",
"0.8350883",
"0.8275256",
"0.8233929",
"0.8168752",
"0.8137443",
"0.81265754",
"0.8090885",
"0.8085212",
"0.8047825",
"0.80432826",
"0.80249184",
"0.80249184",
"0.8015773",
"0.8015773",
"0.8013243",
"0.7886752",
"0.7885171",
"0.78809917",
"0.78809917",
"0.785711... | 0.0 | -1 |
Returns the first value in the list | def first
raise "ContainerEmpty" if @head.nil?
@head
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first ; list.first ; end",
"def get_first\r\n # if the list is empty, head is nil\r\n if @head.nil?\r\n return nil\r\n else \r\n value = @head.data\r\n return value\r\n end\r\n end",
"def first\n # return value if head node is set\n if !@head.nil?\n @head.value\n e... | [
"0.8601866",
"0.82563496",
"0.7993339",
"0.7919276",
"0.7681563",
"0.7604657",
"0.75434947",
"0.7438292",
"0.7359944",
"0.73226553",
"0.7310861",
"0.7284207",
"0.7283588",
"0.72799796",
"0.72720003",
"0.72666866",
"0.7249353",
"0.72393733",
"0.72123307",
"0.7197424",
"0.71762... | 0.0 | -1 |
Adds a bucket or adds to a current bucket in the list | def prepend(data)
tmp = Node.new(data)
if @head.nil?
@head = tmp
@tail = tmp
else
tmp.next = @head
tmp.previous = nil
@head.previous = tmp
@head = tmp
end
@count += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(bucket, obj)\n @buffer[bucket] << obj\n check_and_write bucket\n end",
"def <<(data)\n @bucket << data\n end",
"def insert_into_bucket(value, bucket)\n @table[bucket] = value\n @count += 1\n maybe_rehash\n end",
"def newBucket\n innerNewBucket \n end",
"def insert(key, valu... | [
"0.7449111",
"0.67313915",
"0.6668624",
"0.64941895",
"0.6390693",
"0.6257429",
"0.6243786",
"0.61360246",
"0.6076158",
"0.6047888",
"0.5952649",
"0.581773",
"0.58048004",
"0.57832724",
"0.5769797",
"0.5769275",
"0.5735761",
"0.5698045",
"0.56950766",
"0.56950766",
"0.5676199... | 0.0 | -1 |
tmp (insert tmp info here) | def append(data)
tmp = Node.new(data)
if @head.nil?
@head = tmp
@tail = tmp
else
@tail.next = tmp
tmp.previous = @tail
tmp.next = nil
@tail = tmp
end
@count += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tempfile; end",
"def tempfile; end",
"def tempfile=(_arg0); end",
"def tmpid\n @tmpid += 1\n end",
"def unique_temp\n \"$TMP_#{@unique += 1}\"\n end",
"def temp(temporary_info, &b)\n set(temporary_info).tap {|x| yield(x)}\n return nil\n end",
"def create_temp_file... | [
"0.636862",
"0.636862",
"0.6351646",
"0.62551546",
"0.6081728",
"0.6079841",
"0.6074794",
"0.6000064",
"0.57399046",
"0.5633629",
"0.5503598",
"0.54559284",
"0.5388588",
"0.5372243",
"0.5354986",
"0.5349896",
"0.53475255",
"0.53410447",
"0.5336444",
"0.52920455",
"0.5273758",... | 0.0 | -1 |
Iterate through the current list and preform actions on the data in a code block | def each
current = @head
while current != nil
yield current.value
current = current.next
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each\n yield :code, code\n yield :data, data\n end",
"def run(list); end",
"def list_block()\n\nend",
"def each(&block)\n list_items.each(&block)\n end",
"def each(&block)\n @@list.each(&block)\n end",
"def each(&block)\n @list.each(&block)\n end",
"def each(&... | [
"0.65318763",
"0.65299255",
"0.65153396",
"0.64114505",
"0.64112264",
"0.63991684",
"0.63103956",
"0.6262771",
"0.6216251",
"0.6216251",
"0.6216251",
"0.6216251",
"0.6216251",
"0.6216251",
"0.6210451",
"0.61492527",
"0.6117508",
"0.6043893",
"0.60214347",
"0.6016033",
"0.5964... | 0.0 | -1 |
depends_on "mariadbconnectorc" depends_on "mariadb" | def headless?
# The GRASS GUI is based on WxPython.
build.without? "gui"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package_depends_on\n depends_on\n end",
"def db_drivers_install\n include_recipe('python::pip')\n case db_uri.scheme\n when 'mysql'\n python_pip \"#{new_resource.name} :install mysql-python\" do\n package_name 'mysql-python'\n virtualenv \"#{home}/.venv\"\n ... | [
"0.6538338",
"0.61060786",
"0.6082869",
"0.55703336",
"0.5541217",
"0.5417765",
"0.53858984",
"0.5370116",
"0.53596795",
"0.5353907",
"0.5353907",
"0.5353907",
"0.53359854",
"0.5286997",
"0.52289766",
"0.5214576",
"0.5201908",
"0.51261705",
"0.50664586",
"0.504025",
"0.503159... | 0.0 | -1 |
get total coins value with this route => host/users/total_coins_value?:user_id=user_id | def total_coins_value
json_response({:total_coins_value => @total_coins_val, :status => true, :message => 'calculated'})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coins\n\t\tres = {}\n\t\tuser = User.find_by_token(params[:token])\n\t\tif user\n\t\t\tres[:status] = \"0\"\n\t\t\tres[:coins] = user.coins\n\t\telse\n\t\t\tres[:status] = \"1\"\n\t\tend\n\t\trender json: res\n\tend",
"def get_coins\n get(\"/getcoins\")\n end",
"def get_total_price\n @us... | [
"0.706636",
"0.6928268",
"0.68818575",
"0.6691343",
"0.6493234",
"0.6493234",
"0.6493234",
"0.6233464",
"0.6137647",
"0.60845786",
"0.606392",
"0.6012118",
"0.6003915",
"0.5997342",
"0.59955025",
"0.5978348",
"0.5960885",
"0.59429586",
"0.59429586",
"0.59429586",
"0.5938953",... | 0.7595399 | 0 |
all transactions => host/users/transactions?:user_id=user_id | def all_transactions
json_response(Transaction.all)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @transactions = User.find(params[:id])\n end",
"def my_transactions\n @transactions = Transaction.find_all_by_user_id(current_user.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end",
"def user_transactions\n ... | [
"0.7789258",
"0.7537575",
"0.7524399",
"0.7456377",
"0.73402137",
"0.73320043",
"0.7164036",
"0.70829487",
"0.6969449",
"0.6963565",
"0.69511896",
"0.6937836",
"0.6931027",
"0.69255805",
"0.69240683",
"0.6914473",
"0.69026566",
"0.69002104",
"0.6893898",
"0.68828654",
"0.6821... | 0.69866735 | 8 |
all transactions for a specific user => host/users/user_transactions?:user_id=user_id | def user_transactions
user_deposits = get_user_deposits
user_withdrawals = get_user_withdrawals
json_response({:user_transactions => @user_transactions, :user_deposits => user_deposits, :user_withdrawals => user_withdrawals})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @transactions = User.find(params[:id])\n end",
"def transactionByUser\n results = HTTParty.get(\"http://192.168.99.101:4050/by_user_id?userid=\" + (@current_user[\"id\"]).to_s)\n render json: results.parsed_response, status: results.code\n end",
"def get_transactions_from_user\n ... | [
"0.76925904",
"0.7555634",
"0.74471265",
"0.73294973",
"0.73018956",
"0.72070515",
"0.7158072",
"0.70532507",
"0.700467",
"0.6913992",
"0.6900689",
"0.6855507",
"0.6834058",
"0.678975",
"0.6669661",
"0.6647189",
"0.66274357",
"0.660833",
"0.65642697",
"0.6545789",
"0.65380245... | 0.7579626 | 1 |
create initialize method w/argument (name) | def initialize(name)
@name = name
@songs = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(name) end",
"def initialize(method_we_pass)\n @name = method_we_pass\n end",
"def initialize(name_arg)\n # Special method\n # Run once as soon as .new is called\n # Can only be run once\n # Most commonly used to set up attributes in\n # instance variables\n @name ... | [
"0.8280406",
"0.8116518",
"0.78391767",
"0.77923006",
"0.7791571",
"0.77379525",
"0.7719833",
"0.76695293",
"0.7610097",
"0.76046085",
"0.7602715",
"0.75754076",
"0.7573078",
"0.75716674",
"0.7561686",
"0.754967",
"0.7541765",
"0.7537914",
"0.7493331",
"0.74833417",
"0.745638... | 0.0 | -1 |
create save instance method | def save
# # - this method will add Song instances to the @@all array
@@all << self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n super save\n end",
"def save\n raise NotImplementedError\n end",
"def save\n raise NotImplementedError\n end",
"def save!\n end",
"def save(*_)\n end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save... | [
"0.7989675",
"0.7985795",
"0.7912072",
"0.78745365",
"0.78223467",
"0.78085816",
"0.78085816",
"0.78085816",
"0.78085816",
"0.78085816",
"0.78085816",
"0.78085816",
"0.78085816",
"0.7787041",
"0.7752724",
"0.7713435",
"0.77077687",
"0.77077687",
"0.7682927",
"0.7673194",
"0.7... | 0.0 | -1 |
Public: returns the string "We're playing tennis!" When the game_play object is named. | def to_s
"We're playing tennis!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_title\n object.game ? object.game.title : 'Не прикреплен ни к одной игре'\n end",
"def game_name\n fetch('sword_art_online.game_name')\n end",
"def game_title\n\t\t\"#{home_team} vs. #{visitor_team}\"\n\tend",
"def play\n \"We're rockiinnggg\"\n end",
"def name\n @game... | [
"0.6862751",
"0.67511",
"0.6732199",
"0.6632266",
"0.6504157",
"0.6503335",
"0.6460288",
"0.63905954",
"0.6358499",
"0.6351518",
"0.63228124",
"0.62906235",
"0.62560695",
"0.6250081",
"0.6248526",
"0.62003005",
"0.6188027",
"0.61837476",
"0.61716276",
"0.6171561",
"0.61649805... | 0.68638587 | 0 |
Internal: This method is called to start a new game. It asks whether the user would like to play a new game. If answer is 'y' it starts a new game. If 'n' it ends the program. returns: "response not understood" if any other response is received. | def new_game
puts "Would you like to play a new game (y or n)?"
answer = gets.chomp.downcase
if answer == 'y'
@player1.points = 0
@player2.points = 0
puts "Player 1 = #{@player1}"
puts "player 2 = #{@player2}"
self.coin_toss_call
elsif answer
puts "Have a nice day."
else
puts "response not understood."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ask_for_start\n puts \"Do you want to start the game? y/n\"\n user_input = Info.get_user_input\n if user_input.downcase == \"y\"\n start_game\n elsif user_input.downcase == \"n\"\n puts \"You said no :(\"\n else\n exit_app\n end\n end",
"def requestNewGame\n print \"Do yo... | [
"0.80085206",
"0.7972854",
"0.7859935",
"0.78385824",
"0.7571109",
"0.73958206",
"0.7366434",
"0.7345739",
"0.7330692",
"0.7211508",
"0.7136359",
"0.71131057",
"0.708612",
"0.70814526",
"0.7075292",
"0.7072899",
"0.70616215",
"0.6993281",
"0.6951044",
"0.6911757",
"0.6907397"... | 0.8022935 | 0 |
Internal: Asks player to call heads or tails, saves response. Calls toss_results if 'heads' or 'tails' is entered. | def coin_toss_call
puts "Please call 'heads' or 'tails'"
call = gets.chomp.downcase
unless call == 'heads' || call == 'tails'
puts "response not understood. Hit 't' to try again."
response = gets.chomp.downcase
if response == "t"
self.coin_toss_call
else
puts "exiting game."
end
else
self.toss_results(call)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toss_results(call)\n\t\t\ttoss = self.cointoss\n\t\t\ttoss_string =\"you called #{call} and the toss returned #{toss}.\"\n\t\t\tif call == toss\n\t\t\t\tputs toss_string\n\t\t\t\tputs \"you won the coin toss.\"\n\t\t\t\tputs \"You get to serve first.\"\n\t\t\t\tputs \" \"\n\t\t\t\tself.hitter2\n\t\t\t\tserver... | [
"0.67123103",
"0.5408612",
"0.5336791",
"0.52342737",
"0.5134752",
"0.5134286",
"0.51317537",
"0.5071834",
"0.5051467",
"0.5015764",
"0.5010839",
"0.500381",
"0.50014025",
"0.49874166",
"0.49859127",
"0.49545282",
"0.49525946",
"0.49507055",
"0.49431372",
"0.49424398",
"0.491... | 0.80080867 | 0 |
tossresults takes a call as argument passes it to the results of a call to the cointoss method then determines a winner of the toss | def toss_results(call)
toss = self.cointoss
toss_string ="you called #{call} and the toss returned #{toss}."
if call == toss
puts toss_string
puts "you won the coin toss."
puts "You get to serve first."
puts " "
self.hitter2
server(@player1)
elsif call != toss
puts toss_string
puts "you lost the coin toss."
puts "#{@player2} will serve first."
puts " "
self.hitter1
server(@player2)
else
"error"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_results(user, comp)\n if winner(user, comp)\n say 'You won that round!'\n elsif winner(comp, user)\n say 'The computer won that round..'\n else\n say 'That round was a TIE'\n end\nend",
"def analyze_results(player, computer)\r\n\r\n #Analyze the results of the game when the player select... | [
"0.6516848",
"0.6256644",
"0.6205345",
"0.6134353",
"0.6016133",
"0.5972003",
"0.5965531",
"0.5914879",
"0.5911554",
"0.5842381",
"0.5840176",
"0.5772151",
"0.5756688",
"0.5730377",
"0.5724547",
"0.5692705",
"0.5671264",
"0.56522644",
"0.56475145",
"0.56439996",
"0.56365323",... | 0.7867938 | 0 |
cointoss generates a random number between 1 and 10 and saves it in the 'number' variable. If the number generated is less than or equal to five the method returns "heads". If the random number is greater than 5 coin toss returns "tails." | def cointoss
number = rand(1..10)
return "heads" if number <= 5
return "tails" if number > 5
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coin_toss\n toss = SecureRandom.random_number(2)\n if toss == 0\n HEADS_VALUE\n else\n TAILS_VALUE\n end\n end",
"def coin_flip\n return (rand(1..2) == 1 ? \"HEADS\" : \"TAILS\")\nend",
"def coin_toss_call\n\t\t\tputs \"Please call 'heads' or 'tails'\"\n\t\t\tcall = ... | [
"0.6919821",
"0.58450276",
"0.5837084",
"0.56994927",
"0.56777275",
"0.56684595",
"0.56553215",
"0.5587411",
"0.5582435",
"0.55771285",
"0.5561587",
"0.5529225",
"0.5519647",
"0.5518868",
"0.55127317",
"0.5430425",
"0.5427462",
"0.542739",
"0.5426693",
"0.5407493",
"0.5407493... | 0.8020386 | 0 |
game action uses a random number to determine the result of ball serves. a random number between 5 and 15 is set as a net ball meaning the ball is stopped by the net and does not make it to the other court | def game_action(num)
net_ball = rand(5..15)
return "net" if num == net_ball
return "oob" if num <= 3
return "hit" if num > 3 && num <=17
return "miss" if num > 17
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rally\n\t\t\tnum = rand(1..20)\n\t\t\trally_case = game_action(num)\n\t\t\tcase rally_case\n\t\t\t\twhen \"oob\" \n\t\t\t\t\tputs \"oo-oo-oo-oo-oo #{$hitter} hit the ball out of bounds oo-oo-oo-oo-oo\"\n\t\t\t\t\t@current_game.wins_ball($def_num)\n\t\t\t\t\tself.game_stats\n\t\t\t\t\n\t\t\t\twhen \"miss\"\n\t\... | [
"0.71782994",
"0.6828066",
"0.67948586",
"0.6782375",
"0.6745367",
"0.67412096",
"0.670572",
"0.67025584",
"0.67007613",
"0.665206",
"0.6651955",
"0.66195554",
"0.6604901",
"0.66048497",
"0.6602807",
"0.6588497",
"0.6579324",
"0.65771365",
"0.657554",
"0.6574815",
"0.6571189"... | 0.7099683 | 1 |
This method switches which player is the hitter and which is returning the ball Once a player hits the ball they become the "hitter" and the other player becomes the defender. It also associates player number with "hitter" and "defender" so that the score can be tracked. | def hitter(hitter)
if $hitter == @player1
self.hitter1
self.rally
else
self.hitter2
self.rally
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def judge_winner\n\t\tif attacker.army.all_curr_hp.zero?\n\t\t\tresult.winner = defender\n\t\t\twinner = defender\n\t\telsif defender.army.all_curr_hp.zero?\n\t\t\tresult.winner = attacker\n\t\t\twinner = defender\n\t\tend\n\tend",
"def winning_team_with_spread\n\t\tif self.final?\n\t\t\treturn home_team_id if h... | [
"0.65078837",
"0.64507174",
"0.6429378",
"0.63456154",
"0.6292119",
"0.6283494",
"0.6274708",
"0.61308235",
"0.6123053",
"0.6045784",
"0.60281605",
"0.60231036",
"0.6021796",
"0.60000515",
"0.59720653",
"0.58996475",
"0.5868824",
"0.5859486",
"0.5857962",
"0.5850558",
"0.5818... | 0.72063625 | 0 |
This method sets the first server of a new game. It sets it to which ever player is passed to it. | def server(player)
$server = player
new_serve($server)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_server\n @gameserver = Gameserver.find(params[:id])\n end",
"def set_server\n @gameserver = Gameserver.find(params[:id])\n end",
"def switch_serve(server)\n\t\t\tif @current_game.check_status == \"#{@player1} wins\" || @current_game.check_status == \"#{@player2} wins\"\n\t\t\t\tself.ne... | [
"0.7125115",
"0.7125115",
"0.69596666",
"0.6821455",
"0.65557635",
"0.63090545",
"0.6280265",
"0.6236844",
"0.622349",
"0.61704874",
"0.6149852",
"0.6149852",
"0.6149852",
"0.6149852",
"0.6149852",
"0.6144412",
"0.61117446",
"0.609233",
"0.6082096",
"0.6056288",
"0.60317826",... | 0.6428113 | 5 |
This method initiates a new serve and calls the rally method. | def new_serve(server)
puts " "
puts ">>>>>>>>>>>>> #{$hitter} serves the ball >>>>>>>>>>>>>>>"
puts "hit any letter to continue 'q' to quit."
puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
result = gets.chomp.downcase
if result == 'q'
puts "exiting game"
else
self.rally
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_new_toy\n @main_view.setup_for_new\n @id = rand(2**60).to_s\n end",
"def set_rally\n @rally = Rally.find(params[:id])\n end",
"def run\n client.run\n end",
"def run\n make_request(@path)\n end",
"def begin!\n start_server\n end",
"def create\n seth_se... | [
"0.5527765",
"0.5481547",
"0.54634446",
"0.5459039",
"0.5353314",
"0.53342146",
"0.5328975",
"0.5328817",
"0.53245336",
"0.5315245",
"0.5313844",
"0.52707726",
"0.5255495",
"0.52460724",
"0.52460724",
"0.52460724",
"0.52460724",
"0.52460724",
"0.52460724",
"0.52460724",
"0.52... | 0.5810025 | 0 |
This method alternates which player is the server and then passes the new server to the new_serve method. | def switch_serve(server)
if @current_game.check_status == "#{@player1} wins" || @current_game.check_status == "#{@player2} wins"
self.new_game
else
if $server == @player1
$server = @player2
self.hitter1
else
$server = @player1
self.hitter2
end
new_serve($server)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server(player)\n\t\t\t$server = player\n\t\t\tnew_serve($server)\n\t\tend",
"def switch_server\n self.connection = nil\n servers << servers.shift\n end",
"def accept_player_connection\n new_connection = @ref_server.accept\n\n #NOTE if players are taking a long time to respond here, other... | [
"0.77768034",
"0.6474637",
"0.61794686",
"0.61417204",
"0.6033821",
"0.59365153",
"0.5920103",
"0.5831099",
"0.5831099",
"0.58268505",
"0.58268505",
"0.58103096",
"0.57869613",
"0.5733789",
"0.57077223",
"0.5697381",
"0.569682",
"0.5689727",
"0.56782115",
"0.56400853",
"0.563... | 0.7631063 | 1 |
This is the main action of the game rally calls the game_action method to determine what has happened to the ball then it uses a case statement to return results and pick next actions | def rally
num = rand(1..20)
rally_case = game_action(num)
case rally_case
when "oob"
puts "oo-oo-oo-oo-oo #{$hitter} hit the ball out of bounds oo-oo-oo-oo-oo"
@current_game.wins_ball($def_num)
self.game_stats
when "miss"
puts "mmmmmmm #{$defender} missed the ball! mmmmmmmmmm"
@current_game.wins_ball($hit_num)
self.game_stats
when "net"
puts "############ #{$hitter} hit the net. ############"
@current_game.wins_ball($def_num)
self.game_stats
when "hit"
puts "^o^o^o^o^o^ #{$defender} returns the ball ^o^o^o^o^o^"
puts " "
hitter($hitter)
else
puts "#{rally} Error!!!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_action snapshot\n # HERE GOES YOUR ALGORITHM. \n\n puts\n puts \"------VIRTUAL PLAYER DATA--------\"\n puts \"v-player: NAME #{name}\"\n puts \"v-player: CARDS #{cards}\"\n puts \"v-player: REMAINING MONEY #{remaining_money}\"\n puts \"last_round_actions: #{s... | [
"0.6867743",
"0.6645535",
"0.6621035",
"0.65957445",
"0.65756154",
"0.64657813",
"0.6455764",
"0.6415749",
"0.6398253",
"0.63843673",
"0.6367002",
"0.63352346",
"0.63307863",
"0.6293095",
"0.62886244",
"0.62862873",
"0.62676406",
"0.6263425",
"0.62470925",
"0.62146115",
"0.62... | 0.73228633 | 0 |
Gets Users with this Role | def users
res = []
url = data['links']['roleUsers']
tmp = GoodData.get url
tmp['associatedUsers']['users'].each do |user_url|
user = GoodData.get user_url
res << GoodData::Profile.new(user)
end
res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users\n Section.find_roles.pluck(:name).inject(Array.new) do |result, role|\n result += User.with_role(role, self)\n end.uniq\n end",
"def users\n raise \"No users are defined\" unless user_role.users.count.positive?\n user_role.users\n end",
"def get_users_for_role(name)\n model.mo... | [
"0.7697814",
"0.7667286",
"0.7579331",
"0.75245464",
"0.7372875",
"0.72298515",
"0.7068127",
"0.7026046",
"0.7004831",
"0.6989114",
"0.6965952",
"0.69391215",
"0.69123197",
"0.68971854",
"0.6852038",
"0.6780662",
"0.6744539",
"0.6683225",
"0.6651151",
"0.664459",
"0.6644146",... | 0.69861645 | 10 |
Gets Raw object URI | def uri
@json['projectRole']['links']['roleUsers'].split('/')[0...-1].join('/')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect\n \"#<#{self.class}:#{object_id.to_s(16)} #{uri.inspect}>\"\n end",
"def uri_path\n __getobj__.uri.path\n end",
"def inspect\n sprintf(\"#<%s:%#0x URI:%s>\", URI.to_s, self.object_id, self.to_s)\n end",
"def get_uri\n request_object.uri\n end",
"def uri\n @uri.t... | [
"0.73999745",
"0.7288623",
"0.72109306",
"0.70737845",
"0.70008725",
"0.69677436",
"0.69550145",
"0.6935451",
"0.6885552",
"0.68723226",
"0.6821024",
"0.67758477",
"0.6760201",
"0.6759313",
"0.6754634",
"0.6754634",
"0.6754308",
"0.6754308",
"0.6742472",
"0.6722275",
"0.67222... | 0.0 | -1 |
Returns the host. If a value is defined by both an option and the config file, the value of the option is used. | def host
# find host in opts first
host = options[:host] || @configuration['host']
host = 'http://api.unipept.ugent.be' if host.nil? || host.empty?
# add http:// if needed
if host.start_with?('http://', 'https://')
host
else
"http://#{host}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host\n @options[:host]\n end",
"def hostname\n @options[:host][:name] if @options[:host]\n end",
"def hostname\n options[:hostname]\n end",
"def host\n @host ||= opts.fetch(:host, parsed_uri.host)\n end",
"def host\n @host ||= target.split(':',2).first\n ... | [
"0.74869543",
"0.72083825",
"0.70229775",
"0.6984973",
"0.6845317",
"0.6825127",
"0.67840314",
"0.65790135",
"0.65482223",
"0.64916515",
"0.6469601",
"0.6451306",
"0.6443154",
"0.6441445",
"0.6373763",
"0.63515043",
"0.63320196",
"0.63320196",
"0.63258517",
"0.63258517",
"0.6... | 0.6800249 | 6 |
Returns an input iterator to use for the request. if arguments are given, uses arguments if the input file option is given, uses file input if none of the previous are given, uses stdin | def input_iterator
return arguments.each unless arguments.empty?
return File.foreach(options[:input]) if options[:input]
$stdin.each_line
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_stream(options)\n options[:file].nil? ?\n $stdin :\n open(File.expand_path(options[:file]))\nend",
"def process_inputs(args)\n @input = ((name = args[:in_file]) && (IO.read(name, mode: \"rb\"))) ||\n args[:in_str] ||\n fail(\"An... | [
"0.6686894",
"0.66236067",
"0.6605015",
"0.6336927",
"0.62568593",
"0.62260014",
"0.61801213",
"0.6156044",
"0.6133542",
"0.6084084",
"0.6084084",
"0.60715115",
"0.60430545",
"0.6014799",
"0.601269",
"0.601269",
"0.5988913",
"0.59886664",
"0.59488773",
"0.5926221",
"0.5904913... | 0.842547 | 0 |
Returns the default default_batch_size of a command. | def default_batch_size
raise NotImplementedError, 'This must be implemented in a subclass.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_size\n if options[:batch]\n options[:batch].to_i\n else\n default_batch_size\n end\n end",
"def get_batch_size\n if @options[:limit] > 0 && @options[:batch_size]\n rest < @options[:batch_size] ? rest : @options[:batch_size]\n else @options[:batch_size]\n... | [
"0.71441257",
"0.68832207",
"0.6735431",
"0.6720366",
"0.6215067",
"0.6164288",
"0.61455417",
"0.60646504",
"0.5996299",
"0.5949705",
"0.581246",
"0.5770261",
"0.565737",
"0.55842865",
"0.55501163",
"0.55258423",
"0.5452814",
"0.5333686",
"0.532593",
"0.53223276",
"0.5283142"... | 0.74167126 | 0 |
returns the effective batch_size of a command | def batch_size
if options[:batch]
options[:batch].to_i
else
default_batch_size
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_batch_size\n\t\tdatastore['BATCHSIZE'].to_i\n\tend",
"def get_batch_size\n if @options[:limit] > 0 && @options[:batch_size]\n rest < @options[:batch_size] ? rest : @options[:batch_size]\n else @options[:batch_size]\n @options[:batch_size]\n end\n end",
"def batch_size\n ... | [
"0.6884615",
"0.68340075",
"0.68056166",
"0.6704901",
"0.66717595",
"0.6262663",
"0.59965837",
"0.58802134",
"0.58296955",
"0.5822657",
"0.57918453",
"0.5785271",
"0.576993",
"0.5766231",
"0.5751917",
"0.57449234",
"0.5742205",
"0.5738303",
"0.5697127",
"0.569474",
"0.5692438... | 0.68786407 | 1 |
returns the required fields to do any mapping | def required_fields
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def required_fields\n required_fields = []\n ignore_fields = [:id, :date_entered, :date_modified]\n self.fields.each_value do |field|\n next if ignore_fields.include? field[\"name\"].to_sym\n required_fields << field[\"name\"].to_sym if field[\"required\"] == 1\n end \n requi... | [
"0.7370009",
"0.7370009",
"0.7227165",
"0.71752965",
"0.71752965",
"0.71752965",
"0.69465774",
"0.68232954",
"0.68232954",
"0.6773221",
"0.676606",
"0.6764183",
"0.6761396",
"0.6707797",
"0.67027116",
"0.67027116",
"0.6683575",
"0.6683575",
"0.6683575",
"0.6683575",
"0.668357... | 0.69336057 | 7 |
Returns a new batch_iterator based on the batch_size | def batch_iterator
Unipept::BatchIterator.new(batch_size)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batches(batch_size:, cursor:)\n @csv.lazy\n .each_slice(batch_size)\n .with_index\n .drop(count_of_processed_rows(cursor))\n .to_enum { (count_of_rows_in_file.to_f / batch_size).ceil }\n end",
"def in_batches(of: DEFAULT_BATCH_SIZE, &block)\n per_page = of\n\n ... | [
"0.63759923",
"0.6204015",
"0.6114403",
"0.59071976",
"0.5832074",
"0.5815702",
"0.57909197",
"0.57320005",
"0.57122004",
"0.5698831",
"0.56500286",
"0.5577306",
"0.5412376",
"0.537969",
"0.53696537",
"0.533266",
"0.53314716",
"0.52766865",
"0.5242842",
"0.52294457",
"0.51955... | 0.73165506 | 0 |
Returns an array of regular expressions containing all the selected fields | def selected_fields
return @selected_fields unless @selected_fields.nil?
fields = [*options[:select]].map { |f| f.split(',') }.flatten
fields.concat(required_fields) if @fasta && !fields.empty?
@selected_fields = fields.map { |f| glob_to_regex(f) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def possible_regexes(w)\n possible = []\n w_as_regex = escape_regex(w)\n\n # Here we specify many different functions that generate regex criterias,\n #\n # For example, /\\$10/ and /\\$[0-9]+/ for $10\n possible << w_as_regex\n possible << w_as_regex.gsub(/[0-9]/, \"[0-9]+\")\n\... | [
"0.6468004",
"0.633093",
"0.62629044",
"0.6211319",
"0.6053983",
"0.6046699",
"0.59120476",
"0.5631322",
"0.55165964",
"0.5467334",
"0.54167783",
"0.5396006",
"0.5387249",
"0.5383706",
"0.538021",
"0.5375666",
"0.53514737",
"0.53140116",
"0.5287678",
"0.52858543",
"0.52796036... | 0.71189165 | 0 |
Returns a formatter, based on the format specified in the options | def formatter
@formatter ||= Unipept::Formatter.new_for_format(options[:format])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_format(formatter_klass, options={})\n formatter_klass.new(self, options).output\n end",
"def format(formatter = self.class.formatter, **options)\n formatter.format(self, options)\n end",
"def formatter fmt\n @formatter = fmt\n end",
"def formatter\n @formatter ||= Formatters::Default.... | [
"0.71300334",
"0.71230537",
"0.706918",
"0.7065986",
"0.7020982",
"0.6900602",
"0.68292946",
"0.68029535",
"0.67695177",
"0.669708",
"0.6608481",
"0.65708154",
"0.65409714",
"0.6531597",
"0.65250045",
"0.6425825",
"0.64107114",
"0.64105326",
"0.64081585",
"0.6390247",
"0.6363... | 0.79420877 | 0 |
Constructs a request body (a Hash) for set of input strings, using the options supplied by the user. | def construct_request_body(input)
names = selected_fields.empty? || selected_fields.any? { |f| f.to_s.include?('name') || f.to_s.include?('.*$') }
{ input: input,
equate_il: options[:equate] == true,
extra: options[:all] == true,
names: options[:all] == true && names }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(options = {})\n options.each do |k,v|\n k = k.to_s\n unless k.match(/^body_/)\n self.send(\"#{k}=\", v)\n else\n k.gsub!(\"body_\", \"\")\n self.body(k, v)\n end\n end\n end",
"def make_request_body(opts, headers)\n case\n when opts.body\n ... | [
"0.65530926",
"0.6464858",
"0.63408285",
"0.6313061",
"0.63088036",
"0.6243186",
"0.6243186",
"0.6243186",
"0.6243186",
"0.6209404",
"0.6172065",
"0.61426836",
"0.60170084",
"0.6007852",
"0.5964315",
"0.59277284",
"0.5924487",
"0.5861653",
"0.57572794",
"0.57408476",
"0.55986... | 0.74869096 | 0 |
Saves an error to a new file in the .unipept directory in the users home directory. | def save_error(message)
path = error_file_path
FileUtils.mkdir_p File.dirname(path)
File.write(path, message)
warn "API request failed! log can be found in #{path}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_error_report_to_file(text)\n File.open(\"errorfile\", \"a\") do |er|\n er.write \"#{text}\"\n end\nend",
"def write_error_report_to_file(text)\n File.open(\"errorfile\", \"a\") do |er|\n er.write \"#{text}\"\n end\nend",
"def map_error_output(filename)\r\n\tDir.mkdir(\"#{settings.ro... | [
"0.64753145",
"0.64753145",
"0.6455628",
"0.63397366",
"0.6173027",
"0.5959358",
"0.5893266",
"0.57447356",
"0.56342256",
"0.55946857",
"0.5589954",
"0.55641836",
"0.55584353",
"0.5557607",
"0.55516434",
"0.5497772",
"0.5475988",
"0.5469417",
"0.5432468",
"0.5428971",
"0.5419... | 0.7041508 | 0 |
Handles the response of an API request. Returns a block to execute. | def handle_response(response, batch_id, fasta_mapper)
if response.success?
handle_success_response(response, batch_id, fasta_mapper)
else
handle_failed_response(response)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_request( request, &block )\n\t\tif block\n\t\t\treturn block.call( request )\n\t\telse\n\t\t\treturn request.response\n\t\tend\n\tend",
"def handle_response(res)\n # relogin if needed\n return relogin if should_relogin(res)\n\n check_unauthorized(res.status, res.env.url.to_s)\n che... | [
"0.7089614",
"0.7012649",
"0.693048",
"0.6780333",
"0.6780333",
"0.6727984",
"0.6727984",
"0.65639824",
"0.6550508",
"0.6539349",
"0.65276676",
"0.6524476",
"0.65066767",
"0.6505523",
"0.6483936",
"0.6462054",
"0.64357233",
"0.64109075",
"0.63818467",
"0.63812387",
"0.6370618... | 0.58150214 | 71 |
Parses the json_response, wraps it in an array if needed and filters the fields based on the selected_fields | def filter_result(json_response)
result = JSON[json_response] rescue []
result = [result] unless result.is_a? Array
key_order = result.first.keys if result.first
result = flatten_functional_fields(result) if formatter.instance_of?(Unipept::CSVFormatter)
result.map! { |r| r.select! { |k, _v| selected_fields.any? { |f| f.match k } } } unless selected_fields.empty?
result = inflate_functional_fields(result, key_order) if formatter.instance_of?(Unipept::CSVFormatter) && result.first
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_response(response)\n JSON.parse(response)\n end",
"def setup_response(response)\n response = response.values if unprocessable_hash?(response)\n Array([response]).flatten\n end",
"def extract_data_from_response(response)\n if response.nil?\n return []\n ... | [
"0.6037001",
"0.5941196",
"0.59008944",
"0.5856639",
"0.5730038",
"0.56695974",
"0.5620536",
"0.55746675",
"0.5550236",
"0.55334204",
"0.5521257",
"0.5499812",
"0.54981154",
"0.54705095",
"0.54559356",
"0.543158",
"0.542495",
"0.5424",
"0.5383765",
"0.537878",
"0.53630066",
... | 0.7519475 | 0 |
Transforms a flattened input created by flatten_functional_fields to the original hierarchy. | def inflate_functional_fields(data, original_key_order)
output = []
data.each do |row|
output_row = {}
processed_keys = []
original_key_order.each do |original_key|
if %w[ec go ipr].include? original_key
# First, we take all distinct keys that start with "ec", "go" or "ipr"
annotation_keys = row.keys.select { |key| key.start_with? original_key }
processed_keys += annotation_keys
unless annotation_keys.empty?
# Each of the values of the annotation_keys is an array. All respective values of each of
# these arrays need to be put together into one hash. (E.g. {a => [1, 2], b=> [x, y]} --> [{a: 1, b: x}, {a: 2, b: y}])
reconstructed_objects = []
(0..row[annotation_keys[0]].length).each do |i|
reconstructed_object = {}
annotation_keys.each do |annotation_key|
reconstructed_object[%w[ec_number go_term ipr_code].include?(annotation_key) ? annotation_key : annotation_key[annotation_key.index('_') + 1, annotation_key.length]] = row[annotation_key][i]
end
reconstructed_objects << reconstructed_object
end
output_row[original_key] = reconstructed_objects
end
elsif row.key? original_key
output_row[original_key] = row[original_key]
end
end
output << output_row
end
output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten() end",
"def flatten!() end",
"def flatten!\n self.replace(flatten)\n end",
"def my_controlled_flatten(level = nil)\n flattened = []\n\n self.each do |ele|\n if ele.is_a?(Array) && level != 0\n flattened += (level.nil? ? ele.my_controlled_flatten : ele.my_controlled_flatten(... | [
"0.6256294",
"0.622707",
"0.6045848",
"0.5950354",
"0.5950252",
"0.5938016",
"0.5917402",
"0.59123266",
"0.56876576",
"0.56876576",
"0.5636559",
"0.5636559",
"0.5596187",
"0.5594794",
"0.55541146",
"0.5514865",
"0.53528804",
"0.5309329",
"0.5293956",
"0.5281975",
"0.5261964",... | 0.517916 | 30 |
Returns an iso8601compliant string This method is aliased to xmlschema. | def iso8601
utc.strftime DATE_FORMATS[:iso8601]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xmlschema(fraction_digits=0)\n fraction_digits = fraction_digits.to_i\n s = strftime(\"%FT%T\")\n if fraction_digits > 0\n s << strftime(\".%#{fraction_digits}N\")\n end\n s << (utc? ? 'Z' : strftime(\"%:z\"))\n end",
"def time_xml\n Time.now.utc.xmlschema\n end",
"def date_to_xmls... | [
"0.6896168",
"0.67247957",
"0.6724679",
"0.66649944",
"0.6591997",
"0.65727025",
"0.65432245",
"0.65250266",
"0.64559525",
"0.63448393",
"0.6262005",
"0.6052637",
"0.5885704",
"0.5885704",
"0.5872086",
"0.58236843",
"0.5701394",
"0.56934434",
"0.56672245",
"0.5641435",
"0.561... | 0.65882516 | 5 |
Called after every test method runs. Can be used to tear down fixture information. | def teardown
# Do nothing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_teardown; end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def tear... | [
"0.8025238",
"0.79543626",
"0.79543626",
"0.78571093",
"0.7845288",
"0.7845288",
"0.7845288",
"0.7845288",
"0.7845288",
"0.7845288",
"0.7845288",
"0.7845288",
"0.78336143",
"0.78336143",
"0.7750328",
"0.77483624",
"0.77483624",
"0.7734571",
"0.7713144",
"0.7711698",
"0.771169... | 0.0 | -1 |
GET /organizations GET /organizations.json | def index
@organizations = Spree::Organization.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n results = {}\n orgs.each do |org|\n results[org['name']] = or... | [
"0.80765116",
"0.80071",
"0.78597564",
"0.78338337",
"0.78312206",
"0.7745588",
"0.7691283",
"0.7672265",
"0.76290935",
"0.7590858",
"0.7536119",
"0.7533662",
"0.7521284",
"0.75053763",
"0.75053763",
"0.75053763",
"0.75053763",
"0.75053763",
"0.75053763",
"0.75053763",
"0.750... | 0.71163946 | 38 |
GET /organizations/1 GET /organizations/1.json | def show
flash[:notice] = 'Sorry Organization was not updated please update again'
render action: 'edit'
#@organization = Spree::Organization.find(params[:id])
#redirect_to :admin_organization, notice: 'Organization was not updated.Please update it again'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetOrg id\n\n APICall(path: \"organizations/#{id}.json\")\n\n end",
"def show\n organization = current_user.organizations.find(params[:id])\n if organization\n render json: organization, status: 200\n else\n head 404\n end\n end",
"def index\n ... | [
"0.7965355",
"0.7789723",
"0.7624976",
"0.76014984",
"0.75791377",
"0.75791377",
"0.75518954",
"0.7519814",
"0.74602246",
"0.74229765",
"0.7412952",
"0.7383728",
"0.7383559",
"0.7383559",
"0.7383559",
"0.7383559",
"0.7383559",
"0.7383559",
"0.7383559",
"0.7383559",
"0.7383559... | 0.0 | -1 |
POST /organizations POST /organizations.json | def create
@organization = Spree::Organization.new(organization_params)
respond_to do |format|
if @organization.save
format.html { redirect_to @organization, notice: 'Spree::Organization was successfully created.' }
format.json { render action: 'show', status: :created, location: @organization }
else
format.html { render action: 'new' }
format.json { render json: @organization.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateOrganization params = {}\n \n APICall(path: 'organizations.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n format.html { redire... | [
"0.7546241",
"0.71868527",
"0.703545",
"0.70268863",
"0.7016771",
"0.6988308",
"0.6930564",
"0.69226116",
"0.69226116",
"0.69226116",
"0.69226116",
"0.6916983",
"0.6892586",
"0.68546283",
"0.685141",
"0.67094165",
"0.670208",
"0.6676121",
"0.6673902",
"0.6667356",
"0.661678",... | 0.6521847 | 25 |
PATCH/PUT /organizations/1 PATCH/PUT /organizations/1.json | def update
respond_to do |format|
if @organization.update(organization_params)
format.html { redirect_to edit_admin_organization_path(@organization), notice: 'Organization was successfully updated.' }
format.json { head :no_content }
else
flash[:error] = "#{@organization.errors.full_messages.first}"
format.html { redirect_to edit_admin_organization_path(@organization) }
format.json { render json: @organization.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateOrganization params = {}\n \n APICall(path: 'organizations.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update(name: nil)\n data = name.nil? ? {} : {name: name}\n cf_patch(path: \"/organizations/#{org_id}\", data: data)\n end",
"def update\n @organi... | [
"0.74092907",
"0.72068834",
"0.7111541",
"0.71057266",
"0.70979273",
"0.6975314",
"0.69394696",
"0.69285125",
"0.6913647",
"0.68745047",
"0.68745047",
"0.68361604",
"0.6831236",
"0.68225026",
"0.676107",
"0.67583406",
"0.67277133",
"0.67277133",
"0.67277133",
"0.67277133",
"0... | 0.67911184 | 14 |
DELETE /organizations/1 DELETE /organizations/1.json | def destroy
@organization.destroy
respond_to do |format|
format.html { redirect_to organizations_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteOrganization id\n \n APICall(path: \"organizations/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @organization = Organization.find(params[:id])\n @organization.destroy\n\n respond_to do |format|\n format.html { redirect_to organizations_url }\n fo... | [
"0.7767288",
"0.75106853",
"0.75106853",
"0.7457346",
"0.7331174",
"0.73253006",
"0.73227197",
"0.7295465",
"0.7285924",
"0.7278945",
"0.7270234",
"0.726735",
"0.72643864",
"0.72632885",
"0.723405",
"0.7200872",
"0.7193817",
"0.71657467",
"0.71488714",
"0.71204734",
"0.712047... | 0.7439525 | 6 |
Use callbacks to share common setup or constraints between actions. | def set_organization
@organization = Spree::Organization.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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.