query stringlengths 7 9.5k | document stringlengths 10 1.07M | negatives listlengths 19 19 | metadata dict |
|---|---|---|---|
REFERENCE NUMBER Selects the next autogenerated reference number and inserts it into the test data set | def select_auto_reference_nbr(test_data)
hide_notifications_bar
ref_nbr = select_id_generator_option(reference_nbr_input, reference_nbr_options)
logger.info "Selected auto-generated reference number '#{ref_nbr}'"
test_data.merge!({CoreUseOfCollectionsData::REFERENCE_NBR.name => ref_nbr})
end | [
"def select_auto_reference_nbr(test_data)\n hide_notifications_bar\n ref_nbr = select_id_generator_option(reference_nbr_input, reference_nbr_options)\n test_data.merge!({ UseOfCollections::REFERENCE_NBR.name => ref_nbr})\n end",
"def ref_number\n id + ORDER_NUMBER_START\n end",
"def generate_ref\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that the reference number matches test data | def verify_reference_nbr(test_data)
verify_values_match(test_data[CoreUseOfCollectionsData::REFERENCE_NBR.name], element_value(reference_nbr_input))
end | [
"def verify_reference_nbr(test_data)\n verify_values_match(test_data[UseOfCollections::REFERENCE_NBR.name], element_value(reference_nbr_input))\n end",
"def test_check_initial_hash_reference_wrong\n ver = Verifier.new\n\n assert_equal(ver.check_initial_hash_reference(1),false)\n assert_equal(ver.chec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PROJECT ID Selects the autogenerated project ID and returns it. If a test data set is given, inserts the ID. | def select_auto_project_id(test_data=nil)
hide_notifications_bar
id = select_id_generator_option(project_id_input, project_id_options)
logger.info "Selected auto-generated project ID '#{id}'"
test_data.merge!({CoreUseOfCollectionsData::PROJECT_ID.name => id}) if test_data
id
end | [
"def select_auto_project_id(test_data=nil)\n hide_notifications_bar\n id = select_id_generator_option(project_id_input, project_id_options)\n test_data.merge!({ UseOfCollections::PROJECT_ID.name => id}) if test_data\n id\n end",
"def project_id=(value)\n @project_id = value\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enters a project ID per a given set of test data | def select_project_id(test_data)
hide_notifications_bar
logger.info "Entering project ID '#{test_data[CoreUseOfCollectionsData::PROJECT_ID.name]}'"
wait_for_options_and_select(project_id_input, project_id_options, test_data[CoreUseOfCollectionsData::PROJECT_ID.name])
end | [
"def select_auto_project_id(test_data=nil)\n hide_notifications_bar\n id = select_id_generator_option(project_id_input, project_id_options)\n test_data.merge!({ UseOfCollections::PROJECT_ID.name => id}) if test_data\n id\n end",
"def select_auto_project_id(test_data=nil)\n hide_notifications_bar\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies a project ID matches test data | def verify_project_id(test_data)
verify_values_match(test_data[CoreUseOfCollectionsData::PROJECT_ID.name], element_value(project_id_input))
end | [
"def verify_project_id(test_data)\n verify_values_match(test_data[UseOfCollections::PROJECT_ID.name], element_value(project_id_input))\n end",
"def verify_project_desc(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::PROJECT_DESC.name], element_value(project_desc_text_area))\n end",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
METHODS Selects or removes UoC methods per a given set of test data | def select_methods(test_data)
test_methods = test_data[CoreUseOfCollectionsData::METHOD_LIST.name]
hide_notifications_bar
test_methods = [{CoreUseOfCollectionsData::METHOD.name => ''}] unless test_methods
prep_fieldsets_for_test_data([fieldset(CoreUseOfCollectionsData::METHOD_LIST.name)], test_methods)
... | [
"def select_methods(test_data)\n test_methods = test_data[UseOfCollections::METHOD_LIST.name]\n test_methods = [{ UseOfCollections::METHOD.name => ''}] unless test_methods\n prep_fieldsets_for_test_data([fieldset(UseOfCollections::METHOD_LIST.name)], test_methods)\n\n test_methods.each_with_index do |me... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that the methods match test data | def verify_methods(test_data)
test_methods = test_data[CoreUseOfCollectionsData::METHOD_LIST.name]
test_methods = [{CoreUseOfCollectionsData::METHOD.name => ''}] unless test_methods
test_methods.each_with_index { |test_method, index| verify_values_match(test_method[CoreUseOfCollectionsData::METHOD.name], el... | [
"def verify_methods(test_data)\n test_methods = test_data[UseOfCollections::METHOD_LIST.name]\n test_methods = [{ UseOfCollections::METHOD.name => ''}] unless test_methods\n test_methods.each_with_index { |test_method, index| verify_values_match(test_method[UseOfCollections::METHOD.name], element_value(met... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
COLLECTION TYPE Selects collection types per a given set of test data | def select_collection_types(test_data)
types = test_data[CoreUseOfCollectionsData::COLLECTION_TYPE_LIST.name] || [{CoreUseOfCollectionsData::COLLECTION_TYPE.name => ''}]
hide_notifications_bar
prep_fieldsets_for_test_data([fieldset(CoreUseOfCollectionsData::COLLECTION_TYPE_LIST.name)], types)
types.eac... | [
"def select_collection_types(test_data)\n types = test_data[UseOfCollections::COLLECTION_TYPE_LIST.name] || [{ UseOfCollections::COLLECTION_TYPE.name => ''}]\n prep_fieldsets_for_test_data([fieldset(UseOfCollections::COLLECTION_TYPE_LIST.name)], types)\n\n types.each_with_index do |type, index|\n wait... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies collection types match test data | def verify_collection_types(test_data)
types = test_data[CoreUseOfCollectionsData::COLLECTION_TYPE_LIST.name] || [{CoreUseOfCollectionsData::COLLECTION_TYPE.name => ''}]
types.each_with_index { |type, index| verify_values_match(type[CoreUseOfCollectionsData::COLLECTION_TYPE.name], element_value(collection_type_... | [
"def verify_collection_types(test_data)\n types = test_data[UseOfCollections::COLLECTION_TYPE_LIST.name] || [{ UseOfCollections::COLLECTION_TYPE.name => ''}]\n types.each_with_index { |type, index| verify_values_match(type[UseOfCollections::COLLECTION_TYPE.name], element_value(collection_type_input index)) }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MATERIAL TYPE Selects material types per a given set of test data | def select_material_types(test_data)
types = test_data[CoreUseOfCollectionsData::MATERIAL_TYPE_LIST.name] || [{CoreUseOfCollectionsData::MATERIAL_TYPE.name => ''}]
hide_notifications_bar
prep_fieldsets_for_test_data([fieldset(CoreUseOfCollectionsData::MATERIAL_TYPE_LIST.name)], types)
types.each_with_i... | [
"def select_material_types(test_data)\n types = test_data[UseOfCollections::MATERIAL_TYPE_LIST.name] || [{ UseOfCollections::MATERIAL_TYPE.name => ''}]\n prep_fieldsets_for_test_data([fieldset(UseOfCollections::MATERIAL_TYPE_LIST.name)], types)\n\n types.each_with_index do |type, index|\n wait_for_opt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies material types match test data | def verify_material_types(test_data)
types = test_data[CoreUseOfCollectionsData::MATERIAL_TYPE_LIST.name] || [{CoreUseOfCollectionsData::MATERIAL_TYPE.name => ''}]
types.each_with_index { |type, index| verify_values_match(type[CoreUseOfCollectionsData::MATERIAL_TYPE.name], element_value(material_type_input inde... | [
"def verify_material_types(test_data)\n types = test_data[UseOfCollections::MATERIAL_TYPE_LIST.name] || [{ UseOfCollections::MATERIAL_TYPE.name => ''}]\n types.each_with_index { |type, index| verify_values_match(type[UseOfCollections::MATERIAL_TYPE.name], element_value(material_type_input index)) }\n end",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
USERS Enters users data per a given set of test data | def enter_users(test_data)
users = test_data[CoreUseOfCollectionsData::USER_GRP.name] || [CoreUseOfCollectionsData.empty_user]
hide_notifications_bar
prep_fieldsets_for_test_data([fieldset(CoreUseOfCollectionsData::USER_GRP.name)], users)
users.each_with_index do |user, index|
logger.info "Enteri... | [
"def enter_users(test_data)\n test_users = test_data[CoreUseOfCollectionsData::USER_GRP.name]\n hide_notifications_bar\n test_users = [{CoreUseOfCollectionsData::USER.name => '', CoreUseOfCollectionsData::USER_TYPE.name => ''}] unless test_users\n prep_fieldsets_for_test_data([fieldset(CoreUseOfCollecti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that the users data matches test data | def verify_users(test_data)
users = test_data[CoreUseOfCollectionsData::USER_GRP.name] || [CoreUseOfCollectionsData.empty_user]
users.each_with_index do |user, index|
verify_values_match(user[CoreUseOfCollectionsData::USER.name], element_value(user_name_input index))
verify_values_match(user[CoreUse... | [
"def verify_users(test_data)\n test_users = test_data[CoreUseOfCollectionsData::USER_GRP.name]\n test_users = [{CoreUseOfCollectionsData::USER.name => '', CoreUseOfCollectionsData::USER_TYPE.name => ''}] unless test_users\n test_users.each_with_index do |user, index|\n verify_values_match(user[CoreUse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that the title matches test data | def verify_title(test_data)
verify_values_match(test_data[CoreUseOfCollectionsData::TITLE.name], element_value(title_input))
end | [
"def verify_title(test_data)\n verify_values_match(test_data[UseOfCollections::TITLE.name], element_value(title_input))\n end",
"def verify_title title_pattern\r\n command 'verifyTitle', title_pattern\r\n end",
"def verifyPopupTitle(text)\n Log.TestVerify(text == @title.getText, \"Verify popup Title ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies date requested matches test data | def verify_date_requested(test_data)
verify_values_match(test_data[CoreUseOfCollectionsData::DATE_REQUESTED.name], element_value(date_requested_input))
end | [
"def verify_date_requested(test_data)\n verify_values_match(test_data[UseOfCollections::DATE_REQUESTED.name], element_value(date_requested_input))\n end",
"def verify_foundation_date(test_data)\n errors = []\n text_values_match?(test_data[CoreOrgData::FOUNDING_DATE.name], element_value(foundation_date_i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies date completed matches test data | def verify_date_completed(test_data)
verify_values_match(test_data[CoreUseOfCollectionsData::DATE_COMPLETED.name], element_value(date_completed_input))
end | [
"def verify_date_completed(test_data)\n verify_values_match(test_data[UseOfCollections::DATE_COMPLETED.name], element_value(date_completed_input))\n end",
"def verify_date_requested(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::DATE_REQUESTED.name], element_value(date_requested_input... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
OCCASIONS Enters occasions per a given set of test data | def enter_occasions(test_data)
occasions = test_data[CoreUseOfCollectionsData::OCCASION_LIST.name] || [{CoreUseOfCollectionsData::OCCASION.name => ''}]
hide_notifications_bar
prep_fieldsets_for_test_data([fieldset(CoreUseOfCollectionsData::OCCASION_LIST.name)], occasions)
occasions.each_with_index do |o... | [
"def enter_pahma_occasions(test_data)\n occasions = test_data[CoreUseOfCollectionsData::OCCASION_LIST.name] || [{CoreUseOfCollectionsData::OCCASION.name => ''}]\n hide_notifications_bar\n prep_fieldsets_for_test_data([fieldset(CoreUseOfCollectionsData::OCCASION_LIST.name)], occasions)\n occasions.each_w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies project description matches test data | def verify_project_desc(test_data)
verify_values_match(test_data[CoreUseOfCollectionsData::PROJECT_DESC.name], element_value(project_desc_text_area))
end | [
"def verify_project_desc(test_data)\n verify_values_match(test_data[UseOfCollections::PROJECT_DESC.name], element_value(project_desc_text_area))\n end",
"def verify_project_id(test_data)\n verify_values_match(test_data[UseOfCollections::PROJECT_ID.name], element_value(project_id_input))\n end",
"def ver... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies authorizations match test data | def verify_authorizations(test_data)
authorizations = test_data[CoreUseOfCollectionsData::AUTHORIZATION_GRP.name] || [CoreUseOfCollectionsData.empty_authorization]
authorizations.each_with_index do |auth, index|
verify_values_match(auth[CoreUseOfCollectionsData::AUTHORIZED_BY.name], element_value(authoriz... | [
"def verify_authorizations(test_data)\n authorizations = test_data[UseOfCollections::AUTHORIZATION_GRP.name] || [UseOfCollections.empty_authorization]\n authorizations.each_with_index do |auth, index|\n verify_values_match(auth[UseOfCollections::AUTHORIZED_BY.name], element_value(authorized_by_input inde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies use dates match test data | def verify_use_dates(test_data)
dates = test_data[CoreUseOfCollectionsData::USE_DATE_GRP.name] || [CoreUseOfCollectionsData.empty_use_date]
dates.each_with_index do |date, index|
verify_values_match(date[CoreUseOfCollectionsData::USE_DATE.name], element_value(use_date_input index))
verify_values_mat... | [
"def verify_use_dates(test_data)\n dates = test_data[UseOfCollections::USE_DATE_GRP.name] || [UseOfCollections.empty_use_date]\n dates.each_with_index do |date, index|\n verify_values_match(date[UseOfCollections::USE_DATE.name], element_value(use_date_input index))\n verify_values_match(date[UseOfCo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that the end date matches test data | def verify_end_date(test_data)
verify_values_match(test_data[CoreUseOfCollectionsData::END_DATE.name], element_value(end_date_input))
end | [
"def verify_end_date(test_data)\n verify_values_match(test_data[UseOfCollections::END_DATE.name], element_value(end_date_input))\n end",
"def verify_date_completed(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::DATE_COMPLETED.name], element_value(date_completed_input))\n end",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies staff match test data | def verify_staff(test_data)
staff = test_data[CoreUseOfCollectionsData::STAFF_GRP.name] || [CoreUseOfCollectionsData.empty_staff]
staff.each_with_index do |staf, index|
verify_values_match(staf[CoreUseOfCollectionsData::STAFF_NAME.name], element_value(staff_name_input index))
verify_values_match(sta... | [
"def verify_staff(test_data)\n staff = test_data[UseOfCollections::STAFF_GRP.name] || [UseOfCollections.empty_staff]\n staff.each_with_index do |staf, index|\n verify_values_match(staf[UseOfCollections::STAFF_NAME.name], element_value(staff_name_input index))\n verify_values_match(staf[UseOfCollecti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
LOCATIONS Enters locations per a given set of test data | def enter_locations(test_data)
locations = test_data[CoreUseOfCollectionsData::LOCATION_LIST.name] || [{CoreUseOfCollectionsData::LOCATION.name => ''}]
hide_notifications_bar
prep_fieldsets_for_test_data([fieldset(CoreUseOfCollectionsData::LOCATION_LIST.name)], locations)
locations.each_with_index do |l... | [
"def enter_locations(test_data)\n locations = test_data[UseOfCollections::LOCATION_LIST.name] || [{ UseOfCollections::LOCATION.name => ''}]\n prep_fieldsets_for_test_data([fieldset(UseOfCollections::LOCATION_LIST.name)], locations)\n locations.each_with_index do |location, index|\n enter_auto_complete... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies locations match a given set of test data | def verify_locations(test_data)
locations = test_data[CoreUseOfCollectionsData::LOCATION_LIST.name] || [{CoreUseOfCollectionsData::LOCATION.name => ''}]
locations.each_with_index { |location, index| verify_values_match(location[CoreUseOfCollectionsData::LOCATION.name], element_value(location_input index)) }
e... | [
"def verify_locations(test_data)\n locations = test_data[UseOfCollections::LOCATION_LIST.name] || [{ UseOfCollections::LOCATION.name => ''}]\n locations.each_with_index { |location, index| verify_values_match(location[UseOfCollections::LOCATION.name], element_value(location_input index)) }\n end",
"def ver... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies fees match test data | def verify_fees(test_data)
fees = test_data[CoreUseOfCollectionsData::FEE_GRP.name] || [CoreUseOfCollectionsData.empty_fee]
fees.each_with_index do |fee, index|
verify_values_match(fee[CoreUseOfCollectionsData::FEE_CURRENCY.name], element_value(fee_currency_input index))
verify_values_match(fee[Core... | [
"def verify_fees(test_data)\n fees = test_data[UseOfCollections::FEE_GRP.name] || [UseOfCollections.empty_fee]\n fees.each_with_index do |fee, index|\n verify_values_match(fee[UseOfCollections::FEE_CURRENCY.name], element_value(fee_currency_input index))\n verify_values_match(fee[UseOfCollections::F... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that the note matches test data | def verify_note(test_data)
verify_values_match(test_data[CoreUseOfCollectionsData::NOTE.name], element_value(note_text_area))
end | [
"def verify_note(test_data)\n verify_values_match(test_data[UseOfCollections::NOTE.name], element_value(note_text_area))\n end",
"def verify_history_notes(test_data)\n test_histories = test_data[Org::HISTORY_NOTES.name]\n errors = []\n test_histories = [{ Org::HISTORY_NOTE.name => ''}] unless test_hi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PROVISOS Enters or removes provisos per a given set of test data | def enter_provisos(test_data)
hide_notifications_bar
logger.info "Entering provisos '#{test_data[CoreUseOfCollectionsData::PROVISOS.name]}'"
wait_for_element_and_type(provisos_text_area, test_data[CoreUseOfCollectionsData::PROVISOS.name])
end | [
"def calculate_and_set_protease_volumes\n protease_samples.each do |protease|\n protease_ops = operations.select { |op| op.input(PROTEASE).sample == protease }\n stock_conc = stock_concentration(ops: protease_ops)\n protease_ops.each { |op| set_protease_volumes(op, stock_conc) }\n end\n end",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that the provisos match test data | def verify_provisos(test_data)
verify_values_match(test_data[CoreUseOfCollectionsData::PROVISOS.name], element_value(provisos_text_area))
end | [
"def verify_provisos(test_data)\n verify_values_match(test_data[UseOfCollections::PROVISOS.name], element_value(provisos_text_area))\n end",
"def run_verification\n verify_data_format # runs through what we have and makes sure teh values are in the correct format\n verify_dependencies # makes sure t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that the result matches test data | def verify_result(test_data)
verify_values_match(test_data[CoreUseOfCollectionsData::RESULT.name], element_value(result_text_area))
end | [
"def verify_result(test_data)\n verify_values_match(test_data[UseOfCollections::RESULT.name], element_value(result_text_area))\n end",
"def verify_result(expect, model)\n puts \"running query: #{build_query(model)}\"\n result = search(build_query(model))\n assert_equal(expect.size, result.hit.size)\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
OBLIGATIONS Clicks the obligations fulfilled checkbox, though it knows nothing about whether it is checking or unchecking | def click_obligations_fulfilled
wait_for_element_and_click obligations_input
end | [
"def check\n click unless checked?\n end",
"def check\r\n self.click unless checked?\r\n end",
"def offenses_to_check; end",
"def email_consol; det.checkbox(:id, 'enableEmailConsolidation'); end",
"def click(event)\n status.present = event.target.checked\n post_update()\n end",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return the line and column of a given offset into this string line and column are 1based | def line_column(string, offset)
return 1,1 if string.length==0 || offset==0
lines = (string[0..offset-1] + " ").split("\n")
return lines.length, lines[-1].length
end | [
"def get_line_and_column_from_chunk(offset)\n if offset.zero?\n return [@chunk_line, @chunk_column]\n end\n\n string =\n offset >= @chunk.size ? @chunk : @chunk[0..offset-1]\n\n line_count = string.count(\"\\n\")\n\n column = @chunk_column\n if line_count > 0\n lines = string.split(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes an array of Strings and Regexp and generates a new Regexp that matches the or ("|") of all strings and Regexp | def array_to_or_regexp_string(array)
array = symbols_to_strings array.flatten
array = sort_operator_patterns array
array = regexp_and_strings_to_regexpstrings array
array.collect {|op| "(#{op})"}.join('|')
end | [
"def |(re)\n self.or(re)\n end",
"def or(matcher); end",
"def build_regex(fields)\n fields_or = fields.map { |field| \"#{field}(\\\\[\\\\])?\" }.join('|')\n\n Regexp.new(\"^#{fields_or}$\")\n end",
"def build_string_regex(elements)\n\n starting_with = \"\"\n elements.each_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generates a tree of nodes of the specified node_class The nodes have access to the following useful methods: self.left > return the left operand parsetreenode self.right > return the right operand parsetreenode self.operator_node > return the operator parsetreenode self.operator > return the operator as a ruby symbol | def generate_tree(operands, operators, parent_node)
return operands[0] if operands.length==1
i = index_of_lowest_precedence(operators)
operator = operators[i]
new_operand = node_class.new(parent_node)
new_operand.add_match generate_tree(operands[0..i], operators[0..i-1],new_operand), :left
new_... | [
"def generate_tree\n root =\tTreeNode.new(3)\n root.left =\tTreeNode.new(9)\n right = \t\tTreeNode.new(20)\n right.left = \tTreeNode.new(15)\n right.right = TreeNode.new(7)\n root.right = \tright\n root\nend",
"def operators(node) #only want to print nodes that are operators (have children)\n return if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check getting checksums of a stream | def test_get_checksum_stream
basechecksum = Cfruby::Checksum::Checksum.get_checksums(@tempfile.path)
File.open(@tempfile.path) { |fp|
streamchecksum = Cfruby::Checksum::Checksum.get_checksums(fp)
assert_equal(basechecksum, streamchecksum)
}
end | [
"def checksum; end",
"def verify_checksum!\n log.info(log_key) { \"Verifying checksum\" }\n\n expected = checksum\n actual = digest(downloaded_file, digest_type)\n\n if expected != actual\n raise ChecksumMismatch.new(self, expected, actual)\n end\n end",
"def checksum\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks the permission, existence, and ownership controls on the database file | def test_database_checks()
currentmode = File.stat(@databasefile).mode
Cfruby::FileOps.chmod(@databasefile, 0700)
assert_not_equal(currentmode, File.stat(@databasefile).mode)
assert_raise(Cfruby::Checksum::ChecksumPermissionError) {
@checksum.update_all
}
Cfruby::FileOps.chmod(@databasefile, 0600)
i... | [
"def check_mode()\n\t\t\t\tCfruby.controller.inform('debug', \"checking checksum database permisions for \\\"#{@databasefile}\\\"\")\n\n\t\t\t\t#if it does exist test the mode. Raise an exception if it fails the test or return true\n\t\t\t\tstat = File.stat(@databasefile)\n\t\t\t\t\n\t\t\t\tif(stat.mode != @statmo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs before the build begins | def prebuild(build, listener)
# do any setup that needs to be done before this build runs.
end | [
"def preRun\n end",
"def prebuild(build, listener)\n # do any setup that needs to be done before this build runs.\n end",
"def execute_pre_build(software); end",
"def before_setup\n # do nothing by default\n end",
"def pre_install; end",
"def pre_task\n end",
"def before_run(ant)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a password if no password define. This password if generate by rangexp. A gem require by dmsweatshop. If password no send after by mail, the password is not getting another time. | def generate_password
if new_record?
self.password = self.password_confirmation = /\w{0,10}/.gen unless password
end
end | [
"def generate_password\n if self.password.blank?\n pass = SecureRandom.urlsafe_base64\n self.password = pass\n self.password_confirmation = pass\n end\n end",
"def generate_password( length_of_pass, special_char )\n chars = []\n (\"a\"..\"z\").each {|ele... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /trip_routes GET /trip_routes.json | def index
@trip_routes = TripRoute.all
end | [
"def route_info\n routes = RestClient.get('http://svc.metrotransit.org/NexTrip/Routes?format=json')\n JSON.parse(routes)\nend",
"def index\n @driver_trip_routes = DriverTripRoute.all\n end",
"def index\n @truck_routes = TruckRoute.all\n render json: @truck_routes\n end",
"def routes\n routes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /trip_routes POST /trip_routes.json | def create
@trip_route = TripRoute.new(trip_route_params)
respond_to do |format|
if @trip_route.save
format.html { redirect_to @trip_route, notice: 'Trip route was successfully created.' }
format.json { render :show, status: :created, location: @trip_route }
else
format.html... | [
"def post_route(route, message)\n raise TypeError unless route.is_a? Route\n @changeset = @api.create_changeset(message, tags={'created_by'=>'ITCR'})\n ways_list = []\n nodes_list = create_node_list(route.path)\n\n until nodes_list.empty? # For node's maximum limit of a way\n way_nodes = nodes_l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /trip_routes/1 PATCH/PUT /trip_routes/1.json | def update
respond_to do |format|
if @trip_route.update(trip_route_params)
format.html { redirect_to @trip_route, notice: 'Trip route was successfully updated.' }
format.json { render :show, status: :ok, location: @trip_route }
else
format.html { render :edit }
format.jso... | [
"def update\n if @truck_route.update(truck_route_params)\n render json: @truck_route, status: :ok\n else\n render json: @truck_route.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n format.any(:trips_json, :json) do\n if @trip.upda... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /trip_routes/1 DELETE /trip_routes/1.json | def destroy
@trip_route.destroy
respond_to do |format|
format.html { redirect_to trip_routes_url, notice: 'Trip route was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @route = Line.find_by_slug(params[:line_id]).routes.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @truck_route.destroy\n render json: @truck_route, status: :... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /ped_programs GET /ped_programs.json | def index
@ped_programs = PedProgram.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @ped_programs }
end
end | [
"def get_all_programs\n\t\tdo_get_request('/system/programs/list')\n\tend",
"def index\n @programs = Program.order(\"name\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programs }\n end\n end",
"def index\n @programs = Program.where(:user_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /ped_programs POST /ped_programs.json | def create
@ped_program = PedProgram.new(params[:ped_program])
respond_to do |format|
if @ped_program.save
format.html { redirect_to @ped_program, notice: 'Ped program was successfully created.' }
format.json { render json: @ped_program, status: :created, location: @ped_program }
el... | [
"def create\n @program = Program.new(params[:program])\n\n respond_to do |format|\n if @program.save\n format.html { redirect_to @program, :notice => 'Program was successfully created.' }\n format.json { render :json => @program, :status => :created, :location => @program }\n else\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates the row / column of an adjoining tile, based on the side 'sides' are numbered 0 through 5, with 0 being upper left, and moving clockwise. Returns a tuple of [row, column] for the resulting tile. | def adjoiningTile(row, column, side)
if( row.is_a?(Integer) && column.is_a?(Integer) && side.is_a?(Integer) )
case side
when 0
return [row - 1, column - 1]
when 1
return [row - 1, column]
when 2
return [row, column + 1]
when 3
return [row + 1, column]
when 4
return [row + 1, column... | [
"def get_column tile\n\ttile[1].to_i - 1\nend",
"def tile_leftward\n num_rising_columns, num_summit_clients = calculate_right_triangle\n heights = (1..num_rising_columns).to_a.push(num_summit_clients).reverse\n arrange_columns heights\n end",
"def get_other_row_or_col(position, size)\n size =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the PublicEarth::Db::Collection, rather than an Atlas::Collection. TODO: Finish conversion of PublicEarth::Db::Collection to Atlas::Collection. | def collection
@collection ||= PublicEarth::Db::Collection.find_by_id!(collection_id)
end | [
"def collection\n @collection ||= self.db.collection(self.collection_name)\n end",
"def collection\n Jrodb::Collection::Basic.new(self)\n end",
"def collections\n @collections ||= PublicEarth::Db::Collection.containing(self.id)\n end",
"def collection\n return nil if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We rewrite the provided canvas ids to: ensure it exists in the manifest (if they don't, mirador puts the user into a weird initial state) rewrite precocina canvas ids to postcocina canvas ids as appropriate (to avoid breaking embeds that used to work) rubocop:disable Metrics/AbcSize | def canvas_id
return if request.canvas_id.blank?
if canvases.any? { |canvas| canvas['@id'] == request.canvas_id }
request.canvas_id
elsif cocinafied_canvases? && request.canvas_id.exclude?('cocina-fileSet')
cocinafied_canvas_id
else
Honeybadger.notify(
... | [
"def testGetCanvasIDs\n canvasIDs = Canvas.getCanvasIDs()\n assert_equal(\"1|2|3\", canvasIDs, \"Canvas ids were not correctly retrieved/output\")\n Canvas.create(bitmap_id: 1, user_username: 'mylittlelucas888', active: false)\n assert_equal(canvasIDs, Canvas.getCanvasIDs, \"An inactive Canvas record's ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
true if the message with this message_id has already been seen | def message_seen?(message_id)
self.seen_messages.include?(message_id)
end | [
"def check_for_duplicate_message_id\n old_mail_log = nil\n user_thread.schedule do\n old_mail_log = user.mail_logs.find_by_message_id(message_id)\n end\n\n if old_mail_log\n Log.librato(:count, \"system.process_uid.duplicate_message_id\", 1)\n return false\n else\n return true\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
store the remembered message ids in a yaml file | def store_remembered_messages
if configuration.single_delivery
File.open(seen_messages_file, 'w') do |file|
file.write seen_messages.to_yaml
end
end
end | [
"def restore_remembered_messages\n if configuration.single_delivery\n yaml = default_yaml = \"--- []\"\n begin\n File.open(seen_messages_file, 'r') do |file|\n yaml = file.read\n end\n rescue Object\n yaml = default_yaml\n end\n buffer = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reload remembered message ids from a yaml file | def restore_remembered_messages
if configuration.single_delivery
yaml = default_yaml = "--- []"
begin
File.open(seen_messages_file, 'r') do |file|
yaml = file.read
end
rescue Object
yaml = default_yaml
end
buffer = []
begin
... | [
"def store_remembered_messages\n if configuration.single_delivery\n File.open(seen_messages_file, 'w') do |file|\n file.write seen_messages.to_yaml\n end\n end\n end",
"def regenerate_ids\n @regenerate_ids\n end",
"def refresh_ids\n\t\t# Find all puzzle IDs retrieved\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
acknowledge message (if headers["ack"] == "client") | def ack(subscription_headers, message)
#p [:ack, message.headers["message-id"]]
if message.headers["message-id"].to_s.strip != "" && subscription_headers["ack"].to_s == "client"
SMQueue.dbg { [:smqueue, :ack, :message, message].inspect }
connection.ack message.headers["message-id"], { }
... | [
"def client_ack?(message)\n headers = @subscriptions[message.headers[:destination]]\n !headers.nil? && headers[:ack] == \"client\"\n end",
"def send_ack(message)\n @client.ack(message)\n end",
"def ack\n @mq.callback do\n @mq.send Protocol::Basic::Ack.new({ :delivery_tag => @header_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get message from queue if block supplied, loop forever and yield(message) for each message received default headers are: :ack => "client" :client_id => configuration.client_id :subscription_name => configuration.subscription_name | def get(headers = {}, &block)
self.connect
SMQueue.dbg { [:smqueue, :get, headers].inspect }
subscription_headers = {"ack" => "client", "activemq.prefetchSize" => 1 }
if client_id = configuration.client_id
subscription_headers["client_id"] = client_id
end
if sub_name = config... | [
"def process_single_message(queue)\n queue.subscribe(:ack => true) do |h, m|\n return if AMQP.closing?\n Minion.info(\"Received: #{queue_name}:#{m}, #{h}\")\n msg = Message.new(m, h)\n msg.content = block.call(msg)\n h.ack\n msg.callback\n Minion.execute_handler... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /heights GET /heights.json | def index
@heights = Height.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @heights }
end
end | [
"def show\n @height = Height.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @height }\n end\n end",
"def index\n @heights = Height.all\n end",
"def getFullHeightFromInfoJson (url)\n data = open(url).read\n results = JSON.parse(da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /heights/1 GET /heights/1.json | def show
@height = Height.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @height }
end
end | [
"def index\n @heights = Height.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heights }\n end\n end",
"def index\n @heights = Height.all\n end",
"def getFullHeightFromInfoJson (url)\n data = open(url).read\n results = JSON.parse(data)\n put... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /heights/new GET /heights/new.json | def new
@height = Height.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @height }
end
end | [
"def create\n @height = Height.new(height_params)\n\n respond_to do |format|\n if @height.save\n format.html { redirect_to @height, notice: 'Height was successfully created.' }\n format.json { render :show, status: :created, location: @height }\n else\n format.html { render :new... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /heights POST /heights.json | def create
@height = Height.new(params[:height])
respond_to do |format|
if @height.save
format.html { redirect_to [:admin,@height], notice: 'Height was successfully created.' }
format.json { render json: @height, status: :created, location: @height }
else
format.html { rende... | [
"def create\n @height = Height.new(height_params)\n\n respond_to do |format|\n if @height.save\n format.html { redirect_to @height, notice: 'Height was successfully created.' }\n format.json { render :show, status: :created, location: @height }\n else\n format.html { render :new... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /heights/1 PUT /heights/1.json | def update
@height = Height.find(params[:id])
respond_to do |format|
if @height.update_attributes(params[:height])
format.html { redirect_to [:admin,@height], notice: 'Height was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
... | [
"def update\n respond_to do |format|\n if @height.update(height_params)\n format.html { redirect_to @height, notice: 'Height was successfully updated.' }\n format.json { render :show, status: :ok, location: @height }\n else\n format.html { render :edit }\n format.json { rend... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /heights/1 DELETE /heights/1.json | def destroy
@height = Height.find(params[:id])
@height.destroy
respond_to do |format|
format.html { redirect_to admin_heights_url }
format.json { head :ok }
end
end | [
"def destroy\n @height = Height.find(params[:id])\n @height.destroy\n\n respond_to do |format|\n format.html { redirect_to(heights_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @height.destroy\n respond_to do |format|\n format.html { redirect_to heights_url, noti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update target craft sync attrs after moving a sync'd craft | def update_sync_targets old_campaign_id, new_campaign_id
sync_with_campaigns = sync_targets
return if sync_with_campaigns.blank?
target_craft = Craft.where(:campaign_id => sync_with_campaigns, :name => self.name)
target_craft.each do |c|
next if c.sync[:with].blank?
c.sync = {:with => c.sy... | [
"def update_removed_from_list \n if @removed_from_sync_list && !@removed_from_sync_list.blank?\n rem_craft = Craft.where(:name => self.name, :campaign_id => @removed_from_sync_list)\n rem_craft.each do |c|\n c.sync = {:with => c.sync[:with].select{|id| ![self.campaign_id, self.sync[:with]].flat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
takes either a Campaign object or an id for a campaign and adds it to the crafts sync[:with] list | def sync_with campaign
campaign_id = campaign.id if campaign.is_a?(Campaign)
campaign_id ||= campaign
sync_list = self.sync
sync_list[:with] ||= []
sync_list[:with] << campaign_id
self.sync = sync_list
self.save
end | [
"def update_sync_targets old_campaign_id, new_campaign_id\n sync_with_campaigns = sync_targets\n return if sync_with_campaigns.blank?\n\n target_craft = Craft.where(:campaign_id => sync_with_campaigns, :name => self.name)\n target_craft.each do |c|\n next if c.sync[:with].blank? \n c.sync = {:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
process the craft which have been removed from sync to no longer point back at this craft instance var is set by sync= being called. this method is called by the synchronize method | def update_removed_from_list
if @removed_from_sync_list && !@removed_from_sync_list.blank?
rem_craft = Craft.where(:name => self.name, :campaign_id => @removed_from_sync_list)
rem_craft.each do |c|
c.sync = {:with => c.sync[:with].select{|id| ![self.campaign_id, self.sync[:with]].flatten.inclu... | [
"def remove_car\n\t\t@car = nil\n\t\t@is_slot_free = true\n\tend",
"def on_removed_entry(state, event, *event_args)\n super\n\n # TODO: simulation - remove\n if simulating\n __debug_sim(\"[remove_emma_items: #{submission.emma_item}]\")\n emma_items = submission.emma_item\n else\n emma_i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /cloud_providers/1 GET /cloud_providers/1.json | def show
@cloud_provider = current_user.cloud_providers.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @cloud_provider }
end
end | [
"def new\n @cloud_provider = current_user.cloud_providers.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloud_provider }\n end\n end",
"def show\n @provider = current_company.providers.find(params[:id])\n\n respond_to do |format|\n format.ht... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /cloud_providers/new GET /cloud_providers/new.json | def new
@cloud_provider = current_user.cloud_providers.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @cloud_provider }
end
end | [
"def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.htm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /cloud_providers/1 PUT /cloud_providers/1.json | def update
@cloud_provider = current_user.cloud_providers.find(params[:id])
respond_to do |format|
if @cloud_provider.update_attributes(params[:cloud_provider])
format.html { redirect_to @cloud_provider, notice: 'Cloud provider was successfully updated.' }
format.json { head :no_content }... | [
"def update_provider!(provider, provider_info = {}, access = {})\n Api::Request.new do |request|\n request[:access] = access\n request[:method] = :PUT\n request[:path] = \"/mgmt/{{client_id}}/storages/#{provider}\"\n request[:request_body] = provider_info\n end.execute!\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /cloud_providers/1 DELETE /cloud_providers/1.json | def destroy
@cloud_provider = current_user.cloud_providers.find(params[:id])
@cloud_provider.destroy
respond_to do |format|
format.html { redirect_to cloud_providers_url }
format.json { head :no_content }
end
end | [
"def destroy\n @v1_provider.destroy\n respond_to do |format|\n format.html { redirect_to v1_providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the request passed a callback, answer in the appropiate way. Or else, answer normally. | def callback_response(callback,response)
if callback.nil?
response
else
callback + "(" + response + ")"
end
end | [
"def dispatch_http_response(res, options, &block)\n callback = options.fetch('callback', nil)\n (res.blank? && callback.present?) ? callback.call(res) : block.call(res)\nend",
"def response_callback(&block)\n @response_callback = block if block_given?\n \n @response_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
string ID of automation that created request | def automation_id
@attributes[:automation_id]
end | [
"def automation_id\n return @automation_id\n end",
"def automation_id\n existence_check\n @automation_element.current.automation_id.to_s\n end",
"def automation_id=(value)\n @automation_id = value\n end",
"def request_id\n SecureRandom.uuid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes a new Table instance with the specified columns. +columns+:: A list of Column instances representing the columns in the new table. | def initialize(*columns)
@columns = columns
end | [
"def initialize_columns(columns = {})\n colunms_config = {}\n columns.each do |column, config|\n colunms_config[column.to_sym] = initialize_column column, config\n end\n colunms_config\n end",
"def set_columns(new_columns)\n @columns = new_col... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sorts the receiver's data in ascending order using the specified sort keys. +sort_keys+:: A list of column IDs to sort on. If table does not have a column with one of the IDs, that ID is ignored. | def sort_data_ascending!(*sort_keys)
self.sort_data!(true, sort_keys)
end | [
"def sort_data!(is_ascending, sort_keys)\n sort_key_indices = sort_keys.collect { |key| @columns.index(@columns.find { |column| column.id == key }) }.reject { |e| !e }\n\n @data.sort! do |row1, row2|\n comparison_result = 0\n\n sort_key_indices.each do |index|\n comparison_result = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sorts the receiver's data in descending order using the specified sort keys. +sort_keys+:: A list of column IDs to sort on. If table does not have a column with one of the IDs, that ID is ignored. | def sort_data_descending!(*sort_keys)
self.sort_data!(false, sort_keys)
end | [
"def sort_data!(is_ascending, sort_keys)\n sort_key_indices = sort_keys.collect { |key| @columns.index(@columns.find { |column| column.id == key }) }.reject { |e| !e }\n\n @data.sort! do |row1, row2|\n comparison_result = 0\n\n sort_key_indices.each do |index|\n comparison_result = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sorts the receiver's data using the specified sort order and keys. +is_ascending+:: Whether to sort the data in ascending order or not. +sort_keys+:: A list of column IDs to sort on. If table does not have a column with one of the IDs, that ID is ignored. | def sort_data!(is_ascending, sort_keys)
sort_key_indices = sort_keys.collect { |key| @columns.index(@columns.find { |column| column.id == key }) }.reject { |e| !e }
@data.sort! do |row1, row2|
comparison_result = 0
sort_key_indices.each do |index|
comparison_result = @columns[ind... | [
"def sort_data_ascending!(*sort_keys)\n self.sort_data!(true, sort_keys)\n end",
"def sort(*keys)\n sort_directions = {}\n asc_regexp = /(.*)_asc$/\n desc_regexp = /(.*)_desc$/\n keys.each_with_index do |key,key_index|\n key_as_string = key.to_s\n if m = asc_regexp.match(key_as_strin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes a new Column instance with the specified ID and options. Valid keys for options are +:alignment+, +:data_comparator+, +:data_to_s+, +:label+, +:padding+, and +:width+, whose usage should be obvious. +id+:: The new instance's ID. +options+:: An options map specifying zero or more of the column's instance var... | def initialize(id, options = { })
@id = id
@alignment = options[:alignment] || :center
@data_comparator = options[:data_comparator] || Proc.new { |a, b| a <=> b }
@data_to_s = options[:data_to_s] || Proc.new { |o| o.to_s }
@label = options[:label] || id
@padding = options[:padding] ... | [
"def column id = nil, options = {}\n unless id\n id = options[:id]\n raise \"Need a column ID\" if id.nil?\n end\n if options.empty?\n @cols << {}\n else\n @cols << options\n end\n @col_count = @cols.size\n @col_ids << id\n end",
"def initialize(op... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a string representation of specified data with the appropriate alignment and padding for the receiver. +data+:: The data to pad and align. | def padded_aligned_data(data)
string_repr = @data_to_s.call(data)
string_repr = case @alignment
when :left
string_repr.ljust(@width)
when :center
string_repr.center(@width)
when :right
string_repr.rjust(@width)
else
string_repr
end
@paddi... | [
"def print_data(data, padding)\n p = \"\"\n (0..padding.length - data.to_s.length).map {p += \" \"}\n print data.to_s + p\n end",
"def pad_to_block_size(data)\n data = [data.length].pack('N') + data\n return data if data.length % block_size == 0\n data + \"\\0\" * (block_size - data.length % bl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
S _ _ _ ... row, col = 1 _ _ _ _ Strategy: 1. Solve this for 1 row only. Solve for horizontally only. 2. Transpose the matrix. Then we can use same code on transposed matrix to solve it vertically. Solve for 1 row: Test cases: Word = "test" OK. All same length as word 1. _ _ _ _ All blanks. Left and right of word must ... | def crossword(arr, word)
earliest_col = -1
ans = []
arr.each_with_index do |row, i|
earliest_col = solve_horiz(row, word)
ans = [i, earliest_col]
break
end
tarr = transpose arr
tarr.each_with_index do |col, i|
earliest_row = solve_horiz(row, word)
if earliest_row <= ans[0] && i <= ans[1... | [
"def horizontal_solve(word, puzzle)\n puzzle.each do |row|\n return true if row.join.include?(word) || row.join.reverse.include?(word)\n end\n false\nend",
"def word_square?(arr)\n # first brute force, using i and j \n i = 0 \n while i < arr.length \n j = 0 \n while j < arr.length \n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start the database transaction, or fail if one is already open. | def start_transaction!
fail DbMod::Exceptions::AlreadyInTransaction if @in_transaction
@in_transaction = true
query 'BEGIN'
end | [
"def begin_db_transaction\n puts_log \"begin_db_transaction\"\n log(\"begin transaction\", \"TRANSACTION\") {\n # Turns off the auto-commit\n IBM_DB.autocommit(@connection, IBM_DB::SQL_AUTOCOMMIT_OFF) }\n end",
"def begin_db_transaction\n @pool.hold(true) do |conn|\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End the database transaction | def end_transaction!
@in_transaction = false
end | [
"def end\n\t\tcommit\n\t\t@connection.close\n\tend",
"def end_transaction\n @stats_engine.end_transaction\n end",
"def rollback_db_transaction\n execute(\"ROLLBACK\")\n end",
"def commit_db_transaction\n @connection.commit\n end",
"def end_transaction\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the customer for that given review | def customer
@@all.select {|review| self.restaurant.customers}
end | [
"def customer\n return @customer\n end",
"def customer_info(customer)\n return customer\n end",
"def review_for(course)\n self.reviews.where(course_id: course.id).first\n end",
"def related_customers\n ratings.customers\n end",
"def get_design_review(name)\n self.des... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /vocab_words GET /vocab_words.json | def index
logger.debug "-----index-----"
@vocab_words = VocabWord.all
end | [
"def index\n @vocabularies = Vocabulary.page(params[:page]).per(10)\n end",
"def show\n @vocab = Vocab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vocab }\n end\n end",
"def index\n @controlled_vocabularies = ControlledVocab... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /vocab_words/1 PATCH/PUT /vocab_words/1.json | def update
logger.debug "-----update-----"
respond_to do |format|
if @vocab_word.update(vocab_word_params)
format.html { redirect_to @vocab_word, notice: 'Vocab word was successfully updated.' }
format.json { render :show, status: :ok, location: @vocab_word }
else
format.html... | [
"def update\n @spanish_vocab = SpanishVocab.find(params[:id])\n\n respond_to do |format|\n if @spanish_vocab.update_attributes(params[:spanish_vocab])\n format.html { redirect_to @spanish_vocab, notice: 'Spanish vocab was successfully updated.' }\n format.json { head :no_content }\n el... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create two line items, then delete one and post. | def test_should_create_and_delete_line_items_before_post
assert_difference 'Invoice.count' do
assert_difference 'LineItem.count', 1 do
@basic_user.creates_new_invoice
@basic_user.enter_new_customer(
:name => "Test 8 Customer Name 4")
#get first row in ... | [
"def move_line_items_to_order basket ,order\n basket.line_items.each do |item|\n item.basket_id = nil #prevent cascade delete\n order.line_items << item\n end\n end",
"def add(new_line_items)\n new_line_items = Array.wrap(new_line_items).reject{ |li| li.product.supplier_id.nil? || li.product.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test editing an invoice with line items Remove first line item from existing invoice | def test_should_remove_first_line_item_from_invoice
assert_no_difference 'Invoice.count' do
assert_difference 'LineItem.count', -1 do
@basic_user.edits_invoice(invoices(:invoice_with_line_items).id)
#get first row in the table.
trows = @basic_user.line_items_rows
... | [
"def test_should_remove_second_line_item_from_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', -1 do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove second line item from existing invoice | def test_should_remove_second_line_item_from_invoice
assert_no_difference 'Invoice.count' do
assert_difference 'LineItem.count', -1 do
@basic_user.edits_invoice(invoices(:invoice_with_line_items).id)
#get first row in the table.
trows = @basic_user.line_items_rows
... | [
"def test_should_remove_first_line_item_from_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', -1 do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DSL tests Test dsl for add, remove, and edit items from existing invoice | def test_dsl_should_add_edit_and_remove_line_items_in_invoice
assert_no_difference 'Invoice.count' do
assert_no_difference 'LineItem.count' do
@basic_user.edits_invoice(invoices(:invoice_with_line_items).id)
assert_equal 3, @basic_user.adds_line_item(:unit => 'New line item', :description ... | [
"def test_should_create_and_delete_line_items_before_post\r\n assert_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', 1 do\r\n @basic_user.creates_new_invoice\r\n @basic_user.enter_new_customer(\r\n :name => \"Test 8 Customer Name 4\") \r\n \r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
respond to checkjira command same as interval except we answer with 'no issues found' if there are no issues | def checkjira_command(msg)
begin
msg.speak "no new issues since I last checked #{@lastlast} ago" \
if !check_jira(msg)
rescue
msg.speak "sorry, we had trouble connecting to JIRA."
end
end | [
"def checkjira_command(msg)\n begin\n msg.speak \"no new issues since I last checked #{@lastlast} ago\" if !check_jira(msg)\n rescue \n msg.speak \"sorry, we had trouble connecting to JIRA.\"\n end\n end",
"def issues_worked\n search_criteria_present!\n\n query = \"q=type:issue+or... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fetch jira url and return a list of ticket Hashes | def fetch_jira_poll_url()
jiraconfig = bot.config['jira_poll_url']
if jiraconfig.is_a?(Array)
searchurls_str = jiraconfig
else
searchurls_str = [jiraconfig]
end
tix = []
searchurls_str.each do |searchurl_str|
begin
@log.info "checking jira for new issues... #{sear... | [
"def fetch_jira_url()\n \n jiraconfig = bot.config['jira_url']\n \n if jiraconfig.is_a?(Array)\n searchurls = jiraconfig \n else \n searchurls = [jiraconfig]\n end\n \n tix = []\n \n searchurls.each do |searchurl|\n begin\n @log.info \"checking jira for new issu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
extract array of comments from an xml element (ticket) | def parse_ticket_for_comments(xml)
comments = []
doc = REXML::Document.new(xml)
doc.elements.inject('item/comments', comments) do |comments, element|
comments.push(parse_comment_info(element))
end
return comments
end | [
"def comments tag\n path = \"/comment/#{tag}/show.xml\"\n doc = http_get path\n \n comments = []\n xpath(doc, \"//comment\").each do |entry|\n comments << Comment.new(:xml => entry)\n end\n comments\n end",
"def comments\n get_ticket_property_list(\"comments\" , U... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
extract comment hash from individual xml element | def parse_comment_info(xml_element)
text = xml_element.elements['comment'].text rescue ""
author = xml_element.elements['comment'].key['author'] rescue ""
created = xml_element.elements['comment'].key['created'] rescue ""
return {
:text => text,
:author => author,
:created => created
... | [
"def convert_xml_comment(el, opts)\n block = el.options[:category] == :block\n indent = SPACE * @current_indent\n content = el.value\n content.gsub!(/^<!-{2,}\\s*/, \"\") if content.start_with?(\"<!--\")\n content.gsub!(/-{2,}>$/, \"\") if content.end_with?(\"-->\")\n resul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
extract ticket hash from individual xml element | def parse_ticket_info(xml_element)
id = xml_element.elements['key'].text rescue ""
id, spacekey = split_spacekey_and_id(id) rescue ""
link = xml_element.elements['link'].text rescue ""
title = xml_element.elements['title'].text rescue ""
reporter = xml_element.elements['reporter'].text rescue ""
... | [
"def generate_xmlhash\n self.xmlhash = Digest::SHA256.hexdigest(self.xml)\n end",
"def extract_hash(node); end",
"def xml_to_hash(xml)\n hash = Hash.from_xml(xml)\n convert_hex(hash, [\"DeviceMacId\", \"MeterMacId\"])\n hash\n end",
"def digest_value(xml)\n canonical = xml.canonical... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
extract the spacekey and id from the ticket id | def split_spacekey_and_id(key)
spacekey = key.scan(/^([A-Z]+)/).to_s
id = key.scan(/([0-9]+)$/)[0].to_s.to_i
return id, spacekey
end | [
"def extract_contract_id(id)\n /^(\\w+)-\\w+\\b.*/ =~ id\n $1\n end",
"def get_ticket id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get TICKETS, id )\n\t\t\t\tend",
"def extract_vsys_id(id)\n /^(\\w+-\\w+)\\b.*/ =~ id\n $1\n end",
"def getDetails id\n\t\tticket = @tickets.rea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format fragment operation as string | def format_fragment_operation(fragment_operation, level)
result = []
result << indent(level) + format_fragment_operation_signature(fragment_operation)
result << "#{indent(level)}{"
result += fragment_operation.__nodes.map { |node| format_node(node, level + 1) }
result << "#{inde... | [
"def format_fragment_operation_signature(fragment_operator)\n [\n \"fragment #{fragment_operator.__name}\",\n \"on #{fragment_operator.__type}\",\n format_directives(fragment_operator.__directives, false),\n ].compact.join(' ')\n end",
"def decorate_fragment( fragment... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format fragment operation signature as string | def format_fragment_operation_signature(fragment_operator)
[
"fragment #{fragment_operator.__name}",
"on #{fragment_operator.__type}",
format_directives(fragment_operator.__directives, false),
].compact.join(' ')
end | [
"def format_inline_fragment_signature(inline_fragment)\n [\n '...',\n (inline_fragment.__type ? \"on #{inline_fragment.__type}\" : nil),\n format_directives(inline_fragment.__directives, false),\n ].compact.join(' ')\n end",
"def format_signature(path, http_method, ti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /admin/rights/new GET /admin/rights/new.json | def new
@right = Right.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @right }
end
end | [
"def new\n @access_right = AccessRight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @access_right }\n end\n end",
"def new\n \n @roles_and_permission = @roles.roles_and_permission.new\n \n respond_to do |format|\n format.html # new.h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /admin/rights/1 PUT /admin/rights/1.json | def update
@right = Right.find(params[:id])
respond_to do |format|
if @right.update_attributes(params[:right])
format.html { redirect_to admin_right_path(@right), notice: 'Right was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "... | [
"def update\n respond_to do |format|\n if @right.update(right_params)\n format.html { redirect_to rights_url, notice: \"Right: #{I18n.t('helpers.saved')}\" }\n format.json { render :show, status: :ok, location: @right }\n else\n format.html { render :edit }\n format.json { r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /admin/rights/1 DELETE /admin/rights/1.json | def destroy
@right = Right.find(params[:id])
@right.destroy
respond_to do |format|
format.html { redirect_to admin_rights_url }
format.json { head :no_content }
end
end | [
"def destroy\n @right.destroy\n respond_to do |format|\n format.html { redirect_to rights_url, notice: \"Right: #{I18n.t('helpers.deleted')}\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @privilege.destroy\n respond_to do |format|\n format.html { redirect_to pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /clasifications or /clasifications.json | def index
@clasifications = Clasification.all
end | [
"def classifications(classification)\n params = {\n classification: classification\n }.compact\n\n _get(\"/account/classifications\", params) { |json| json }\n end",
"def show\n @clasification = Clasification.find(params[:id])\n\n respond_to do |format|\n format.html ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /clasifications or /clasifications.json | def create
@clasification = Clasification.new(clasification_params)
respond_to do |format|
if @clasification.save
format.html { redirect_to @clasification, notice: "Clasification was successfully created." }
format.json { render :show, status: :created, location: @clasification }
el... | [
"def create\n @clasification = Clasification.new(params[:clasification])\n\n respond_to do |format|\n if @clasification.save\n format.html { redirect_to @clasification, notice: 'Clasification was successfully created.' }\n format.json { render json: @clasification, status: :created, locatio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /clasifications/1 or /clasifications/1.json | def update
respond_to do |format|
if @clasification.update(clasification_params)
format.html { redirect_to @clasification, notice: "Clasification was successfully updated." }
format.json { render :show, status: :ok, location: @clasification }
else
format.html { render :edit, stat... | [
"def update\n @clasification = Clasification.find(params[:id])\n\n respond_to do |format|\n if @clasification.update_attributes(params[:clasification])\n format.html { redirect_to @clasification, notice: 'Clasification was successfully updated.' }\n format.json { head :no_content }\n e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /clasifications/1 or /clasifications/1.json | def destroy
@clasification.destroy
respond_to do |format|
format.html { redirect_to clasifications_url, notice: "Clasification was successfully destroyed." }
format.json { head :no_content }
end
end | [
"def destroy\n @clasification = Clasification.find(params[:id])\n @clasification.destroy\n\n respond_to do |format|\n format.html { redirect_to clasifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classtable = Classtable.find(params[:id])\n @classtable... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check every 0.5 seconds to see if block.call returns true. nil is considered a failure. Give up after 30 seconds. | def wait_true max_wait=30, interval=0.5, &block
max_wait = 1 if max_wait <= 0
result = nil
timeout max_wait do
until (result = begin; block.call; rescue; end)
sleep interval
end
end
result
end | [
"def keep_trying_till_true timeout = 30\n t_begin = Time.now\n loop do\n if yield\n break\n elsif (Time.now - t_begin) > timeout\n fail \"Timeout after trying for #{timeout} seconds\"\n else\n sleep 1\n end\n end\nend",
"def keep_trying_till_true timeout = 30\n t_begin = Time.now\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For Sauce Labs reporting. Returns the current session id. | def session_id
@driver.session_id
end | [
"def session_id\n @driver.session_id\n end",
"def session_id\n @driver.session_id\n end",
"def session_id\n @cnx.session_id\n end",
"def cracker_session_id\n @session_id ||= ::Rex::Text.rand_text_alphanumeric(8)\n end",
"def sessionid\n command[:sessionid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the element of type tag_name at matching index. | def ele_index tag_name, index
# XPath index starts at 1.
raise "#{index} is not a valid xpath index. Must be >= 1" if index <= 0
find_element :xpath, "//#{tag_name}[#{index}]"
end | [
"def []( index, name=nil)\n if index.kind_of? Integer\n raise \"index (#{index}) must be >= 1\" if index < 1\n name = literalize(name) if name\n num = 0\n @element.find { |child|\n child.kind_of? Element and\n (name.nil? ? true : child.has_name?( name )) and\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.