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
GET /game_picks/1 GET /game_picks/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @pick = @game.picks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pick }\n end\n end", "def index\n @game_picks = GamePick.all\n end", "def index\n @games_picks = GamesPick.all\n end", "def index\n @picks = P...
[ "0.75381595", "0.6749007", "0.65588444", "0.655389", "0.65049875", "0.64663714", "0.62378955", "0.615058", "0.6137477", "0.60904926", "0.60593635", "0.6005076", "0.5980535", "0.5977434", "0.59593433", "0.5958619", "0.594293", "0.59428173", "0.5923431", "0.59114367", "0.589054...
0.0
-1
POST /game_picks POST /game_picks.json
def create @game_pick = GamePick.new(game_pick_params) respond_to do |format| if @game_pick.save format.html { redirect_to @game_pick, notice: 'Game pick was successfully created.' } format.json { render :show, status: :created, location: @game_pick } else format.html { render :new } format.json { render json: @game_pick.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @game = Game.find params[:game_id]\n if @game.picks.find_by(user_id: current_user.id)\n else\n @pick = @game.picks.build(picks_params)\n @pick.user = current_user\n @pick.save\n end\n\n respond_to do |format|\n if @pick.save\n format.html { redirect_to games_p...
[ "0.71310514", "0.6147352", "0.5945692", "0.5910446", "0.58666134", "0.58548075", "0.5847318", "0.58417106", "0.578898", "0.57606333", "0.5736741", "0.5670256", "0.5649681", "0.5637947", "0.5615863", "0.5579459", "0.55670315", "0.5530167", "0.55249", "0.5517586", "0.5517492", ...
0.60334843
2
PATCH/PUT /game_picks/1 PATCH/PUT /game_picks/1.json
def update respond_to do |format| if @game_pick.update(game_pick_params) format.html { redirect_to @game_pick, notice: 'Game pick was successfully updated.' } format.json { render :show, status: :ok, location: @game_pick } else format.html { render :edit } format.json { render json: @game_pick.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @pick.update_attributes(picks_params)\n format.html { redirect_to games_path, notice: 'Pick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json:...
[ "0.70020413", "0.6524439", "0.6498275", "0.64399695", "0.63423276", "0.60589373", "0.6050469", "0.604468", "0.60293067", "0.6024266", "0.6017051", "0.60134965", "0.60089743", "0.598039", "0.59801614", "0.59801614", "0.59801614", "0.59801614", "0.59801614", "0.59801614", "0.59...
0.6663205
1
DELETE /game_picks/1 DELETE /game_picks/1.json
def destroy @game_pick.destroy respond_to do |format| format.html { redirect_to game_picks_url, notice: 'Game pick was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @games_pick.destroy\n respond_to do |format|\n format.html { redirect_to games_picks_url, notice: 'Games pick was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.destroy...
[ "0.6986523", "0.69652814", "0.68974805", "0.688587", "0.6841238", "0.6780546", "0.6748098", "0.6739777", "0.6731418", "0.67278427", "0.6717326", "0.66856194", "0.66856194", "0.66831416", "0.66831416", "0.66831416", "0.66831416", "0.66831416", "0.66831416", "0.66831416", "0.66...
0.70604056
0
Use callbacks to share common setup or constraints between actions.
def set_game_pick @game_pick = GamePick.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 game_pick_params params.require(:game_pick).permit(:user_entry_id, :team_instance_id, :round) 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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
During exporting, the :retrieval lambda is run according to the ordering in the configuration hash. The exported JSON file will have the records in the exported order. The SanitizedJsonImporter will import in the order within the JSON file, except for `first_types_to_import`. Results of running each lambda are added to the `records` hash for use by later retrieval lambdas. rubocop:disable Metrics/MethodLength, Metrics/AbcSize
def configuration @configuration ||= { Appeal => { # Need track_imported_ids=true because parent DecisionReview is abstract, # i.e., DecisionReview has no table_name and hence cannot be used # when reassociating using polymorphic associations. track_imported_ids: true, retrieval: lambda do |records| (records[Appeal] + records[Appeal].map { |appeal| self.class.appeals_associated_with(appeal) }.flatten.uniq.compact ).uniq.sort_by(&:id) end }, Veteran => { # track_imported_ids = true so that an existing (previously imported) Veteran can be reused track_imported_ids: true, retrieval: ->(records) { records[Appeal].map(&:veteran).sort_by(&:id) } }, AppealIntake => { retrieval: ->(records) { records[Appeal].map(&:intake).compact.sort_by(&:id) } }, DecisionDocument => { # citation_number must be unique and doesn't reference anything else in Caseflow, # so transform the number so we can import into the same DB as the original record sanitize_fields: %w[citation_number], retrieval: ->(records) { DecisionDocument.where(appeal: records[Appeal]).order(:id) } }, Claimant => { retrieval: ->(records) { records[Appeal].map(&:claimants).flatten.sort_by(&:id) } }, Task => { sanitize_fields: %w[instructions], retrieval: ->(records) { reorder_for_import(Task.where(appeal: records[Appeal])) } }, TaskTimer => { retrieval: ->(records) { TaskTimer.where(task_id: records[Task].map(&:id)).order(:id) } }, JudgeCaseReview => { sanitize_fields: %w[comment], retrieval: ->(records) { JudgeCaseReview.where(task_id: records[Task].map(&:id)).order(:id) } }, AttorneyCaseReview => { retrieval: ->(records) { AttorneyCaseReview.where(task_id: records[Task].map(&:id)).order(:id) } }, DecisionIssue => { # In order to import DecisionIssues before RequestIssues (since RequestIssue records refer to DecisionIssue), # export DecisionIssue records first. sanitize_fields: %w[decision_text description], retrieval: lambda do |records| appeal_decision_issue_ids = records[Appeal].map(&:decision_issues).flatten.map(&:id) request_issues = records[Appeal].map(&:request_issues).flatten other_decision_issues_ids = request_issues.compact.map(&:contested_decision_issue).compact.map(&:id) DecisionIssue.where(id: appeal_decision_issue_ids + other_decision_issues_ids).order(:id) end }, RequestIssue => { sanitize_fields: ["notes", "contested_issue_description", /_(notes|text|description)/], retrieval: ->(records) { records[Appeal].map(&:request_issues).flatten.sort_by(&:id) } }, RequestDecisionIssue => { retrieval: ->(records) { RequestDecisionIssue.where(request_issue: records[RequestIssue]).order(:id) } }, CavcRemand => { # dependent on DecisionIssue records # cavc_judge_full_name is selected from Constants::CAVC_JUDGE_FULL_NAMES; no need to sanitize sanitize_fields: %w[instructions], retrieval: ->(records) { records[Appeal].map(&:cavc_remand).compact.sort_by(&:id) } }, Hearing => { sanitize_fields: %w[bva_poc military_service notes representative_name summary witness], retrieval: lambda do |records| (records[Appeal].map(&:hearings) + Task.where(id: records[Task].map(&:id), type: :HearingTask).map(&:hearing) ).flatten.uniq.compact.sort_by(&:id) end }, HearingDay => { sanitize_fields: %w[bva_poc notes], retrieval: ->(records) { records[Hearing].map(&:hearing_day).uniq.compact.sort_by(&:id) } }, VirtualHearing => { sanitize_fields: %w[alias alias_with_host appellant_email conference_id guest_hearing_link guest_pin guest_pin_long host_hearing_link host_pin host_pin_long judge_email representative_email], retrieval: ->(records) { records[Hearing].map(&:virtual_hearing).uniq.compact.sort_by(&:id) } }, HearingTaskAssociation => { retrieval: ->(records) { HearingTaskAssociation.where(hearing: records[Hearing]).order(:id) } }, User => { # track_imported_ids = true so that an existing (previously imported) User can be reused track_imported_ids: true, sanitize_fields: %w[css_id email full_name], retrieval: lambda do |records| # eager load task associations tasks = Task.where(id: records[Task].map(&:id)).includes(:assigned_by, :assigned_to, :cancelled_by) cavc_remands = records[CavcRemand] hearings = records[Hearing] users = tasks.map(&:assigned_by).compact + tasks.map(&:cancelled_by).compact + tasks.assigned_to_any_user.map(&:assigned_to) + cavc_remands.map { |cavc_remand| [cavc_remand.created_by, cavc_remand.updated_by] }.flatten + records[Appeal].map(&:intake).compact.map(&:user) + records[AppealIntake].map { |intake| intake&.user } + records[HearingDay].map { |hday| [hday.created_by, hday.updated_by, hday.judge] }.flatten + hearings.map { |hearing| [hearing.created_by, hearing.updated_by, hearing.judge] }.flatten + hearings.map(&:virtual_hearing).uniq.compact.map { |vh| [vh.created_by, vh.updated_by] }.flatten org_admins = organizations_for(records[Task], records[User]).map(&:admins).flatten (users + org_admins).uniq.compact.sort_by(&:id) end }, OrganizationsUser => { retrieval: ->(records) { OrganizationsUser.where(user: records[User]) } }, Organization => { # track_imported_ids = true so that an existing Organization in our dev environment can be reused # instead of importing/creating a new equivalent Organization. See comments for the SanitizedJsonImporter. track_imported_ids: true, retrieval: lambda do |records| organizations_for(records[Task], records[User]) end }, Person => { # track_imported_ids = true so that an existing (previously imported) Person can be reused track_imported_ids: true, retrieval: lambda do |records| # For unrecognized appellants, `claimant.person` returns a non-nil object with nil id # If PR #16768 is merged, then the `reject` call can be remove. (records[Veteran] + records[Claimant]).map(&:person).uniq.compact.sort_by(&:id) end }, # Put UnrecognizedPartyDetail before UnrecognizedAppellant so that it is imported in that order UnrecognizedPartyDetail => { retrieval: lambda { |records| party_detail_ids = records[Claimant].map(&:unrecognized_appellant).compact .pluck(:unrecognized_party_detail_id, :unrecognized_power_of_attorney_id) .flatten.uniq.compact UnrecognizedPartyDetail.where(id: party_detail_ids).order(:id) } }, UnrecognizedAppellant => { retrieval: ->(records) { records[Claimant].map(&:unrecognized_appellant).uniq.compact } } }.each do |clazz, class_configuration| class_configuration[:sanitize_fields] ||= self.class.select_sanitize_fields(clazz).tap do |fields| Rails.logger.info " Inferring #{clazz} sanitize_fields: #{fields}" unless fields.blank? end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_records!\n record_paths.map do |path|\n Record.load_record! self, path\n end\n end", "def each_record\n keys.sort.each {|key| yield @records[key]}\n end", "def post_load(all_records)\n end", "def retrieve_records_for_csv\n records = fetch_records\n records = filt...
[ "0.52207786", "0.5151005", "0.50964975", "0.49782836", "0.4942795", "0.49425337", "0.49337783", "0.4925551", "0.4903837", "0.48937133", "0.48876467", "0.48735088", "0.48409593", "0.4831705", "0.48140043", "0.48069277", "0.47941926", "0.4784603", "0.4769923", "0.475669", "0.47...
0.48772663
11
Types that need to be examine for associations so that '_id' fields can be updated by id_offset exclude id_mapping_types because we are reassociating those using id_mapping (don't try to id_offset them)
def reassociate_types # DecisionReview is parent class of Appeal, HLR, SC. We want associations to Appeals to be reassociated. @reassociate_types ||= (configuration.keys - id_mapping_types + [DecisionReview]).uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_mapping_types\n @id_mapping_types ||= extract_classes_with_true(:track_imported_ids, configuration)\n end", "def offset_id_fields\n @offset_id_fields ||= begin\n # In case a Class is associated with a specific decendant of one of the reassociate_types, include descendants.\n # Exclude id_...
[ "0.6707613", "0.6486344", "0.6236273", "0.59719974", "0.58081", "0.5785026", "0.55586743", "0.55296934", "0.5524956", "0.54505104", "0.5428395", "0.5426212", "0.5413607", "0.54130745", "0.54070604", "0.5367628", "0.5351629", "0.534516", "0.53392774", "0.53375757", "0.53111166...
0.6760612
0
Types whose id's are tracked in `importer.id_mapping` and are used by `reassociate_with_imported_records` or where we want to look up its new id
def id_mapping_types @id_mapping_types ||= extract_classes_with_true(:track_imported_ids, configuration) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapped_id\n input_hash = { type => cardname }\n map_card.import_item_class.new(input_hash).map_field type, cardname\n end", "def input_id_from_type(type); end", "def type_id\n\t\ttypes_id = [self.type1, self.type2]\n\t\treturn types_id\n\tend", "def reuse_record_types\n # Adding Organizat...
[ "0.6809189", "0.65613776", "0.64410603", "0.6305585", "0.62205654", "0.60356283", "0.5991556", "0.5965638", "0.5890043", "0.58662826", "0.582489", "0.58158326", "0.57922316", "0.57185245", "0.57185245", "0.5686333", "0.5639708", "0.56139845", "0.5601912", "0.55952334", "0.559...
0.7805389
0
Fields that will be offset by the id_offset when imported rubocop:disable Style/MultilineBlockChain
def offset_id_fields @offset_id_fields ||= begin # In case a Class is associated with a specific decendant of one of the reassociate_types, include descendants. # Exclude id_mapping_types since they will be handled by reassociate_with_imported_records via reassociate_fields known_types = (reassociate_types + reassociate_types.map(&:descendants).flatten - id_mapping_types).uniq reassociate_types.map do |klass| [ klass, AssocationWrapper.new(klass).grouped_fieldnames_of_typed_associations_with(known_types.map(&:name)) .values.flatten.sort ] end.to_h.tap do |class_to_fieldnames_hash| # array of decision_issue_ids; not declared as an association in Rails, so add it manually class_to_fieldnames_hash[CavcRemand].push("decision_issue_ids").sort! # Why is :participant_id listed as a association? Why is it a symbol whereas others are strings? class_to_fieldnames_hash[Claimant].delete(:participant_id) class_to_fieldnames_hash.transform_values!(&:uniq) end.compact end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutable_fields\n # everything but 0 (id) and 1 (scraped_at)\n to_a[2..-1]\n end", "def fields\n [:id]\n end", "def hash_offset\n super\n end", "def local_header_offset; end", "def offset; end", "def offset; end", "def offset; end", "def extract_id_line model_attributes, l...
[ "0.5914307", "0.56487054", "0.5556836", "0.5536714", "0.5424435", "0.5424435", "0.5424435", "0.5353005", "0.5345349", "0.5338955", "0.5318908", "0.53029794", "0.52909315", "0.529026", "0.52437466", "0.52010334", "0.52010334", "0.52010334", "0.51841474", "0.5150715", "0.510918...
0.68552256
0
rubocop:enable Style/MultilineBlockChain ========== SanitizedJsonExporterspecific Configuration ==============
def sanitize_fields_hash @sanitize_fields_hash ||= extract_configuration(:sanitize_fields, configuration, []) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure(conf)\n super\n fieldsToMaskFilePath = conf['fieldsToMaskFilePath']\n fieldsToExcludeJSONPaths = conf['fieldsToExcludeJSONPaths']\n handleSpecialCases = conf['handleSpecialEscapedJsonCases']\n\n if fieldsToExcludeJSONPaths != nil && fieldsToExcludeJSONPaths.size() >...
[ "0.58606136", "0.58579904", "0.57969946", "0.53759193", "0.5355115", "0.5303962", "0.52914506", "0.5200955", "0.5185151", "0.51816064", "0.51791483", "0.51791483", "0.5130108", "0.5105148", "0.5105148", "0.51016575", "0.5056962", "0.504672", "0.50033146", "0.49705672", "0.496...
0.48354596
49
Start with important types that other records will reassociate with. Then import according to the order in the Json file
def first_types_to_import # HearingDay is needed by Hearing @first_types_to_import ||= [Appeal, Organization, User, HearingDay, Task] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_initial_lines(type)\n @initial_lines.each do |initial_line|\n import_lines(type, initial_line[:file_name]) unless (initial_line[:type] != type ||\n initial_line[:file_name].nil?)\n end\n @initial_lines.delete_if do |il|\n il.ha...
[ "0.6511597", "0.6294878", "0.6166956", "0.60302776", "0.5942101", "0.58964133", "0.5892855", "0.58620065", "0.58074987", "0.5672739", "0.56457615", "0.5645657", "0.56414485", "0.55828375", "0.55629903", "0.55464953", "0.5511015", "0.5471509", "0.5451316", "0.5447581", "0.5445...
0.63652825
1
During record creation, types where validation and callbacks should be avoided
def types_that_skip_validation_and_callbacks @types_that_skip_validation_and_callbacks ||= [Task, *Task.descendants, Hearing, CavcRemand] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_on_create; end", "def before_create_save(record); end", "def validate_on_create=(_arg0); end", "def new_record?; end", "def new_record?; end", "def create; super(:type); end", "def validate_on_create #:doc:\n end", "def after_create_save(record); end", "def check_record; end", "...
[ "0.7088123", "0.6995758", "0.6907799", "0.67016745", "0.67016745", "0.66897345", "0.66681033", "0.6606673", "0.6400112", "0.6348529", "0.62426543", "0.6176563", "0.6130967", "0.6097956", "0.6097956", "0.6097956", "0.6097956", "0.60673326", "0.60673326", "0.60245126", "0.60180...
0.0
-1
Classes that shouldn't be imported if a record with the same unique attributes already exists These types should be handled in `find_existing_record`.
def reuse_record_types # Adding OrganizationsUser because we don't want to create duplicate OrganizationsUser records @reuse_record_types ||= id_mapping_types + [OrganizationsUser] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_classes\n @unique_classes\n end", "def transpose_hbase_row_to_record_attributes_and_raw_data(row) # :nodoc:\n if field = attributes_schema[inheritance_attribute]\n if cell_with_record_sti_class = row.columns[field.unique_name] and cell_with_record_sti_class.present?\n ...
[ "0.58128774", "0.5803857", "0.56213075", "0.550324", "0.54742396", "0.5431534", "0.5422836", "0.54203945", "0.5413581", "0.5413581", "0.5396596", "0.53946364", "0.5369681", "0.5331059", "0.53274274", "0.5296543", "0.528512", "0.5283768", "0.5280701", "0.52640164", "0.52377784...
0.5757301
2
For each class in reuse_record_types, provide a way to find the existing record :reek:UnusedParameters rubocop:disable Lint/UnusedMethodArgument
def find_existing_record(klass, obj_hash, importer: nil) if klass == User # The index for css_id has an odd column name plus find_by_css_id is faster. User.find_by_css_id(obj_hash["css_id"]) elsif klass == Organization # The url may need to be converted into a clean url Organization.unscoped.find_by_url(obj_hash["url"]) elsif klass == Appeal # uuid is not a uniq index, so can't rely on importer to do it automatically Appeal.find_by(uuid: obj_hash["uuid"]) elsif [Organization, Veteran, Person].include?(klass) # Let importer find it using the fallback: klass.unscoped.find_by(unique_field: obj_hash[unique_field]) nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reuse_record_types\n # Adding OrganizationsUser because we don't want to create duplicate OrganizationsUser records\n @reuse_record_types ||= id_mapping_types + [OrganizationsUser]\n end", "def find_existing_record\n @record = record_class.find(@locator)\n end", "def find_existing_record...
[ "0.6773602", "0.6683754", "0.6683754", "0.6329295", "0.6243304", "0.6210198", "0.6179745", "0.6037147", "0.59690064", "0.58567923", "0.58348143", "0.5739882", "0.5713015", "0.5713015", "0.57099444", "0.56932503", "0.5693194", "0.5693194", "0.5678802", "0.5677711", "0.5648393"...
0.61947066
6
:reek:LongParameterList :reek:UnusedParameters rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Lint/UnusedMethodArgument
def before_creation_hook(klass, obj_hash, obj_description: nil, importer: nil) # Basic check to make sure *`_id` fields have been updated remaining_id_fields = obj_hash.select do |field_name, field_value| field_name.ends_with?("_id") && field_value.is_a?(Integer) && (field_value < id_offset) && ( !(klass <= Task && field_name == "assigned_to_id" && obj_hash["assigned_to_type"] == "Organization") && !(klass <= OrganizationsUser && (field_name == "organization_id" || field_name == "user_id")) && !(klass <= VirtualHearing && field_name == "conference_id") && !(klass <= RequestIssue && field_name == "vacols_sequence_id") # Handle this when we can export VACOLS data ) end unless remaining_id_fields.blank? puts "!! For #{klass}, expecting these *'_id' fields be adjusted: #{remaining_id_fields}" \ "\n\tobj_hash: #{obj_hash}" \ "\n\tPossible fixes:" \ "\n\t- Check for a `belongs_to:` association in #{klass}" \ "\n\t- Check @configuration.reassociate_fields, specifically:" \ "\n\t AssocationWrapper.new(#{klass}).fieldnames_of_untyped_associations_with(assoc_class)" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variable_length( *args )\n return args\nend", "def long_string\n \"#{name}\"\n end", "def PO114=(arg)", "def max_sql_param_length=(_arg0); end", "def parameters=(_); end", "def arg_size; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", ...
[ "0.5707153", "0.5703799", "0.5664129", "0.5663453", "0.5659484", "0.5653084", "0.56249297", "0.56249297", "0.56249297", "0.56249297", "0.56249297", "0.56249297", "0.56249297", "0.56249297", "0.5609517", "0.560292", "0.55871046", "0.5569005", "0.55636895", "0.55591524", "0.555...
0.0
-1
rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Lint/UnusedMethodArgument ========== SanitizedJsonDifferencespecific Configuration ==============
def expected_differences @expected_differences ||= { User => [:display_name] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_json(options={})\n exclusion_list = []\n exclusion_list += ConfigCenter::Defaults::EXCLUDED_JSON_ATTRIBUTES\n exclusion_list += ConfigCenter::User::EXCLUDED_JSON_ATTRIBUTES\n options[:except] ||= exclusion_list\n super(options)\n end", "def json_options\n { except: %i[created_at updated...
[ "0.57582605", "0.5752056", "0.5727007", "0.55400705", "0.53507197", "0.53202534", "0.5301423", "0.52612984", "0.52588487", "0.52282864", "0.5179218", "0.51788366", "0.5159607", "0.5159607", "0.508821", "0.5079923", "0.5063526", "0.50633496", "0.50560087", "0.50560087", "0.502...
0.0
-1
transfer this content to a different Otu, if delete_from_incoming = false then the content (and figures, tags) is duplicated
def transfer_to_otu(otu, delete_from_incoming = true) return false if otu.id == self.otu_id c = Content.find(:first, :conditions => {:otu_id => otu.id, :content_type_id => self.content_type_id}) # does the incoming otu have this content_type already begin Content.transaction do if c # content already exists for the clone-to OTU c.text = c.text + " [Transfered from OTU #{self.otu_id}: #{self.text}]" # append content c.save! # deal with figures for f in self.figures if found = Figure.find(:first, :conditions => {:addressable_type => 'Content', :addressable_id => c.id , :image_id => f.image_id}) # append the caption found.caption += " [Transfered from OTU #{self.otu_id}: #{f.caption}]" f.destroy if delete_from_incoming else if delete_from_incoming # transfer the figure f.addressable_id = c.id f.save! else # clone the figure n = f.clone n.addressable_id = c.id end end end # deal with tags for t in self.tags if found = Tag.find(:first, :conditions => {:addressable_type => 'Content' , :addressable_id => c.id , :keyword_id => t.keyword_id }) # append the notes found.notes += " [Transfered from OTU #{self.otu_id}: #{t.notes}]" found.save! t.destroy if delete_from_incoming else if delete_from_incoming # transfer the tag t.addressable_id = c.id t.save! else #clone the tag n = t.clone n.addressable_id = c.id n.save! end end end self.destroy if delete_from_incoming else # content in transfer-to OTU doesn't exist if delete_from_incoming # just update the otu_id and everything gets transferred self.otu_id = otu.id self.save! else # need to clone everything # clone the content nc = self.clone nc.otu_id = otu.id nc.save! # clone figures for f in self.figures fn = f.clone fn.addressable_id = nc.id fn.save! end # clone tags for t in self.tags tn = t.clone tn.addressable_id = nc.id tn.save! end end end end rescue returns false end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duplicate\n rejected_attributes = %w[id type created_at updated_at respondents_count]\n questionnaire = self.class.name.constantize.new(self.attributes.reject{|key,value| rejected_attributes.include?(key)})\n questionnaire.save\n contents.each do |content|\n copy = content.copy\n question...
[ "0.5488495", "0.5395612", "0.53661823", "0.52977073", "0.5229243", "0.52288127", "0.52271634", "0.5225163", "0.5111374", "0.50239694", "0.5008581", "0.49382204", "0.49376822", "0.49363032", "0.4893044", "0.48917925", "0.48836592", "0.48836592", "0.4860427", "0.48568532", "0.4...
0.7755071
0
GET /vessels/1 GET /vessels/1.json
def show @vessel = Vessel.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @vessel } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @vessel = Vessel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vessel }\n end\n end", "def index\n @vessels =Vessel.all\n # respond_to do |format|\n # format.html # index.html.erb (no data required)\n render :json => {:suc...
[ "0.66314536", "0.6627615", "0.6282823", "0.6251329", "0.6251329", "0.6251329", "0.60443896", "0.60143477", "0.6001525", "0.5986162", "0.594146", "0.59327304", "0.59311175", "0.5928167", "0.5923674", "0.58985144", "0.58835036", "0.58720076", "0.58485514", "0.58485514", "0.5831...
0.7310757
0
GET /vessels/new GET /vessels/new.json
def new @vessel = Vessel.new respond_to do |format| format.html # new.html.erb format.json { render json: @vessel } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @vessel = Vessel.new(params[:vessel])\n\n respond_to do |format|\n if @vessel.save\n format.html { redirect_to @vessel, notice: 'Vessel was successfully created.' }\n format.json { render json: @vessel, status: :created, location: @vessel }\n else\n format.html { r...
[ "0.71412677", "0.7040876", "0.6959009", "0.6959009", "0.6959009", "0.6918327", "0.68515396", "0.68358815", "0.6825601", "0.6825601", "0.6825601", "0.6825601", "0.67301", "0.6727638", "0.6716468", "0.66982394", "0.66869193", "0.6685813", "0.6685813", "0.66740173", "0.6650085",...
0.7706345
0
POST /vessels POST /vessels.json
def create @vessel = Vessel.new(params[:vessel]) respond_to do |format| if @vessel.save format.html { redirect_to @vessel, notice: 'Vessel was successfully created.' } format.json { render json: @vessel, status: :created, location: @vessel } else format.html { render action: "new" } format.json { render json: @vessel.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @vessel = Vessel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vessel }\n end\n end", "def index\n @vessels =Vessel.all\n # respond_to do |format|\n # format.html # index.html.erb (no data required)\n render :json => {:suc...
[ "0.6325143", "0.6096843", "0.5877127", "0.5804668", "0.5804668", "0.57993144", "0.57603794", "0.55565643", "0.5531819", "0.5514321", "0.54377705", "0.5422368", "0.53299373", "0.530031", "0.52953553", "0.5293418", "0.5293418", "0.5293418", "0.52594644", "0.52493685", "0.52483"...
0.6809217
0
PUT /vessels/1 PUT /vessels/1.json
def update @vessel = Vessel.find(params[:id]) respond_to do |format| if @vessel.update_attributes(params[:vessel]) format.html { redirect_to @vessel, notice: 'Vessel was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @vessel.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end", "def save\n return if @vserver_hash.nil?\n put_rest \"vservers/#{@name}\", @vserver_hash.to_json, :content_type => \"application/json\"\n ...
[ "0.6124655", "0.603664", "0.5985073", "0.5851872", "0.5845683", "0.58050793", "0.5784251", "0.5783674", "0.56623185", "0.5660676", "0.56580627", "0.5655101", "0.5655101", "0.56456155", "0.5638604", "0.56153005", "0.5608431", "0.56065965", "0.55910116", "0.5568324", "0.5567862...
0.67784536
0
DELETE /vessels/1 DELETE /vessels/1.json
def destroy @vessel = Vessel.find(params[:id]) @vessel.destroy respond_to do |format| format.html { redirect_to vessels_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @sesh.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @shelf.destroy\n\n respo...
[ "0.6976491", "0.69751513", "0.6943145", "0.69266087", "0.68293095", "0.6735834", "0.6735834", "0.6694753", "0.6690704", "0.6680268", "0.6653131", "0.6642291", "0.66312534", "0.6624284", "0.6614946", "0.6608448", "0.6600113", "0.65959877", "0.65821975", "0.6574899", "0.6560887...
0.7488306
0
Get number of issues
def get_issue_count(params = {}) get('issues/count', params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def issue_count\n issue_count = 0\n self.sections.each { | section| issue_count += section.issue_count }\n issue_count\n end", "def unresolved_issue_count\n self.class.unresolved_issue_count(self.version_key).issuesUnresolvedCount\n end", "def issue_counter(repository, user)\n count = read...
[ "0.7965398", "0.7592887", "0.7546976", "0.7403098", "0.73607004", "0.73192346", "0.72543347", "0.7111271", "0.69012433", "0.6885053", "0.6826409", "0.67915237", "0.67780274", "0.67266726", "0.6708753", "0.6708753", "0.6708753", "0.6663873", "0.6627572", "0.66261923", "0.66076...
0.74029416
4
Create a new issue
def create_issue(summary, params = {}) params[:summary] = summary post('issues', params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_issue\n logger.info \"Creating new issue in project #{project.jira_project}: #{pull_request.title}\"\n\n jira_issue = PuppetLabs::Jira::Issue.build(client, project)\n fields = PuppetLabs::Jira::Formatter.format_pull_request(pull_request)\n\n jira_issue.create(fields[:summary], fields[:descri...
[ "0.8087365", "0.79821503", "0.7530172", "0.7517958", "0.7497236", "0.7471804", "0.7452476", "0.7452476", "0.7452476", "0.7452476", "0.74384683", "0.7435494", "0.743266", "0.7424615", "0.73655003", "0.73132974", "0.7307379", "0.7304438", "0.7285066", "0.7222192", "0.72130513",...
0.7302001
18
Get list of comments in issue
def get_comments(issue_id_or_key, params = {}) get("issues/#{issue_id_or_key}/comments", params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_comments()\n return self.get_all_comments()\n #issues = @issues\n #issues.each do |issue|\n # puts \"Processing issue #{issue['number']}...\"\n # comments = client.issue_comments( REPO, issue.number ) \n # num = issue['number']\n # @comments[num] = comments\n # issue[\"com...
[ "0.8119699", "0.8024778", "0.78581333", "0.7428378", "0.7371661", "0.7301939", "0.7233123", "0.7078583", "0.7039396", "0.7022081", "0.6960878", "0.6937891", "0.6882518", "0.6882518", "0.6852253", "0.6846798", "0.6846798", "0.6836529", "0.6826669", "0.6816166", "0.6816166", ...
0.74228466
4
Get number of comments in issue
def get_comment_count(issue_id_or_key) get("issues/#{issue_id_or_key}/comments/count") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_issue_comments(pr)\n q = <<-QUERY\n select count(*) as issue_comment_count\n from pull_requests pr, issue_comments ic, issues i\n where ic.issue_id=i.id\n and i.issue_id=pr.pullreq_id\n and pr.base_repo_id = i.repo_id\n and pr.id = ?\n and ic.created_at < (\n select max(created...
[ "0.80375814", "0.78442854", "0.7803128", "0.769726", "0.7604394", "0.75479126", "0.74564207", "0.7437644", "0.7361926", "0.7341429", "0.730922", "0.730922", "0.7279646", "0.72484404", "0.72437006", "0.72331953", "0.71807384", "0.70179033", "0.6997378", "0.697705", "0.6953203"...
0.80990833
0
Get a comment in issue
def get_comment(issue_id_or_key, comment_id) get("issues/#{issue_id_or_key}/comments/#{comment_id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comment\n @comment ||= client.issue_comments(repository, pr_id).detect do |comment|\n UrlSectionBuilder.match?(comment[:body])\n end\n end", "def get_comments(issue_id_or_key, params = {})\n get(\"issues/#{issue_id_or_key}/comments\", params)\n end", "def issue_comme...
[ "0.77748877", "0.7416454", "0.73740226", "0.72817725", "0.70992625", "0.7035779", "0.70254457", "0.7005281", "0.70028806", "0.69745594", "0.6972106", "0.69426554", "0.69364583", "0.6878847", "0.68704575", "0.6868477", "0.6868122", "0.68521976", "0.68475384", "0.6798412", "0.6...
0.7685366
1
Add a comment to an issue
def add_comment(issue_id_or_key, content, params = {}) params[:content] = content post("issues/#{issue_id_or_key}/comments", params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_comment_to_issue(issue, author)\n comment= RemoteComment.new(\"#{Time.now} , #{author} make a commit on this issue\")\n @tracker.addComment(issue.key,comment)\n end", "def add_comment_to_issue(issue_name, comment_text)\n\tissue = @client.Issue.find(issue_name)\n\tcomment = issue.comments.build\n\t...
[ "0.8089197", "0.79467", "0.77640975", "0.7745298", "0.74841446", "0.7473359", "0.7443088", "0.73836017", "0.7373967", "0.7354479", "0.731676", "0.73085916", "0.72415835", "0.7236789", "0.72366834", "0.72052276", "0.7199086", "0.7167564", "0.71075046", "0.7099437", "0.7099437"...
0.7864093
2
Update a comment in issue
def update_comment(issue_id_or_key, comment_id, content) patch("issues/#{issue_id_or_key}/comments/#{comment_id}", content: content) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_issue_comment(repo, comment_id, body, options = {})\n opts = options.dup\n opts[:body] = body\n patch \"#{Repository.path repo}/issues/comments/#{comment_id}\", opts\n end", "def edit_comment\n verify_ajax_request\n verify_post_request\n require_parameters :key, :tex...
[ "0.7907301", "0.7656686", "0.7418804", "0.74129546", "0.7392674", "0.7307388", "0.7109949", "0.7049308", "0.7008295", "0.69573927", "0.6957104", "0.695075", "0.6944579", "0.6908773", "0.6906692", "0.684261", "0.6816897", "0.6814549", "0.6807251", "0.68063426", "0.67632264", ...
0.7724546
1
Delete a comment in issue
def delete_comment(issue_id_or_key, comment_id) delete("issues/#{issue_id_or_key}/comments/#{comment_id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_comment repo, comment_id\n response = @@connection.delete do | request |\n request.url \"repos/#{repo}/issues/comments/#{comment_id}\"\n request.headers['Authorization'] = \"token #{@@token}\"\n end\n \n # look for Status: 204 No Content\n return if response.env[:status] != 204\...
[ "0.7574547", "0.75422066", "0.74674636", "0.7288316", "0.72864634", "0.7275076", "0.7269933", "0.72306573", "0.7226732", "0.7222159", "0.7138388", "0.7107827", "0.70948225", "0.7066929", "0.7060832", "0.7035572", "0.7008375", "0.69733375", "0.69503784", "0.6898652", "0.688885...
0.7507717
2
Get list of comment notifications
def get_comment_notifications(issue_id_or_key, comment_id) get("issues/#{issue_id_or_key}/comments/#{comment_id}/notifications") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_notifications\n BrickFTP::API::Notification.all\n end", "def list_notifications\n BrickFTP::API::Notification.all\n end", "def notifications\n response = query_api(\"/rest/notifications\")\n return response[\"notifications\"].map {|notification| Notification.new(self, notific...
[ "0.7374549", "0.7374549", "0.69970006", "0.69687027", "0.6922925", "0.69045454", "0.69045454", "0.6802117", "0.6792652", "0.67839134", "0.6717985", "0.6680071", "0.6648448", "0.6636595", "0.6630293", "0.6611877", "0.6573191", "0.6551723", "0.654401", "0.6470918", "0.6456214",...
0.7781826
0
Add notifications to an comment
def add_comment_notification(issue_id_or_key, comment_id, notified_user_ids = []) post("issues/#{issue_id_or_key}/comments/#{comment_id}/notifications", notified_user_id: notified_user_ids) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_comment\n Notifications.new_comment\n end", "def create_and_notify\n comment = build\n\n begin\n send_email_notification(comment)\n rescue => e\n puts \"#{e} was raised while attempting to send notification \" +\n \"on #{commentable.class} #{commentable.id} to User #{comm...
[ "0.7150474", "0.69357145", "0.6850026", "0.68098545", "0.6797611", "0.67964906", "0.67703325", "0.6768645", "0.67390275", "0.6639184", "0.6617014", "0.659849", "0.65697277", "0.65677613", "0.652839", "0.65186286", "0.65130574", "0.65089345", "0.65089345", "0.6485449", "0.6472...
0.79447526
0
Get list of attachment files on issue
def get_issue_attachments(issue_id_or_key) get("issues/#{issue_id_or_key}/attachments") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attachments\n @attachments ||= []\n end", "def attachments\n mail&.attachments || []\n end", "def files\n cached = FileAttachment.list_cache\n files = cached.select{|f|f.post_id == id}\n end", "def attached_files\n array = []\n frm.ul(:class=>/attachList/).lis.each { |li| arr...
[ "0.735213", "0.7184473", "0.71350557", "0.7124655", "0.70719796", "0.7045897", "0.7041767", "0.69778097", "0.6941627", "0.6941627", "0.6941627", "0.6925702", "0.69224507", "0.69080436", "0.6867059", "0.6858065", "0.68352264", "0.68186295", "0.67998123", "0.6701817", "0.668708...
0.7530368
0
Download an attachment file on issue
def download_issue_attachment(issue_id_or_key, attachment_id) get("issues/#{issue_id_or_key}/attachments/#{attachment_id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_attachment\n # Restituisce, in download, l'allegato del messaggio selezionato\n send_data @attachment.data, filename: @attachment.name, type: @attachment.mime_type, disposition: 'attachment'\n end", "def download_attachment attachment_index\n begin\n \n if...
[ "0.7413202", "0.7192898", "0.70706725", "0.702077", "0.6921668", "0.69170916", "0.688529", "0.6879542", "0.68184125", "0.68052745", "0.6772434", "0.6746603", "0.67400676", "0.6704077", "0.6703088", "0.66926885", "0.6691827", "0.6635251", "0.66091365", "0.6607071", "0.6588482"...
0.7212364
1
Remove an attachment file from issue
def remove_issue_attachment(issue_id_or_key, attachment_id) delete("issues/#{issue_id_or_key}/attachments/#{attachment_id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_pull_request_attachment(project_id_or_key, repository_id_or_name, pull_request_number, attachment_id)\n delete(\"projects/#{project_id_or_key}/git/repositories/#{repository_id_or_name}/pullRequests/#{pull_request_number}/attachments/#{attachment_id}\")\n end", "def remove_attachment(id)\n ...
[ "0.7368403", "0.73214513", "0.7283701", "0.7179721", "0.71336585", "0.71062714", "0.7017314", "0.7003985", "0.6918321", "0.6906192", "0.68704313", "0.68543947", "0.6847275", "0.6833314", "0.68252265", "0.6818027", "0.67413205", "0.6738437", "0.66895694", "0.6675633", "0.66730...
0.73177934
2
Get list of shared files on issue
def get_issue_shared_files(issue_id_or_key) get("issues/#{issue_id_or_key}/sharedFiles") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shared_to_me\n files_list = []\n files = session[:user].x_files_shared_to_me.all(uploaded: true)\n files.each { |file| files_list.push( file: file.description(session[:user]) ) }\n @result = { files: files_list, success: true }\n end", "def get_shared_files(user_id)\n shared_file_ids = $db.exe...
[ "0.69443357", "0.685378", "0.6770897", "0.65762115", "0.6477641", "0.6395731", "0.63722676", "0.6365683", "0.61791277", "0.6172824", "0.61666954", "0.61626214", "0.61431247", "0.6134919", "0.61289346", "0.6127906", "0.60910636", "0.60705173", "0.59688854", "0.5964039", "0.593...
0.7556193
0
Link shared files to an issue
def link_issue_shared_files(issue_id_or_key, file_ids = []) post("issues/#{issue_id_or_key}/sharedFiles", file_id: file_ids) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_issue_shared_files(issue_id_or_key)\n get(\"issues/#{issue_id_or_key}/sharedFiles\")\n end", "def link_include_file(file); end", "def link_include_file(file); end", "def use_shared_path\n include_str = '#include \"'\n include_re = Regexp.new \"^#{include_str}(.*)\"\n @lines.each_...
[ "0.6258743", "0.6034655", "0.6034655", "0.5874105", "0.5809212", "0.5807989", "0.5769162", "0.57579356", "0.5748882", "0.570846", "0.56238204", "0.56181014", "0.5609166", "0.5589885", "0.5573624", "0.5542652", "0.55132174", "0.55061", "0.5502116", "0.54498285", "0.5447712", ...
0.70881426
0
Unlink a shared file on issue
def unlink_issue_shared_file(issue_id_or_key, file_id) delete("issues/#{issue_id_or_key}/sharedFiles/#{file_id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unlink\n return if @unlinked\n begin\n File.unlink(@tmpfile.path)\n rescue Errno::ENOENT\n rescue Errno::EACCES\n # may not be able to unlink on Windows; just ignore\n return\n end\n ObjectSpace.undefine_finalizer(self)\n @unlinked = true\n end", "def safe_unlink\n (...
[ "0.6835502", "0.6779051", "0.6714944", "0.66637033", "0.65529305", "0.64951986", "0.64709526", "0.6445379", "0.6391582", "0.6379187", "0.63488007", "0.6348048", "0.63123816", "0.6292547", "0.6107477", "0.60827035", "0.6077571", "0.60568106", "0.6042102", "0.60200727", "0.6015...
0.7330847
0
affiche le lien d'action en fonction de l'attribut "state" (du statut) de l'association dans la BDD
def possible_state_link(association) case association.state when "non_verifiee" link_to "Valider", accept_association_path(association), :method => :put when "acceptee" link_to "Suspendre", suspend_association_path(association), :method => :put when "suspendue" link_to "Ré-activer", unsuspend_association_path(association), :method => :put end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state\n end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def alaram_operation action\n @state = action\n notify\nend", "def show_state\n puts \"#{@name} a #{@life_points} de vie\"\n ...
[ "0.64969987", "0.62602633", "0.62602633", "0.62602633", "0.62602633", "0.62602633", "0.62602633", "0.62602633", "0.62602633", "0.62566274", "0.62189686", "0.61994714", "0.61642504", "0.61300975", "0.6120703", "0.61168486", "0.6112691", "0.61020815", "0.60912967", "0.60884976", ...
0.6193477
12
App Academy Recap 3 General Problems Write a method no_dupes?(arr) that accepts an array as an arg and returns an new array containing the elements that were not repeated in the array.
def no_dupes?(arr) count_hash = Hash.new(0) non_dupes = [] arr.each { |ele| count_hash[ele] += 1 } count_hash.each do |key, val| non_dupes << key if val == 1 end non_dupes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nondupes(array)\n new_array = []\n array.each do |elem| \n if array.count(elem) == 1\n new_array << elem \n end\n end\n new_array\nend", "def nondupes(array)\n array.map do |elem| \n array.count(elem) == 1\n \n end\n \nend", "def no_dupes?(arr)\n counter = Hash.new(0)\n arr.each...
[ "0.8756142", "0.837631", "0.81891894", "0.8143107", "0.8089287", "0.807813", "0.80694443", "0.803007", "0.80067337", "0.7953746", "0.7927454", "0.788789", "0.78746617", "0.7798887", "0.7766651", "0.77337337", "0.77212054", "0.7670324", "0.75962496", "0.75694793", "0.75322986"...
0.8016319
8
Write a method no_consecutive_repeats?(arr) that accepts an array as an arg. The method should return true if an element never appears consecutively in the array; it should return false otherwise.
def no_consecutive_repeats?(arr) (0...arr.length - 1).each do |idx| next_idx = idx + 1 return false if arr[idx] == arr[next_idx] end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def no_consecutive_repeats?(arr)\n (0...arr.length - 1).each do |i|\n return false if arr[i] == arr[i + 1]\n end\n\n true\nend", "def no_consecutive_repeats?(arr)\n (0...arr.length-1).each { |i| return false if arr[i] == arr[i+1] }\n true\nend", "def no_consecutive_repeats?(arr)\n (0...arr.lengt...
[ "0.9103619", "0.9100269", "0.9097766", "0.9096767", "0.90946764", "0.90946764", "0.9092634", "0.90894747", "0.90800077", "0.90586644", "0.9017271", "0.90137225", "0.89802486", "0.89690584", "0.8955484", "0.89242935", "0.88973355", "0.88584125", "0.8827246", "0.8819199", "0.87...
0.9020517
10
Write a method char_indices(str) that takes in a string as an arg. The method should return a hash containing characters as keys. The value associated with each key should be an array containing the indices where that character is found.
def char_indices(str) indices = Hash.new { |h, k| h[k] = Array.new} str.each_char.with_index do |char, idx| indices[char] << idx end indices end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def char_indices(str)\n char_hash = Hash.new { |h, k| h[k] = [] }\n str.chars.each_with_index { |char, i| char_hash[char] << i }\n char_hash\nend", "def char_indices(str)\n indices = Hash.new { |hash, key| hash[key] = [] }\n\n str.each_char.with_index { |char, index| indices[char].push(index) }\n\n ...
[ "0.89093083", "0.8906357", "0.8897903", "0.88914204", "0.8880959", "0.8877668", "0.8872854", "0.88621855", "0.8853196", "0.88459414", "0.88423556", "0.884049", "0.8817042", "0.8812982", "0.8807521", "0.88069075", "0.8806213", "0.87800676", "0.87704504", "0.8670705", "0.866372...
0.89152837
1
Write a method longest_streak(str) that accepts a string as an arg. The method should return the longest streak of consecutive characters in the string. If there are any ties, return the streak that occurs later in the string.
def longest_streak(str) longest = "" test_str = "" (0...str.length).each do |i| char = str[i] next_char = str[i + 1] if char == next_char test_str += char longest = test_str if test_str.length >= longest.length else test_str += char longest = test_str if test_str.length >= longest.length test_str = "" end end longest end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_streak(str)\n return str if str.length < 2\n \n max_streak = \"\"\n i = 0\n j = 1\n while i < str.length - 1\n j = i + 1\n cur_streak = \"\"\n while j < str.length && str[i] == str [j]\n j += 1\n end\n\n cur_streak = str[i...j]\n ma...
[ "0.8905916", "0.85314137", "0.8423839", "0.832717", "0.7749023", "0.6974566", "0.69017667", "0.6803562", "0.67698336", "0.6701359", "0.6651932", "0.6626022", "0.6620382", "0.66090685", "0.66013545", "0.65634537", "0.651866", "0.65102375", "0.65080094", "0.6489833", "0.6482348...
0.85589254
1
Write a method bi_prime?(num) that accepts a number as an arg and returns a boolean indicating whether or not the number is a biprime. A biprime is a positive integer that can be obtained by multiplying two prime numbers.
def bi_prime?(num) (2...num).each do |i| if num % i == 0 && !((2...i).any? { |x| i % x == 0 }) j = num / i return true if !((2...j).any? { |x| j % x == 0 }) end end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bi_prime?(num)\n factors = []\n (2...num).each {|n| factors << n if num % n == 0}\n (0...factors.length).each do |i1|\n (i1...factors.length).each do |i2|\n return true if factors[i1]*factors[i2] == num && (is_prime?(factors[i1]) && is_prime?(factors[i2]))\n end\n end\n ...
[ "0.84915876", "0.8473191", "0.84685457", "0.84235847", "0.8390234", "0.8333922", "0.82611114", "0.8245947", "0.82449317", "0.82337654", "0.81930286", "0.8183972", "0.81530243", "0.81488043", "0.81470954", "0.8141784", "0.8134296", "0.8121681", "0.77680004", "0.6946696", "0.69...
0.81651354
12
Write a method vigenere_cipher(message, keys) that accepts a string and a keysequence as args, returning the encrypted message. Assume that the message consists of only lowercase alphabetic characters.
def vigenere_cipher(message, keys) alphabet = ("a".."z").to_a encrypted = "" message.each_char.with_index do |char, idx| shift = keys[idx % keys.length] encrypted += alphabet[(alphabet.index(char) + shift) % 26] end encrypted end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vigenere_cipher(message, keys)\n key_idx = 0\n new_message = \"\"\n message.each_char do |char|\n new_message += cipher(char, keys[key_idx])\n key_idx = (key_idx + 1) % keys.length\n end\n\n new_message\nend", "def vigenere_cipher(message, keys)\n new_string = ''\n alphabet = '...
[ "0.84981894", "0.8290111", "0.8206111", "0.8156033", "0.80856216", "0.8075021", "0.8042322", "0.8028325", "0.8013691", "0.79481316", "0.79385847", "0.7914145", "0.78706354", "0.7856172", "0.7762616", "0.77184325", "0.7686398", "0.7596226", "0.7566065", "0.75563127", "0.755544...
0.82533705
2
Write a method vowel_rotate(str) that accepts a string as an arg and returns the string where every vowel is replaced with the vowel the appears before it sequentially in the original string. The first vowel of the string should be replaced with the last vowel.
def vowel_rotate(str) vowels = "aeiou" str_vowels = [] str.each_char { |char| str_vowels << char if vowels.include?(char) } str_vowels.unshift(str_vowels.pop) str.each_char.with_index do |char, idx| str[idx] = str_vowels.shift if vowels.include?(char) end str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vowel_rotate(str)\n new_str = str[0..-1]\n vowels = 'aeiou'\n\n vowel_idxs = (0...str.length).select { |i| vowels.include?(str[i]) }\n rotated_vowel_idxs = vowel_idxs.rotate(-1)\n\n vowel_idxs.each_with_index do |vowel_idx, i|\n new_vowel = str[rotated_vowel_idxs[i]]\n new_str[vowe...
[ "0.9083481", "0.9078906", "0.9049493", "0.8996624", "0.89831287", "0.8959912", "0.8877363", "0.8873371", "0.8871982", "0.88480127", "0.88406193", "0.88361347", "0.87715214", "0.87446207", "0.86967576", "0.8610895", "0.86067927", "0.86017424", "0.8583132", "0.856907", "0.84911...
0.8925403
6
Recursion Problems Write a method multiply(a, b) that takes in two numbers and returns their product. You must solve this recursively (no loops!) You must not use the multiplication () operator
def multiply(a, b) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply(a,b)\n if a == 0 || b == 0\n return 0\n end\n if a == 1\n return b\n end\n if a > 0\n b + multiply(a-1,b)\n elsif a < 0 && b < 0\n multiply(-a,-b)\n else\n multiply(-a,-b)\n end\nend", "def multiply(a, b)\n if b == 0 \n return 0\n ...
[ "0.79149705", "0.7732279", "0.768093", "0.7639337", "0.7468944", "0.7461069", "0.74396235", "0.7402958", "0.7375897", "0.73585415", "0.73585415", "0.73573536", "0.7351176", "0.734888", "0.7338796", "0.7338796", "0.7317121", "0.7311207", "0.7311032", "0.73050547", "0.73035544"...
0.7416693
7
Write a method lucasSequence that accepts a number representing a length as an arg. The method should return an array containing the Lucas Sequence up to the given length. Solve this recursively.
def lucas_sequence(len) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lucas_sequence(length)\n return [] if length == 0\n return [2] if length == 1\n return [2,1] if length == 2\n return lucas_sequence(length-1) + [lucas_sequence(length-1)[length-2]+lucas_sequence(length-2)[length-3]] \nend", "def lucas_sequence(length)\n return [] if length == 0\n return [2]...
[ "0.84633064", "0.7869419", "0.78584695", "0.7841103", "0.7757456", "0.7746967", "0.7721367", "0.76537764", "0.76229054", "0.7575284", "0.7570604", "0.75270164", "0.7480344", "0.69789594", "0.69701266", "0.6887224", "0.68848366", "0.68210477", "0.67894554", "0.6742586", "0.673...
0.8073264
1
Write a method prime_factorization(num) that accepts a number and returns an array representing the prime factorization of the given number. This means that the array should contain only prime numbers that multiply together to the given num. The array returned should contain numbers in ascending order. Do this recursively.
def prime_factorization(num) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prime_factorization(num)\n # Base case - 1 is not a prime so we return an empty array here\n return [] if num == 1\n \n # initialize i to 2, since it is the first prime #\n i = 2\n \n # increment i until we find a prime factor\n i += 1 until is_prime?(i) && num % i == 0 \n \n # Add i to prime factors...
[ "0.86652726", "0.86483717", "0.85931784", "0.8378002", "0.83773553", "0.8323755", "0.8296952", "0.82956994", "0.8280144", "0.8255729", "0.8209951", "0.82045823", "0.8130706", "0.80899984", "0.8079668", "0.8076935", "0.80741715", "0.8037965", "0.8024967", "0.7948187", "0.79456...
0.73716134
37
Supplies the full name of an individual or organizational entity Required when the insured or subscriber is different from the patient
def service_prov_name Output835.log.info "Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}" prov_id, qualifier = service_prov_identification service_prov_name_elements = [] service_prov_name_elements << 'NM1' service_prov_name_elements << '82' service_prov_name_elements << (eob.rendering_provider_last_name.strip.blank? ? '2': '1') service_prov_name_elements << prov_last_name_or_org service_prov_name_elements << eob.rendering_provider_first_name service_prov_name_elements << eob.rendering_provider_middle_initial service_prov_name_elements << '' service_prov_name_elements << '' service_prov_name_elements << qualifier service_prov_name_elements << prov_id service_prov_name_elements = Output835.trim_segment(service_prov_name_elements) service_prov_name_elements.join(@element_seperator) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insured_name\n if @eob_type != 'Patient'\n id, qual = @eob.member_id_and_qualifier\n ['NM1', 'IL', '1', @eob.subscriber_last_name, @eob.subscriber_first_name,\n @eob.subscriber_middle_initial, '', @eob.subscriber_suffix, qual,id].trim_segment.join(@element_seperator)\n end\n end", "de...
[ "0.7124015", "0.70159125", "0.69804823", "0.6945414", "0.6944017", "0.69059515", "0.6895865", "0.6844016", "0.6837902", "0.6817726", "0.6814579", "0.679747", "0.679667", "0.67831546", "0.6719288", "0.67071074", "0.67027724", "0.6682217", "0.66741335", "0.6673541", "0.66539186...
0.0
-1
Specifies pertinent From date of the claim
def claim_from_date unless eob.claim_from_date.blank? if eob.claim_from_date.strftime("%Y%m%d") == "20000101" claim_from_date = "00000000" else claim_from_date = eob.claim_from_date.strftime("%Y%m%d") end Output835.log.info "Claim From Date:#{claim_from_date}" claim_date_elements = [] claim_date_elements << 'DTM' claim_date_elements << '232' claim_date_elements << claim_from_date claim_date_elements.join(@element_seperator) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def claim_from_date\n unless eob.claim_from_date.blank?\n Output835.log.info \"Claim From Date:#{eob.claim_from_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << eob.claim_from_date.strftime(\"%Y%m%d\")\n claim...
[ "0.7640786", "0.7302009", "0.7302009", "0.7261238", "0.71566117", "0.7124318", "0.7050598", "0.6810359", "0.6754901", "0.6754901", "0.6754901", "0.6754901", "0.6754901", "0.6397001", "0.6359166", "0.6250808", "0.6250808", "0.622738", "0.6226954", "0.61623454", "0.61395293", ...
0.7557146
1
Specifies pertinent To dates of the claim
def claim_to_date unless eob.claim_to_date.blank? if eob.claim_from_date.strftime("%Y%m%d") == "20000101" claim_to_date = "00000000" else claim_to_date = eob.claim_to_date.strftime("%Y%m%d") end Output835.log.info "Claim To Date:#{eob.claim_to_date}" claim_date_elements = [] claim_date_elements << 'DTM' claim_date_elements << '233' claim_date_elements << claim_to_date claim_date_elements.join(@element_seperator) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to(date)\n @to = fmt_date(date)\n end", "def claim_to_date\n unless eob.claim_to_date.blank?\n Output835.log.info \"Claim To Date:#{eob.claim_to_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '233'\n claim_date_elements << eob.claim_...
[ "0.6751376", "0.67212474", "0.6372782", "0.6372782", "0.6312275", "0.62085336", "0.6140801", "0.61147004", "0.600482", "0.59533244", "0.57597077", "0.5709655", "0.5695636", "0.56839246", "0.56524444", "0.5650989", "0.5627358", "0.5551082", "0.5514058", "0.54903793", "0.544020...
0.69593406
0
GET /order_positions GET /order_positions.json
def index @order_positions = OrderPosition.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @positions = Position.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @positions }\n end\n end", "def positions(id)\n get(\"/accounts/#{id}/positions\")['positions']\n end", "def show\n @order = Order.find(params[:id])\n @...
[ "0.6849224", "0.6788053", "0.6736981", "0.6585975", "0.6569936", "0.6566384", "0.6565328", "0.65027773", "0.6414493", "0.6384472", "0.6346367", "0.62854344", "0.62756705", "0.6253838", "0.62483907", "0.62141925", "0.61935997", "0.6185079", "0.6182243", "0.61225283", "0.610763...
0.75654644
0
GET /order_positions/1 GET /order_positions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @order_positions = OrderPosition.all\n end", "def show\n @order = Order.find(params[:id])\n @order_positions = @order.order_positions\n @address = Address.find(@order.address_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n...
[ "0.7246592", "0.7141553", "0.6911284", "0.6837993", "0.66501564", "0.6555172", "0.65306014", "0.6493999", "0.64315015", "0.64315015", "0.64315015", "0.64315015", "0.6382314", "0.63306373", "0.62993217", "0.62459207", "0.6207839", "0.6171956", "0.6171956", "0.61687285", "0.616...
0.0
-1
POST /order_positions POST /order_positions.json
def create @order_position = OrderPosition.new(order_position_params) respond_to do |format| if @order_position.save format.html { redirect_to @order_position, notice: 'Order position was successfully created.' } format.json { render :show, status: :created, location: @order_position } else format.html { render :new } format.json { render json: @order_position.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @order = Order.new(params[:order])\n @addresses = Address.where(:user_id => current_user.id)\n @order.status = 0;\n @order.delivery_cost = @order.delivery.cost\n @order.user = current_user\n @order_positions = current_user.basket.order_positions\n @order.order_positions = @order_p...
[ "0.73396015", "0.66140354", "0.65370804", "0.6519541", "0.6509135", "0.6493076", "0.64211136", "0.64195067", "0.64195067", "0.6419229", "0.6298737", "0.62471855", "0.6207999", "0.61929876", "0.61530614", "0.61404973", "0.6120477", "0.6120046", "0.6119416", "0.6115409", "0.609...
0.72351944
1
PATCH/PUT /order_positions/1 PATCH/PUT /order_positions/1.json
def update respond_to do |format| if @order_position.update(order_position_params) format.html { redirect_to @order_position, notice: 'Order position was successfully updated.' } format.json { render :show, status: :ok, location: @order_position } else format.html { render :edit } format.json { render json: @order_position.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @circle, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @circle }\n else\n format.html { render :edit }\n format.json { render ...
[ "0.67106843", "0.66261023", "0.65948343", "0.65948343", "0.65947306", "0.65878975", "0.6587687", "0.65780777", "0.65760165", "0.65649265", "0.6554842", "0.652759", "0.6524344", "0.65165645", "0.65147555", "0.65113133", "0.6511166", "0.64923865", "0.6490169", "0.64900744", "0....
0.7201183
0
DELETE /order_positions/1 DELETE /order_positions/1.json
def destroy @order_position.destroy respond_to do |format| format.html { redirect_to order_positions_url, notice: 'Order position was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_t...
[ "0.72406465", "0.7201399", "0.71858144", "0.71140534", "0.70778614", "0.7065826", "0.7044304", "0.70287937", "0.7012147", "0.70115817", "0.6984221", "0.6946804", "0.6936765", "0.6929112", "0.6929112", "0.6929112", "0.6925413", "0.69226277", "0.69201857", "0.6918394", "0.69166...
0.7378558
0
Use callbacks to share common setup or constraints between actions.
def set_order_position @order_position = OrderPosition.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.61637366", "0.60446453", "0.59452957", "0.591511", "0.58885515", "0.5834122", "0.57761765", "0.5702554", "0.5702554", "0.5652102", "0.5619581", "0.5423898", "0.5409782", "0.5409782", "0.5409782", "0.5394745", "0.53780794", "0.5356209", "0.5338898", "0.53381324", "0.5328622...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def order_position_params params.require(:order_position).permit(:ordinal, :amount, :completed, :price) 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.69780594", "0.678054", "0.6742781", "0.67387927", "0.67346025", "0.6590683", "0.6501642", "0.6495788", "0.6479752", "0.64763314", "0.645457", "0.6437739", "0.6377168", "0.6372484", "0.6363871", "0.63179374", "0.62981373", "0.6297456", "0.62916917", "0.6290227", "0.628954",...
0.0
-1
Returns product list path with current request parameters (except page) combined with parameters given in _params
def products_path_with_params(_params) url_for( params.except(:page). merge(:controller => 'products', :action => 'index'). merge(_params) ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_list_page\n param_hash_to_link_hash params\n end", "def products_path\n \tmain_app.send(Auth::OmniAuth::Path.create_or_index_path(Auth.configuration.product_class))\n end", "def current_path(*path_params)\n if path_params.last.is_a?(Hash)\n path_params[-1] = params.merge(p...
[ "0.6276042", "0.5923099", "0.59049284", "0.58664894", "0.58469653", "0.5831759", "0.5804459", "0.5803605", "0.5780209", "0.5775488", "0.5685221", "0.567827", "0.56478316", "0.5642128", "0.56398845", "0.5621621", "0.5552251", "0.5519152", "0.5487978", "0.54870284", "0.5482337"...
0.81594205
0
returns image tag for a Product's photo
def product_photo(product, style = product.photo.default_style, img_options = {}) # add width and height attributes if the style has constant image dimensions img_options.reverse_merge! case style when :thumb then {:size => '75x75'} when :mobile_thumb then {:size => '40x40'} else {} end img_options.reverse_merge! :border => 0 image_tag product.photo.url(style), img_options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pet_image_tag\n return '' if pet.image_id.to_s.empty?\n\n html.div class: 'pet' do\n h2 'Actual image'\n img src: \"#{UrlAws}#{pet.image_id}\"\n end\n end", "def image_name\n @image_name || image_bundle.image_name\n end", "def product_image(wrapped_product, specified_ima...
[ "0.69663787", "0.67675924", "0.6710714", "0.67105806", "0.66505", "0.6618057", "0.6568098", "0.65274656", "0.6523575", "0.6494256", "0.6433707", "0.642375", "0.6416436", "0.6369022", "0.63449943", "0.6326917", "0.63145506", "0.6313091", "0.6298036", "0.62856627", "0.6262797",...
0.71631205
0
Once a session is created, automatically load the stdapi extension if the advanced option is set to true.
def on_session(session) super if (datastore['AutoLoadStdapi'] == true) session.load_stdapi if (framework.exploits.create(session.via_exploit).privileged?) session.load_priv end end if (datastore['AutoRunScript'].empty? == false) session.execute_script(datastore['AutoRunScript'], binding) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_stdapi()\n\t\toriginal = console.disable_output\n\n\t\tconsole.disable_output = true\n\t\tconsole.run_single('use stdapi')\n\t\tconsole.disable_output = original\n\tend", "def api_mode; end", "def new_session(options={})\n if supports_sessions?\n api.rest_method('ADD_AUTHORIZATION', {\...
[ "0.6849546", "0.559479", "0.5592704", "0.54332274", "0.5419051", "0.5419051", "0.54087895", "0.5407395", "0.54065907", "0.5373787", "0.5348628", "0.5300522", "0.5229834", "0.5229834", "0.52175677", "0.5143168", "0.5119237", "0.5081636", "0.5070724", "0.505303", "0.5040627", ...
0.66298044
1
define a method to prompt the user for a few options
def user_input(prompt = "", newline=false) prompt += "\n" if newline Readline.readline(prompt, true).squeeze(" ").strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prompt_action \n puts \"You have six options: list users, list channels, select user, select channel, display details, send message, or quit.\"\n puts \"\\n\"\n print \"Please enter your choice: \"\n return gets.chomp.downcase\nend", "def prompt(message=\"Are you sure?\", options=\"Yn\")\n opts = o...
[ "0.76536447", "0.7609533", "0.7609533", "0.755294", "0.74655265", "0.7401428", "0.736899", "0.7294785", "0.7283587", "0.7281752", "0.7281752", "0.7281752", "0.7281752", "0.7250299", "0.7244305", "0.7215436", "0.7203328", "0.7193315", "0.7186257", "0.7178042", "0.71757907", ...
0.0
-1
define a method to list available wav files to be played
def file_choices puts "You have the following file choices:" list_of_files = Dir["*.wav"] puts " #{list_of_files}" @file_to_play = user_input "\nWhich file would you like to play?\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sounds_list(params = {})\n get \"sounds\", params\n end", "def files\n # fetch the appropriate files\n filenames = Dir.glob(@path + \"/*.mp3\")\n filenames.map { |filename| @files << File.basename(filename) }\n @files\n end", "def files\n filename = Dir.entries(@path).find_all {|fil...
[ "0.68870455", "0.6817363", "0.67226917", "0.67137223", "0.6691195", "0.6599371", "0.65941644", "0.6547138", "0.6451279", "0.6439996", "0.64379114", "0.6398545", "0.63928515", "0.63839966", "0.6373917", "0.63468313", "0.63293344", "0.63160604", "0.630857", "0.62627035", "0.623...
0.6817623
1
define a method to display options to the user of how they want to play the file
def provide_user_option @user_choice = user_input "\nWhat would you like to do?\nPress 1 to pick a file and play normally\nPress 2 to play file in reverse\nPress 3 if you'd like to exit\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_options\n puts '1. Start a new game [new]'\n puts '2. Load a saved game [load]'\n puts '3. Quit the game [quit]'\nend", "def file_choices \r\n puts \"You have the following file choices:\"\r\n list_of_files = Dir[\"*.wav\"]\r\n puts \" #{list_of_files}\"\r\n @file_to_play = user_input \"\\nWhi...
[ "0.7259016", "0.6896833", "0.6611265", "0.661057", "0.6596936", "0.6596936", "0.6596936", "0.6596936", "0.6596936", "0.6596936", "0.6585801", "0.6497452", "0.6429062", "0.64272606", "0.6362029", "0.6342753", "0.6329081", "0.6180683", "0.61730504", "0.6168056", "0.61619955", ...
0.6720067
2
Alert after 2 WAL segments worth of lag. (MB)
def usage puts("#{$0} -m <masterip> -s <slaveip> -h <host_id> [-i <sampling_interval>]") puts(" -m: The IPAddress of the master db server. 1.2.3.4") puts(" -s: The IPAddress of the slave db server. 1.2.3.4") puts(" -h: The hostname of the machine. Instance ID or UUID") puts(" -i: The sample interval of the file check (in seconds). Default: 20 seconds") exit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_lag( slave_xlog )\n s_segment, s_offset = slave_xlog.split( /\\// )\n # hex result converting to bytes\n return (( $segment.hex - s_segment.hex ) * $segbytes) + ( $offset.hex - s_offset.hex )\n end", "def watch_interval; end", "def lag_bytes\n typed_exec(<<-SQL).to_a\n SELECT...
[ "0.5615091", "0.5412209", "0.5338462", "0.51034164", "0.50881445", "0.50813866", "0.50548935", "0.5054587", "0.5022406", "0.50085205", "0.5000012", "0.4989339", "0.49812454", "0.49643207", "0.49581817", "0.4957453", "0.49516565", "0.4939885", "0.49395582", "0.49388182", "0.49...
0.0
-1
check server status/role if this is master server, skip to run this script. This script should run only on slave server
def detect_if_master read_only = `/usr/pgsql-9.1/bin/pg_controldata /var/lib/pgsql/9.1/data | grep "Database cluster state" | awk '{print $NF}'` return true if read_only =~ /production/ end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_master_server!\n unless master_server && master_server.running?\n puts \"This command needs a saltmaster running in order to function and \n one cannot be found. Please check your configuration if you have a master\n defined. If you believe you received this message in error, let us k...
[ "0.73069656", "0.71517617", "0.68692636", "0.68441504", "0.6760395", "0.6639846", "0.6613766", "0.65993756", "0.64400136", "0.63885415", "0.6387405", "0.63719594", "0.6357812", "0.6288672", "0.62814516", "0.6270337", "0.6214875", "0.6205455", "0.61724794", "0.6154958", "0.613...
0.6816312
4
Given an +xlog+ position from a slave server, return the number of bytes the slave needs to replay before it is caught up to the master.
def find_lag( slave_xlog ) s_segment, s_offset = slave_xlog.split( /\// ) # hex result converting to bytes return (( $segment.hex - s_segment.hex ) * $segbytes) + ( $offset.hex - s_offset.hex ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replication_lag_size\n location = connection.quote(primary_write_location)\n row = query_and_release(<<-SQL.squish)\n SELECT pg_wal_lsn_diff(#{location}, pg_last_wal_replay_lsn())::float\n AS diff\n SQL\n\n row['diff'].to_i if row.any?\n rescue...
[ "0.5780693", "0.53557575", "0.5270478", "0.5227185", "0.5216391", "0.51855266", "0.508169", "0.50788784", "0.5063817", "0.5058982", "0.50510347", "0.503252", "0.5027165", "0.49205053", "0.48874652", "0.48866153", "0.48600137", "0.48419705", "0.48374963", "0.48131508", "0.4789...
0.6547434
0
build employee hash code
def build_hash_code SecureRandom.hex(8) + (Time.now.to_f * 1000).to_i.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{s...
[ "0.66562253", "0.66562253", "0.66562253", "0.66562253", "0.66562253", "0.66562253", "0.66562253", "0.65849143", "0.640942", "0.6375075", "0.6305144", "0.62846726", "0.62642354", "0.6187096", "0.6187096", "0.6170933", "0.61541325", "0.6121255", "0.6110692", "0.6108237", "0.610...
0.68297774
0
using the orginal head node, move every next node to the front save the newHead (node.next) overwrite it (node.next = node.next.next) now move the newHead to the beginning (newHead.next = head) and finish the loop by resetting the head (head = newHead) runtime O(n), space O(1)
def reverse_list(head) return nil if !head node = head # node is always pointing at the original head while node.next newHead = node.next node.next = node.next.next newHead.next = head head = newHead end head end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_front(node)\n temp_node = @head\n @head = node\n @head.next = temp_node\n end", "def add_to_front(node)\n temp_node = @head\n @head = node\n @head.next = temp_node\n end", "def add_to_front(node)\n temp = @head\n @head = node\n @head.next = temp\n end", "def add_to_fr...
[ "0.7349087", "0.7349087", "0.730357", "0.7293848", "0.72632974", "0.7172781", "0.71468246", "0.71468246", "0.71468246", "0.70937765", "0.70599556", "0.70577", "0.7057666", "0.7037786", "0.701738", "0.70070595", "0.69739866", "0.6969764", "0.6969764", "0.6969764", "0.6965304",...
0.66958374
47
Return whether a user is absent from the auth context.
def anonymous? user.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_authenticated(user_id)\n if user_id == nil\n return true\n else\n return false\n end\n end", "def user_exists?(user)\n return !get_user(user).nil?\n end", "def if_not_logged_in\n !view_context.user_signed_in?\n end", "d...
[ "0.68521786", "0.6799903", "0.66755724", "0.6630315", "0.658725", "0.65572935", "0.6532652", "0.6492266", "0.6469272", "0.64600724", "0.64272064", "0.6417721", "0.641196", "0.64035755", "0.63932115", "0.6391632", "0.6344165", "0.6330996", "0.6327512", "0.62961334", "0.6289170...
0.6067114
42
Return whether a user is present in the auth context.
def authenticated? !anonymous? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_present?\n user_token_present? && User.find_by(auth_token: user_token)\n end", "def current_user_exists?\n return false if config.current_user.nil?\n return true\n end", "def user_exists?(user)\n return !get_user(user).nil?\n end", "def user_exists?\n return (session[:u...
[ "0.803908", "0.8016917", "0.79342455", "0.7894378", "0.77044547", "0.76843804", "0.72711337", "0.72609377", "0.7259799", "0.7234821", "0.71968734", "0.71592087", "0.71507525", "0.71465915", "0.711707", "0.71151257", "0.71087265", "0.7099442", "0.70898163", "0.7088659", "0.708...
0.0
-1
Return whether context is authenticated in superuser scope.
def superuser? env && env.key?("warden") && env["warden"].authenticate?(scope: :superuser) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def super?\n logged_in? && current_user.super\n end", "def is_superuser?\n superuser? && supermode?\n end", "def super_user? \n current_user.role.role == \"Super\" \n end", "def super_user?\n super_user\n end", "def is_super_user?\n @super_user\n end", "def superuser?\n me...
[ "0.82996136", "0.8023707", "0.797366", "0.7961496", "0.7934777", "0.784305", "0.7631575", "0.755533", "0.75297636", "0.74823374", "0.74491566", "0.74068034", "0.7378999", "0.7378999", "0.7378999", "0.73666203", "0.7365313", "0.735065", "0.73494613", "0.7303131", "0.72728574",...
0.842157
0
Return the user agent for this context.
def agent anonymous? ? nil : user.agent end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_agent\n user_agent\n end", "def user_agent\n @user_agent || USER_AGENT\n end", "def user_agent\n @user_agent || USER_AGENT\n end", "def getUserAgent()\n\t\t\tUSER_AGENT\n\t\tend", "def user_agent\n @agent.user_agent\n end", "def user_agent\n @data[\"user_...
[ "0.81866753", "0.7921412", "0.7921412", "0.78977275", "0.7877049", "0.7868585", "0.77900714", "0.7616391", "0.7616391", "0.7616391", "0.7599948", "0.75958985", "0.75744754", "0.7536565", "0.7408865", "0.7264096", "0.72230315", "0.7206105", "0.7206105", "0.7206105", "0.7194582...
0.7267124
15
Is the authenticated agent a Duke identity?
def duke_agent? !!(agent =~ /@duke\.edu\z/) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_human\n session[:previous_protocol] = request.protocol\n \n # If this is a \"checkid_setup\" request, make sure we have a logged in user\n if openid_request.is_a?(OpenID::Server::CheckIDRequest) && openid_request.mode == 'checkid_setup'\n return true if current_user\n \n op...
[ "0.6617209", "0.65284264", "0.65230936", "0.6518125", "0.6510213", "0.64303964", "0.6411428", "0.6409091", "0.63975465", "0.6393756", "0.6389271", "0.6384216", "0.6363253", "0.6352403", "0.63353133", "0.63280743", "0.63059855", "0.6304719", "0.6285406", "0.62807065", "0.62688...
0.7232161
0
Return the list of groups for this context.
def groups @groups ||= Groups.call(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def groups\n return @groups\n end", "def groups\n return [] if self.group_list.nil?\n self.group_list\n end", "def groups\n @@groups = Group.groups if @@groups.nil? or @@groups.empty?\n @@groups\n end", "def groups\n return [] if new_record?\n cached_...
[ "0.8009494", "0.7875", "0.7684349", "0.7683966", "0.75250345", "0.74508697", "0.7405469", "0.7400578", "0.73376656", "0.73327625", "0.7272192", "0.7255863", "0.7249265", "0.7239073", "0.7171209", "0.7158959", "0.71413475", "0.7128432", "0.7085768", "0.7085768", "0.704714", ...
0.7498017
5
Is the user associated with the auth context a member of the group?
def member_of?(group) if group.is_a? Group groups.include? group else member_of? Group.new(group) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def member_of(group)\n current_user.is_member?(group)\n end", "def user_in_group?(user, group)\n return get_user_groups(user).include?(group)\n end", "def current_user_in_my_group?\n result = false\n bypass_auth do\n #bypass authentication allows us to looka at the accessor and gro...
[ "0.8318032", "0.78687567", "0.7786651", "0.77762944", "0.77555084", "0.77336556", "0.7681529", "0.7554097", "0.7520982", "0.74923295", "0.7448112", "0.74449456", "0.7425662", "0.7363625", "0.7353825", "0.73470736", "0.7332101", "0.7310452", "0.7304656", "0.7303983", "0.730398...
0.7037084
38
Is the auth context authorized to act as superuser? This is separate from whether the context is authenticated in superuser scope.
def authorized_to_act_as_superuser? member_of? Ddr::Auth.superuser_group end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def super?\n logged_in? && current_user.super\n end", "def superuser?\n env && env.key?(\"warden\") && env[\"warden\"].authenticate?(scope: :superuser)\n end", "def is_superuser?\n superuser? && supermode?\n end", "def is_super_user?\n @super_user\n end", "def super_user? \n ...
[ "0.83948565", "0.8374753", "0.80939424", "0.8027964", "0.8024109", "0.80055565", "0.7828647", "0.7773765", "0.7626433", "0.7616902", "0.7586749", "0.7558823", "0.75344956", "0.7461781", "0.74597055", "0.74217165", "0.7367223", "0.7345064", "0.73389745", "0.7239539", "0.723881...
0.81366277
2
Return the combined user and group agents for this context.
def agents groups.map(&:agent).push(agent).compact end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assignable_agents\n @assignable_agents = (Current.account.users.where(id: @inbox.members.select(:user_id)) + Current.account.administrators).uniq\n end", "def agents_index\n @agents = User.agents\n end", "def agents\n return @agents unless @agents.nil?\n agents_array = []\n agents = @doc.x...
[ "0.635923", "0.61018586", "0.6069304", "0.6063228", "0.5574587", "0.5489919", "0.5393909", "0.5356904", "0.5317324", "0.5313684", "0.52340686", "0.5217428", "0.51994395", "0.51813906", "0.5159123", "0.51176476", "0.51050526", "0.50761074", "0.50664985", "0.50642836", "0.50212...
0.65304875
0
The IP address associated with the context.
def ip_address nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ip_address(env)\n ip_address_record(env)[:address]\n end", "def get_ip_address\n rpc_get_fact_direct('host_ip')\n end", "def get_ip_address\n request.remote_ip\n end", "def localIP\r\n @@local_ip_address\r\n end", "def ip\n @attributes[:ip]\n end", "def ip\...
[ "0.818175", "0.79874307", "0.79445285", "0.762549", "0.76132166", "0.76132166", "0.75765663", "0.7566157", "0.7566157", "0.7566157", "0.7566157", "0.7566157", "0.7566157", "0.75637925", "0.75440884", "0.754334", "0.7538307", "0.74903506", "0.7454525", "0.741368", "0.74082583"...
0.7122757
34
The affiliation values associated with the context.
def affiliation [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_affiliations\n affiliations\n end", "def affiliations\n @net_ldap_entry[:berkeleyeduaffiliations]\n end", "def affiliate_affiliations\n @affiliate_affiliations ||= Affiliation.find_by_uid(uid)\n end", "def affiliate\n @affiliate || Affiliate.with_id(@data_object.use...
[ "0.7571122", "0.6981451", "0.68976164", "0.6778899", "0.6473725", "0.63504034", "0.6170939", "0.6073863", "0.58945876", "0.58427435", "0.5821359", "0.5814536", "0.57119447", "0.57092613", "0.5665952", "0.5594363", "0.5576291", "0.55696017", "0.55696017", "0.55696017", "0.5566...
0.7342059
1
The remote group values associated with the context.
def ismemberof [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_group_vals(group)\n\t\treturn Group.get_value(group, @system).value.split(\",\")\n\tend", "def retrieve_remote_group\n self.each_security_group do |sg|\n sg.rules.map do |rule|\n next if rule.group.nil? || rule.group == rule.parent_group_name\n rule.group = self.find_by(:nam...
[ "0.6428298", "0.6214212", "0.6035887", "0.60119206", "0.60119206", "0.60119206", "0.59899855", "0.590488", "0.57769775", "0.5757815", "0.57236594", "0.57133704", "0.5709506", "0.56870323", "0.5683894", "0.56669694", "0.56606066", "0.56185627", "0.5593995", "0.5593995", "0.557...
0.0
-1
fragile! ["75.119.201.189", "apache2moon.legs.dreamhost.com"] ["75.119.201.189", "75.119.201.189.unresolveable.tld"]
def test_resolver_converts_ipaddrs_array @parser.log_reader assert_equal @parser.ipaddrs_q.size, 12 assert_equal @parser.records_q.size, 12 @parser.resolve_names assert_equal @parser.domains_hash.map { |k,v| [ k, v[0] ] }.sort, [ ["208.77.188.166", "www.example.com"], ["74.125.67.100", "gw-in-f100.google.com"], ["75.119.201.189", "apache2-moon.legs.dreamhost.com"], ["75.146.57.34", "greed.zenspider.com"] ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_subdomains(host, tld_length); end", "def allowed_options\n []\n\n # :subdomain_list => list of subdomains to brute\n # :mashed_domains => try domain names w/o a dot, see if anyone's hijacked a common \"subdomain\"\n # :mashed_domains - blatently stolen from @hdmoore's webinar on password stealing, tr...
[ "0.5962243", "0.58744514", "0.5808275", "0.57521313", "0.5750633", "0.56621397", "0.5604398", "0.56028783", "0.5563788", "0.5561439", "0.55407345", "0.55297434", "0.55196255", "0.5500891", "0.5500891", "0.54642636", "0.54594046", "0.5436655", "0.5400775", "0.5391225", "0.5381...
0.5218414
40
:callseq: should be should be_true should be_false should be_nil should be_arbitrary_predicate(args) should_not be_nil should_not be_arbitrary_predicate(args) Given true, false, or nil, will pass if actual is true, false or nil (respectively). Given no args means the caller should satisfy an if condition (to be or not to be). Predicates are any Ruby method that ends in a "?" and returns true or false. Given be_ followed by arbitrary_predicate (without the "?"), RSpec will match convert that into a query against the target object. The arbitrary_predicate feature will handle any predicate prefixed with "be_an_" (e.g. be_an_instance_of), "be_a_" (e.g. be_a_kind_of) or "be_" (e.g. be_empty), letting you choose the prefix that best suits the predicate. == Examples target.should be target.should be_true target.should be_false target.should be_nil target.should_not be_nil collection.should be_empty passes if target.empty? "this string".should be_an_intance_of(String) target.should_not be_empty passes unless target.empty? target.should_not be_old_enough(16) passes unless target.old_enough?(16)
def be(*args) Matchers::Be.new(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should\n @should\n end", "def should\n @should\n end", "def should\n @should\n end", "def should\n @should\n end", "def should; super end", "def test_returns_ice_cream_winter_false\n result = should_eat(\"ice cream\", \"winter\")\n a...
[ "0.6620803", "0.65905267", "0.65905267", "0.65905267", "0.60409904", "0.59807193", "0.5771204", "0.57696426", "0.5761203", "0.572537", "0.57158744", "0.5712104", "0.5669099", "0.56194544", "0.55951285", "0.55887157", "0.5490677", "0.54119766", "0.5400134", "0.53665024", "0.53...
0.5216845
30
Input parameters aws_access_key => the Amazon AWS Access Key (see Your Account > Security Credentials) aws_secret_key => the Amazon AWS Secret Key ip_address => IP Address of the machine to connect to ssh_key_file => Path of the keyfile used to connect to the machine device => Path of the device to encrypt device_name => Name of the Device to encrypt storage_path => Path on which the encrypted device is mounted remote_command_handler => object that allows to connect via ssh and execute commands ec2_api_handler => object that allows to access the EC2 API password => password used for encryption
def initialize(input_params) super(input_params) @result = {:done => false} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createEc2SSHKey\n\t\t\treturn [@keypairname, @ssh_private_key, @ssh_public_key] if !@keypairname.nil?\n\t\t keyname=\"deploy-#{MU.mu_id}\"\n\t\t\tkeypair = MU.ec2(MU.myRegion).create_key_pair(key_name: keyname)\n\t\t\t@keypairname = keyname\n\t\t @ssh_private_key = keypair.key_material\n\t\t\tMU.log \"SSH Ke...
[ "0.58120173", "0.5580779", "0.5580417", "0.5523375", "0.54661906", "0.5429663", "0.54029614", "0.53921545", "0.538266", "0.5376326", "0.5320786", "0.5304471", "0.5301503", "0.5295809", "0.52805895", "0.52708834", "0.5259137", "0.5249185", "0.52461475", "0.52287215", "0.522217...
0.0
-1
Returns a hash with the following information: :done => if execution is done
def get_execution_result @result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def done; end", "def results_status\n Hash[@@PREPROCESSING_TASKS.map { |task| [task, result_status(task)] }]\n end", "def results_status\n Hash[@@PREPROCESSING_TASKS.map { |task| [task, result_status(task)] }]\n end", "def done?; true end", "def finish!\n return false unless self.finished?\n...
[ "0.63552874", "0.6334131", "0.6334131", "0.62734216", "0.62727326", "0.617551", "0.61031896", "0.6103052", "0.60889554", "0.60662013", "0.6062321", "0.6044784", "0.6002876", "0.600198", "0.59807736", "0.5954951", "0.5949898", "0.59429747", "0.5927669", "0.5919683", "0.59179",...
0.5532128
82
GET /orgs/1/reports/datarequests def data_requests end GET /orgs/1/reports/datarequests/submitted def data_requests_submitted end GET /orgs/1/reports/datarequests/approved def data_requests_approved end GET /orgs/1/reports/datarequests/total def data_requests_total end GET /orgs/1/reports/datadownloads def data_downloads end GET /orgs/:id/reports/datarequests/yeartodate
def data_requests_year_to_date data_requests = @organization.data_requests @dataset = @organization.datasets.find_by_param(params[:dataset]) data_requests = data_requests.joins(:requests).merge(Request.where(dataset: @dataset)) if @dataset @year = (params[:year].to_i.positive? ? params[:year].to_i : Time.zone.today.year) @chart_title = "#{"#{@dataset.slug.upcase} " if @dataset} Data Requests for #{@year}" @chart_subtitle = @organization.name @series = [] max = 100 (series, max) = add_average_submitted(data_requests, max) @series << series (series, max) = add_submitted_data_requests(data_requests, max) @series << series (series, max) = add_approved_data_requests(data_requests, max) @series << series @x_axis = { categories: Date::ABBR_MONTHNAMES.last(12), title: { text: "" } } @y_axis = { title: { text: "Data Requests" }, max: max } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reports\n\n \t if params[\"from_date\"].present? and params[\"to_date\"].present?\n @date=params[:from_date]\n @data=JSON.parse RestClient.get $api_service+\"/claims/data_report?from_date=#{params[\"from_date\"]}&to_date=#{params[\"to_date\"]}\"\n elsif params[:date]\n @data=JSON.parse RestC...
[ "0.6177883", "0.5989772", "0.5909449", "0.5870223", "0.5830202", "0.5771579", "0.5743066", "0.5738676", "0.57295036", "0.5725716", "0.5642134", "0.56154627", "0.5608479", "0.56049454", "0.5573308", "0.55654144", "0.5564038", "0.55455464", "0.55302393", "0.5528164", "0.5503506...
0.62744087
0
Initialize a new attribute
def initialize(name, coercer, options) @name = name.to_sym @coercer = coercer @options = options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize attr={}\n super\n self.attributes = attr\n end", "def initialize( attribute=DEFAULT_ATTRIBUTE )\n\t\t\t@attribute = attribute\n\t\tend", "def attribute=(_arg0); end", "def attribute=(_arg0); end", "def initialize_attributes(attributes); end", "def initialize(attrib_name)\n raise ...
[ "0.7715957", "0.7469942", "0.74452144", "0.74452144", "0.7381874", "0.736103", "0.73368174", "0.73097473", "0.72718364", "0.71755326", "0.7142297", "0.7112065", "0.71100456", "0.70530444", "0.7047671", "0.70393234", "0.6983208", "0.6972515", "0.69533783", "0.6931924", "0.6930...
0.0
-1
Returns the mapped name
def mapped (@options.fetch(:as) { name }).to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_name; end", "def mapping_from_name(name)\n const_get(\"#{name}_mapping\".upcase)\n end", "def map_name; $game_temp.map_names[@map_id]; end", "def name\n return @map_infos[@map_id].name\n end", "def mapping\n {key => name}\n end", "def to_s\n @mapping.fetch :name\n ...
[ "0.78487194", "0.76405036", "0.7617711", "0.7614875", "0.7254914", "0.7210712", "0.7123584", "0.7099615", "0.7015035", "0.69798046", "0.69184893", "0.6810049", "0.6801415", "0.6761653", "0.66894454", "0.666987", "0.66525936", "0.6640669", "0.6631591", "0.6590595", "0.6570552"...
0.0
-1
def self.total_people_served(from_date, to_date) end def self.total_people_served(from_date, to_date) end
def has_this_item?(item_id) item_id.blank? ? true : self.delivered_items.map(&:item_id).include?(item_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def statistics\n #@user = User.find(params[:id])\n @start_date = Date.civil(params[:from][:year].to_i, params[:from][:month].to_i, params[:from][:day].to_i)\n @end_date = Date.civil(params[:to][:year].to_i, params[:to][:month].to_i, params[:to][:day].to_i)\n end", "def dates\n end", "def calorie_sum...
[ "0.64561176", "0.63417935", "0.60432786", "0.5993764", "0.5884406", "0.5873569", "0.587183", "0.58704877", "0.5843923", "0.58154243", "0.58154243", "0.58022517", "0.58012706", "0.57861924", "0.5780819", "0.575733", "0.57372916", "0.57271343", "0.57123333", "0.5700154", "0.570...
0.0
-1
We serialise this attribute as seconds since epoch instead of Datetime to allow easier parsing, as this travels via API calls between the server and the workers. This value will eventually return back to the server (untouched) and will be persisted as TestJobsent_at [Datetime]. This timestamp helps in making further time calculations and reports for the test suites.
def sent_at_seconds_since_epoch Time.current.utc.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp\n Time.at((attributes[:timestamp] || Time.now).to_i)\n end", "def timestamp\n @timestamp ||= Time.parse(self['timestamp'])\n end", "def timestamp\n self[:timestamp]\n end", "def timestamp\n attribute_prop(4)\n end", "def timestamp\n _timestamp.as_time\n ...
[ "0.6874321", "0.6675352", "0.66523874", "0.6524941", "0.6505056", "0.6487553", "0.64614326", "0.6361139", "0.63495845", "0.6332264", "0.6332264", "0.62288296", "0.61929446", "0.61486745", "0.6108444", "0.6054869", "0.60431665", "0.60045695", "0.6002651", "0.5998468", "0.59350...
0.6695574
1
Use callbacks to share common setup or constraints between actions.
def set_socioeduk_contato @socioeduk_contato = Socioeduk::Contato.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
Only allow a trusted parameter "white list" through.
def socioeduk_contato_params params.require(:socioeduk_contato).permit(:jovem_id, :tipo_contato_id, :ddd, :numero) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Returns true when there's no 'ensure' statement wrapping current rescue.
def handle_rescue_else_manually? !in_ensure? && has_rescue_else? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test\n begin\n raise IOError\n rescue IOError => ex\n puts \"rescue: #{ex.class}\"\n ensure\n puts \"ensure: #{$!.class}\"\n end\nend", "def rescue_exception?\n !!@rescue_exception\n end", "def failed?\n closed? && !has_met_requirement?\n end", "def exception?...
[ "0.62832236", "0.6191191", "0.603688", "0.601034", "0.5963333", "0.5802639", "0.57863486", "0.57777214", "0.56775033", "0.5659981", "0.56242454", "0.562374", "0.56016046", "0.5587336", "0.554761", "0.5510191", "0.5473867", "0.5417684", "0.53846765", "0.5348517", "0.5326799", ...
0.779234
0
Start nSight Central and get a window handle to it.
def initialize(name = 'nSightCentral', with_options = {}) options = DefaultOptions.merge(with_options) @prompted = {} if options[:use_desktop_link] raise "No link name specified" if (!options[:link_name]) @path = Central.link_to(options[:link_name]) else @path = Central.path_to(name) end # Load app config and external link data. load_app_config(name) load_external_links() system 'start "" "' + @path + '"' @main_window = Window.top_level 'nSight Central' # Create or get a logger. @log = (Log4r::Logger['Central']) ? (Log4r::Logger['Central']) : Log4r::Logger.new('Central') # Look for the "connecting to database" dialog. begin @connecting_window = Window.top_level("Connecting ...") if (@connecting_window.handle > 0) @log.debug("Connecting to db window detected...") @connecting_window.wait_for_close(10) @log.debug("Connecting to db window is closed...") end rescue RuntimeError @log.debug("Database connection window not detected") end # Give a little time for the database-dependent controls to initialize. sleep 0.5 set_foreground_window @main_window.handle end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while !@shell.isDisposed\n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n display.dispose\n end", "def start\n display = ...
[ "0.6408133", "0.6378174", "0.6377543", "0.63415194", "0.63070345", "0.623769", "0.6230002", "0.62103975", "0.61557263", "0.61009765", "0.6100496", "0.6083385", "0.60257465", "0.6006537", "0.59568363", "0.59551793", "0.594752", "0.5939387", "0.5931619", "0.59233725", "0.591843...
0.6330104
4
Did the UI prompt?
def has_prompted?(kind) @prompted[kind] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prompt; end", "def prompt; end", "def prompt; end", "def prompt; end", "def prompting?\n @at_prompt\n end", "def confirm(prompt); end", "def ask(question)\n ui.ask question\n end", "def prompting(v = true)\n @at_prompt = v\n end", "def wait_for_prompt\n while !@prompted do\n ...
[ "0.7380896", "0.7380896", "0.7380896", "0.7380896", "0.72454095", "0.70639896", "0.70565253", "0.7015615", "0.6909276", "0.6908265", "0.6850233", "0.6771026", "0.6750171", "0.67101353", "0.67101353", "0.67101353", "0.6628028", "0.6607036", "0.6599802", "0.6589135", "0.654592"...
0.0
-1
Is the application running?
def running? is_a_window = (@main_window == 0) ? false : (is_window(@main_window.handle) != 0) @log.debug("Main window: #{@main_window.handle}, is a window: #{is_a_window}") is_a_window end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running?\n @applications.each { |a| return true if a.running? }\n return false\n end", "def isRunning\n return running?\n end", "def running?\n pid = `ps x -o pid,command|grep [K]EWatcher|awk '{print $1}'`.to_i\n pid == 0 ? false : pid\n end", "def is_running...
[ "0.81414634", "0.7986094", "0.785057", "0.7830677", "0.7826417", "0.78019696", "0.7792573", "0.7759212", "0.77269906", "0.769822", "0.7694565", "0.7658187", "0.76269996", "0.76221704", "0.7606044", "0.7606044", "0.7606044", "0.7606044", "0.7606044", "0.7606044", "0.7606044", ...
0.77865607
7
Click on a web link. If the click is successful, verify that a window opens to the expected location, and then close the window.
def click_web_link(text) @log.debug("Clicking web link #{text}") @main_window.click(text) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_link_tab(link, expected_title = nil, expected_url = nil)\n wait = Selenium::WebDriver::Wait.new(timeout: 3)\n \n #Open link\n js_scroll_up(link)\n link.click\n $test_driver.switch_to.window( $test_driver.window_handles.last )\n #Test it for URL or title\n begin\n if expected_title == nil\n ...
[ "0.6803659", "0.6774508", "0.6624445", "0.65356773", "0.64107645", "0.63542193", "0.62762177", "0.61887443", "0.6147196", "0.6014226", "0.5977939", "0.5902355", "0.5891295", "0.5884498", "0.5864065", "0.58279175", "0.58175176", "0.58165336", "0.581053", "0.58077073", "0.58076...
0.6448154
4
Click on a shortcut button. If the click is successful, wait to see if the application opens.
def click_shortcut(text, seconds = 5) @main_window.click(text) @log.debug("Clicked \"#{text}\" shortcut, waiting #{seconds} seconds for Central window to close...") timeout(seconds) do sleep 0.2 while running? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click\n assert_enabled\n clicked = false\n wait_until do\n @window.activate\n @window.active? &&\n UiaDll::control_click(search_information) &&\n clicked = true # is clicked at least once\n\n block_given? ? yield : clicke...
[ "0.6358245", "0.6211399", "0.61108524", "0.6090849", "0.6072491", "0.6045216", "0.602874", "0.586334", "0.57922053", "0.5782444", "0.57760406", "0.57674235", "0.57445264", "0.56970125", "0.56956565", "0.56513625", "0.56257564", "0.5623184", "0.561285", "0.560016", "0.5557293"...
0.6553512
0