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 |
|---|---|---|---|---|---|---|
Use callbacks to share common setup or constraints between actions. | def set_conf
@conf = Conf.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 conf_params
params.require(:conf).permit(:custom, :player_id, :game_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
add_callback(ID sym, Proc func) add_callback(ID sym, &block) | def add_callback(sym, func=nil, &block)
init_callbacks unless @callback
if func && block || !func && !block
raise(ArgumentError,
"Either pass a block (block), or a Proc (func)")
end
(@callback[sym] ||= []).push(func || block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_callback(sym, func=nil, &block)\n init_callbacks unless @callback\n if func && block || !func && !block\n raise(ArgumentError,\n \"Either pass a block (block), or a Proc (func)\")\n end\n (@callback[sym] ||= []).push(func || block)\n end",
"def add_callback(&blo... | [
"0.81050205",
"0.7939211",
"0.7925334",
"0.7859473",
"0.75690705",
"0.75453305",
"0.75453305",
"0.7382604",
"0.7382604",
"0.7382604",
"0.7382604",
"0.7292665",
"0.72720826",
"0.72603166",
"0.7103494",
"0.7058948",
"0.70449835",
"0.6973647",
"0.6971856",
"0.6966498",
"0.689517... | 0.8100686 | 1 |
call_callback(ID sym, void args, &block) | def call_callback(sym, *args, &block)
init_callbacks unless @callback
raise(CallbackError,
"callback #{sym} does not exist") unless callback?(sym)
if @callback_log
@callback_log.puts("Callback: #{self} #{sym} #{args.inspect}")
end
nargs = args
un... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call_callback(symbol, *args, &block)\n init_callbacks unless @callbacks\n @callbacks[symbol].each { |func| func.call(*args, &block) }\n @callback_log.puts \"[#{self.class} call_callback] : #{symbol}\" if @callback_log\n end",
"def callback=(_arg0); end",
"def call_callback(sym, *args, &bl... | [
"0.7836083",
"0.7243855",
"0.71052474",
"0.70693517",
"0.69194853",
"0.68953973",
"0.6881149",
"0.68687236",
"0.68525654",
"0.6751847",
"0.67331463",
"0.672453",
"0.671877",
"0.6692738",
"0.6668021",
"0.6626346",
"0.6497963",
"0.64808166",
"0.64598787",
"0.6415119",
"0.640704... | 0.7178678 | 2 |
try_callback(ID sym, args, &block) | def try_callback(sym, *args, &block)
call_callback(sym, *args, &block) if callback?(sym)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_callback(sym, *args, &block)\n call_callback(sym, *args, &block) if callback?(sym)\n end",
"def try_callback(symbol, *args, &block)\n call_callback(symbol, *args, &block) if callback?(symbol)\n end",
"def try\n if block_given?\n yield\n else\n puts \"no block\"\n end\nend",
"... | [
"0.82500803",
"0.80111635",
"0.6408692",
"0.6398114",
"0.6332526",
"0.6268994",
"0.6229917",
"0.6169152",
"0.6167472",
"0.61524266",
"0.61333793",
"0.6123319",
"0.6098788",
"0.60351443",
"0.6021843",
"0.601588",
"0.60103124",
"0.59897405",
"0.5985973",
"0.59574777",
"0.595747... | 0.8135128 | 1 |
GET /simple_question_alternatives GET /simple_question_alternatives.json | def index
render status: :ok, json: @simple_question_alternatives
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n render status: :ok, json: @simple_question_alternative\n end",
"def index\n render status: :ok, json: @group_question_alternatives\n end",
"def show\n if @v1_answer\n render json: @v1_alternative\n else\n render json: get_errors(@v1_alternative), status: :unpr... | [
"0.71048266",
"0.7004162",
"0.6885037",
"0.65703064",
"0.6340651",
"0.6327241",
"0.6299547",
"0.629056",
"0.62847036",
"0.62742436",
"0.6252459",
"0.61070794",
"0.6027513",
"0.599797",
"0.5986381",
"0.5982788",
"0.5931952",
"0.5923835",
"0.5914265",
"0.59069216",
"0.59015536"... | 0.8176196 | 0 |
GET /simple_question_alternatives/1 GET /simple_question_alternatives/1.json | def show
render status: :ok, json: @simple_question_alternative
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n render status: :ok, json: @simple_question_alternatives\n end",
"def show\n if @v1_answer\n render json: @v1_alternative\n else\n render json: get_errors(@v1_alternative), status: :unprocessable_entity\n end\n end",
"def index\n render status: :ok, json: @grou... | [
"0.80304044",
"0.70147836",
"0.6874845",
"0.66847664",
"0.6474879",
"0.6462679",
"0.63767153",
"0.6315475",
"0.63024676",
"0.6291111",
"0.6265283",
"0.6260243",
"0.6244437",
"0.62123936",
"0.61861396",
"0.615681",
"0.6151976",
"0.61452854",
"0.6142903",
"0.6142903",
"0.614286... | 0.71199363 | 1 |
PATCH/PUT /simple_question_alternatives/1 PATCH/PUT /simple_question_alternatives/1.json | def update
if @simple_question_alternative.update(simple_question_alternative_params)
render status: :ok, json: @simple_question_alternative
else
self.send(:edit)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_correct_answer\n question_params = params.permit(:question_id, :question_type_id, :option_id)\n \n render json: Question.update_correct_option(question_params)\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.upda... | [
"0.7223777",
"0.69482666",
"0.6903373",
"0.68964624",
"0.68875384",
"0.6877194",
"0.6820824",
"0.67845654",
"0.6738939",
"0.6717212",
"0.6708769",
"0.6678791",
"0.66758287",
"0.6674597",
"0.66572046",
"0.6656676",
"0.66464543",
"0.66390604",
"0.66104805",
"0.6602834",
"0.6582... | 0.7490768 | 0 |
DELETE /simple_question_alternatives/1 DELETE /simple_question_alternatives/1.json | def destroy
@simple_question_alternative.destroy
head :no_content
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n if @v1_question.destroy\n render json: {'message': 'Deleted question successfully'}, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n\n end",
"def destroy\n @survey_answer_item = SurveyAnswerItem.find(params[:id])\n @survey_answer_item.de... | [
"0.7303035",
"0.7152394",
"0.7149755",
"0.71412724",
"0.71175975",
"0.71089983",
"0.71080244",
"0.71063954",
"0.7099373",
"0.70940375",
"0.7091033",
"0.7088829",
"0.7065765",
"0.70516187",
"0.7041358",
"0.70411193",
"0.703785",
"0.70317435",
"0.70317435",
"0.7016932",
"0.7011... | 0.6955971 | 35 |
Use callbacks to share common setup or constraints between actions. | def set_simple_question_alternative
@simple_question_alternative = SimpleQuestionAlternative.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 simple_question_alternative_params
params.require(:simple_question_alternative).permit(:name, :media, :correct, :question_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
guess, best_guess, name, key_pegs, encoded_guess and turn must moved to a Game class from both modes | def initialize(name)
@name = name
@best_guess = []
@key_pegs = []
@encoded_guess = []
@turn = 0
@previous_shuffles = []
@previous_values = []
play
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(strategy, game)\n strategy.newGame\n while game.gameStatus == :KEEP_GUESSING\n #puts game\n guess = strategy.nextGuess(game)\n #puts guess\n guess.makeGuess(game)\n end\n puts game\n game.currentScore\nend",
"def guess(game)\n turn = nil\n\n # Wenn die moeglichen Kombinationen noch... | [
"0.6551353",
"0.654409",
"0.6387491",
"0.6355081",
"0.6319649",
"0.62661463",
"0.6227692",
"0.6194261",
"0.6167647",
"0.6139632",
"0.61369044",
"0.6133874",
"0.61160904",
"0.61077946",
"0.6075008",
"0.6070657",
"0.60677195",
"0.606285",
"0.6040247",
"0.60197806",
"0.60154754"... | 0.6767783 | 0 |
finds all of the correct values | def until_values(guess_accuracy)
guess_accuracy.split('').each_with_index do |ges, i|
next if ['*', '_'].include?(ges) # ignore correct characters (* OR _)
loop do
new_val = rand(1..6).to_s
unless previous_values.include?([ges, new_val])
guess[i] = new_val and @previous_values... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solved(values)\n def unitSolved(unit)\n return unit.map{|s| values[s]}.uniq == $digits.uniq\n end\n return values if not false and all($unitList.map{|u| unitSolved(u)})\nend",
"def possibleHandValues\n \thand_values = Set.new [0] # start with value 0\n \t@cards.each do |card| ... | [
"0.6714044",
"0.59519666",
"0.5781728",
"0.57529044",
"0.5737406",
"0.5717645",
"0.56901944",
"0.5686074",
"0.5613454",
"0.5592841",
"0.5584658",
"0.55160874",
"0.55128825",
"0.54507",
"0.5439131",
"0.5432843",
"0.54185313",
"0.54136854",
"0.5412105",
"0.54059786",
"0.5383116... | 0.52762693 | 37 |
shifts values until it's all correct | def until_position(guess_accuracy)
return if guess_accuracy =~ /\*{4}/
shift_indices = []
values_to_shift = []
guess_accuracy.split('').each_with_index do |acc, i|
shift_indices.push(i) and values_to_shift.push(guess[i]) if acc == '_'
end
shuffle_guess(shift_indices, values_to_shift)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shift_values(arr)\n for i in 0...arr.length-1\n arr[i] = arr[i + 1]\n end\n arr[arr.length - 1] = 0\n return arr\nend",
"def shift_val(arr)\n for i in 0..arr.length - 2\n arr[i] = arr[i+1]\n end\n arr[-1] = 0\n return arr\nend",
"def shift\n raise \"index out of bounds\" unless... | [
"0.67044425",
"0.6669308",
"0.6294323",
"0.6255717",
"0.6227091",
"0.6227091",
"0.6223879",
"0.6223879",
"0.6204288",
"0.61768645",
"0.61610633",
"0.61375695",
"0.6094109",
"0.6056597",
"0.60450697",
"0.5990535",
"0.5952211",
"0.594777",
"0.593521",
"0.5919607",
"0.591884",
... | 0.0 | -1 |
rubocop: enable Metrics/AbcSize this move method identifies the piece that will need to be removed as a result of the en_passant move | def pawn_move
position_index = Generic.find_square_index(en_passant_move, board)
colour == 'White' ? pawn_move_white(position_index) : pawn_move_black(position_index)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_piece(move)\n curr_piece = @board[move[0]]\n if curr_piece.non_check_moves.include?(move[1])\n #if en passant, remove captured piece\n if curr_piece.class == Pawn\n #puts curr_piece.can_en_passant?\n #puts \"HELKFDSJLFKD\"\n if curr_piece.can_en_passant?\n #pu... | [
"0.69188213",
"0.6792523",
"0.667759",
"0.6553671",
"0.65309125",
"0.6457168",
"0.6350195",
"0.62975055",
"0.62587583",
"0.62230384",
"0.61904466",
"0.6177318",
"0.61679345",
"0.6156722",
"0.61414355",
"0.6133897",
"0.6092962",
"0.6091436",
"0.6074626",
"0.6066756",
"0.604967... | 0.0 | -1 |
Log changes made by a Super Admin or Ventas user def log_changes if !self.users.pluck(:id).include? current_user.id if self.previous_changes.count > 0 end end end | def create_attribute_group
if AttributeGroup.where(name: "Otros", company_id: self.id).count < 1
AttributeGroup.create(name: "Otros", company_id: self.id, order: 1)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logall(user)\n self.changes.each do |key, value|\n if key != \"updated_at\" then\n name = self.class.name + \" #{key}\"\n \n logthis(user, name, self.id, value[0], value[1])\n end\n end\n end",
"def user_for_change_log\n current_user rescue nil\n end",
"def s... | [
"0.69024086",
"0.68887275",
"0.6649076",
"0.632732",
"0.6262515",
"0.6262515",
"0.62554014",
"0.62443113",
"0.6135036",
"0.6130853",
"0.6086534",
"0.59983265",
"0.59920824",
"0.5976576",
"0.5937251",
"0.5917406",
"0.58603054",
"0.58252454",
"0.5817177",
"0.5790909",
"0.578608... | 0.0 | -1 |
Collection methods Check if account has been used in the past week for status change purposes. | def account_used
if Booking.where(location_id: Location.where(company_id: self.id).pluck(:id)).where('created_at > ?', DateTime.now - 1.weeks).count > 0
return true
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_grace_period?\n self.weekly_tasks.where(:is_weekly_payment_approved_by_cashier => true ).count == self.total_weeks \n end",
"def is_available_for_hot_list\n weeks_from_now = 8.weeks.from_now.to_i\n now = Time.now.utc.to_i\n self.exchange_dates.each do |availability_date|\n if availabilit... | [
"0.6640828",
"0.6487428",
"0.63216513",
"0.6140058",
"0.61377054",
"0.61089647",
"0.60775906",
"0.60576415",
"0.60568386",
"0.59719646",
"0.5967845",
"0.59579724",
"0.59579724",
"0.5951729",
"0.59394497",
"0.59101015",
"0.5909098",
"0.5885513",
"0.58764696",
"0.58646244",
"0.... | 0.72888094 | 0 |
Calculate debt amount for former trial companies. Get days count till end of month, divide by month length and multiply by company's plan price. | def calculate_trial_debt
sales_tax = self.country.sales_tax
day_number = Time.now.day
month_number = Time.now.month
month_days = Time.now.days_in_month
debt_proportion = (month_days - day_number + 1).to_f/month_days.to_f
#debt = self.plan.plan_countries.find_by(country_id: self.country.id).price.to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def substract_due\n \t\t# if !self.company.plan.custom\n \t\t# \tcompany = self.company\n \t\t# \tday_number = DateTime.now.day\n # \t\tmonth_number = DateTime.now.month\n # \t\tmonth_days = DateTime.now.days_in_month\n \t\t# \tcompany.due_amount -= (((month_days - day_number + 1).to_f / month_days.to_f)... | [
"0.71719724",
"0.6757856",
"0.66983426",
"0.6660248",
"0.6654897",
"0.6620771",
"0.65715724",
"0.6558601",
"0.6475486",
"0.6406214",
"0.6400902",
"0.6245405",
"0.6236094",
"0.6200175",
"0.61570144",
"0.6152255",
"0.6137397",
"0.60867363",
"0.60775924",
"0.6072154",
"0.6059879... | 0.77503055 | 0 |
Return an array containing response[0] = Last payment date (or "No existen pagos" if nil) response[1] = Last payment amount (or 0 if nil) | def last_payment_detail
bl = BillingLog.where.not(transaction_type_id: TransactionType.find_by_name("Transferencia Formulario").id).where(:company_id => self.id).where('trx_id in (?) or trx_id in (?)', PuntoPagosConfirmation.where(:response => "00").pluck(:trx_id), PayUNotification.where(:state_pol => "4").pluck(:re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_payment_on\n payment_histories.try(:last).try(:payment_date)\n end",
"def last_payment\n @last_payment ||= payments.order(:created_at).last\n end",
"def unpaid_payment\n self.payments.where(status: nil).or(self.payments.where(status: :failed)).last\n end",
"def last_response\... | [
"0.6486072",
"0.6357416",
"0.5802749",
"0.57805747",
"0.57719624",
"0.566608",
"0.5553926",
"0.5551379",
"0.55452967",
"0.5532162",
"0.5532162",
"0.5532162",
"0.5532162",
"0.5514124",
"0.5484064",
"0.54609054",
"0.5423874",
"0.53593117",
"0.53575265",
"0.53463423",
"0.5336904... | 0.75253767 | 0 |
For now, test is totally happypath. In future should test for empty data values (server, username, password, workspace, repository) raise_config_error on bad form values(server, username, password, workspace) graceful failure on inability to create scmrepository, changeset, change based on Rally credentials test for no... | def test_push
@stubs.get '/slm/webservice/1.30/Subscription.js?fetch=Name,Workspaces,Workspace&pretty=true' do |env|
assert_equal 'crubble.rallydev.com', env[:url].host
subs = { 'Name' => "Omicron Bacan Fluffies",
'Errors' => [],
'Warnings' => [],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_configuration_options\r\n if ($project_name == \"\")\r\n\t raise 'Project name must be set' \r\n\tend\r\n\tif ($repo_key == \"\")\r\n raise 'Repository is required'\r\n end\r\n\tif ($target_repo_key == \"\")\r\n raise 'Target repository is required'\r\n\tend\r\n\tif ($username == \"\")\r... | [
"0.6579503",
"0.64248806",
"0.61367023",
"0.58776224",
"0.5792664",
"0.5666092",
"0.5619408",
"0.5579915",
"0.5577509",
"0.55686986",
"0.555852",
"0.55129856",
"0.5505581",
"0.54487234",
"0.54364455",
"0.54015785",
"0.5401311",
"0.5396857",
"0.53835726",
"0.5358955",
"0.53535... | 0.0 | -1 |
iOS only. On Android uiautomator always returns an empty string for EditText password. Password character returned from value of UIASecureTextField | def ios_password(length = 1)
8226.chr('UTF-8') * length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_character_only_password\n fill_in(PASSWORD_INPUT_ID, :with => 'aaaaaaaaaa')\n end",
"def password_field\n \"UITextFieldLabel text:'Password'\"\n end",
"def password\n @controls.password_field.text\n end",
"def password_field; end",
"def standard_password\n \"!@Cd5... | [
"0.7092341",
"0.704673",
"0.7032621",
"0.6924173",
"0.6845912",
"0.68024313",
"0.6749321",
"0.666038",
"0.66293555",
"0.6629215",
"0.6489809",
"0.6433576",
"0.6431615",
"0.6418931",
"0.64134324",
"0.6403203",
"0.6399313",
"0.6399313",
"0.6399313",
"0.6399313",
"0.6399313",
... | 0.6670282 | 7 |
Prints a string of interesting elements to the console. | def page(opts = {})
class_name = opts.is_a?(Hash) ? opts.fetch(:class, nil) : opts
source = get_source
# current_context may be nil which breaks start_with
if current_context&.start_with?('WEBVIEW')
parser = @android_html_parser ||= Nokogiri::HTML::SAX::Parser.new(Appium::Common::HTMLE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outtoconsole(things)\n\tsep = \" -> \"\n\tprint things.join(sep).to_s + \"\\n\"\nend",
"def print\n puts @text\n end",
"def print\n puts string\n end",
"def print\r\n tags.each do |tag|\r\n puts \"#{@@tag_titles[tag]} -> #{value(tag)}\"\r\n end\r\n ... | [
"0.6860509",
"0.6728999",
"0.6691357",
"0.6687852",
"0.66876626",
"0.66572416",
"0.6599174",
"0.6562603",
"0.6559913",
"0.6559913",
"0.6559913",
"0.6559913",
"0.65539753",
"0.65409946",
"0.64671355",
"0.64354205",
"0.6422852",
"0.6422166",
"0.639455",
"0.6393643",
"0.63801193... | 0.0 | -1 |
Get the element of type class_name at matching index. | def ele_index(class_name, index)
raise 'Index must be >= 1' unless index == 'last()' || (index.is_a?(Integer) && index >= 1)
elements = tags(class_name)
if index == 'last()'
result = elements.last
else
# elements array is 0 indexed
index -= 1
result = elements[i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ele_index(class_name, index)\n results = tags(class_name)\n if index == 'last()'\n index = results.length\n index -= 1 if index >= 0\n else\n raise 'Index must be >= 1' unless index >= 1\n\n index -= 1 if index >= 1\n end\n\n # uiautomator has issues with in... | [
"0.77246183",
"0.7046933",
"0.6535013",
"0.65334505",
"0.6496793",
"0.64528525",
"0.6344456",
"0.63018733",
"0.6218496",
"0.6164854",
"0.6147445",
"0.6097384",
"0.60623425",
"0.60623425",
"0.6043249",
"0.6018852",
"0.60128605",
"0.59869725",
"0.59840465",
"0.5979174",
"0.5925... | 0.78828573 | 0 |
Find the first element exactly matching class and attribute value. Note: Uses XPath Note: For XCUITest, this method return ALL elements include displayed or not displayed elements. | def find_ele_by_attr(class_name, attr, value)
@driver.find_element :xpath, string_attr_exact(class_name, attr, value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complex_finds_exact(class_name, value)\n find_elements :uiautomator, string_visible_exact(class_name, value)\n end",
"def complex_find_exact(class_name, value)\n find_element :uiautomator, string_visible_exact(class_name, value)\n end",
"def find_ele_by_predicate(class_name: '*', value:)\n ... | [
"0.6593975",
"0.65115285",
"0.62874943",
"0.6045585",
"0.5961835",
"0.59146506",
"0.58822745",
"0.58404034",
"0.58353555",
"0.57172143",
"0.5677443",
"0.5660342",
"0.5598863",
"0.5597491",
"0.55627525",
"0.5540747",
"0.55261075",
"0.54507214",
"0.5388076",
"0.53708375",
"0.53... | 0.6095932 | 3 |
Find all elements exactly matching class and attribute value. Note: Uses XPath Note: For XCUITest, this method return ALL elements include displayed or not displayed elements. | def find_eles_by_attr(class_name, attr, value)
@driver.find_elements :xpath, string_attr_exact(class_name, attr, value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elements\n if @frame.nil?\n $driver.switch_to.default_content\n else\n $driver.switch_to.frame(@frame.element)\n end\n for locator in @locators\n by, value = locator.first\n if not @root == nil and @root.instance_variable_defined?(\"@locators\") and not @root.locators.nil?\n ... | [
"0.66972953",
"0.6429689",
"0.63993317",
"0.6166157",
"0.6160487",
"0.6028191",
"0.59948736",
"0.5928716",
"0.5924789",
"0.58655035",
"0.5863426",
"0.5803527",
"0.5803331",
"0.57371885",
"0.5721733",
"0.5717393",
"0.569267",
"0.5671836",
"0.562199",
"0.56201583",
"0.56138515"... | 0.60054505 | 6 |
Find the first element exactly matching attribute case insensitive value. Note: Uses Predicate | def find_ele_by_predicate(class_name: '*', value:)
elements = find_eles_by_predicate(class_name: class_name, value: value)
raise _no_such_element if elements.empty?
elements.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_matching(key)\n @attributes.find do |a|\n a[0].downcase == key.downcase\n end\n end",
"def case_insensitive_match=(_arg0); end",
"def case_insensitive_match; end",
"def lookup_downcase_attribute (attname, workitem, options={})\n\n result = lookup_string_attribute(attname, workitem,... | [
"0.7478578",
"0.59767616",
"0.5966597",
"0.59500027",
"0.58999825",
"0.58534217",
"0.5781709",
"0.5758291",
"0.5730279",
"0.56916296",
"0.5672504",
"0.56265587",
"0.5616482",
"0.56100935",
"0.5592985",
"0.55726635",
"0.5560898",
"0.5544507",
"0.5533126",
"0.5529705",
"0.55224... | 0.6330017 | 1 |
Find all elements exactly matching attribute case insensitive value. Note: Uses Predicate | def find_eles_by_predicate(class_name: '*', value:)
predicate = if class_name == '*'
%(name == "#{value}" || label == "#{value}" || value == "#{value}")
else
%(type == "#{class_name}" && ) +
%((name == "#{value}" || label == "#{value}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def case_insensitive_match; end",
"def case_sensitive_matching=(value)\n @case_sensitive_matching = value\n end",
"def ilike(*args)\n SQL::StringExpression.like(*(args << {:case_insensitive=>true}))\n end",
"def case_sensitive_matching\n @case_sensitive_matching = false if @cas... | [
"0.60758317",
"0.597875",
"0.5960699",
"0.5924005",
"0.5816045",
"0.58006597",
"0.5788863",
"0.5767356",
"0.5766509",
"0.57382846",
"0.57281953",
"0.57193863",
"0.56093216",
"0.5576912",
"0.55692375",
"0.5566153",
"0.5536324",
"0.55093455",
"0.5470703",
"0.54494876",
"0.54387... | 0.5698137 | 12 |
Get the first tag by attribute that exactly matches value. Note: Uses XPath | def find_ele_by_attr_include(class_name, attr, value)
@driver.find_element :xpath, string_attr_include(class_name, attr, value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(attribute,xml)\n xml.xpath(\".//#{attribute}\").first.content\n end",
"def find_ele_by_attr_include tag, attr, value\n @driver.find_element :xpath, %Q(#{tag}[contains(@#{attr}, '#{value}')])\n end",
"def unique_attr?(h, a, v)\n v = v.value if v.instance_of? Nokogiri::XML::Attr\n ... | [
"0.65947556",
"0.6555403",
"0.62222916",
"0.6203569",
"0.61485803",
"0.6055903",
"0.60037977",
"0.6001014",
"0.5985566",
"0.5911278",
"0.58188975",
"0.5783836",
"0.57577807",
"0.56814",
"0.5656462",
"0.5640412",
"0.5612942",
"0.5608063",
"0.55789465",
"0.555364",
"0.55370426"... | 0.56733376 | 14 |
Get tags by attribute that include value. Note: Uses XPath | def find_eles_by_attr_include(class_name, attr, value)
@driver.find_elements :xpath, string_attr_include(class_name, attr, value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_eles_by_attr_include tag, attr, value\n @driver.find_elements :xpath, %Q(#{tag}[contains(@#{attr}, '#{value}')])\n end",
"def find_ele_by_attr_include tag, attr, value\n @driver.find_element :xpath, %Q(#{tag}[contains(@#{attr}, '#{value}')])\n end",
"def find_ele_by_attr_include(class_name, at... | [
"0.7251203",
"0.6954401",
"0.6059765",
"0.5996906",
"0.5952063",
"0.5794395",
"0.5749047",
"0.56556326",
"0.5608937",
"0.55951315",
"0.5560292",
"0.5511107",
"0.54766345",
"0.5425634",
"0.5424575",
"0.54140764",
"0.5361043",
"0.53176063",
"0.5310199",
"0.5310199",
"0.529621",... | 0.6345083 | 2 |
Get the first elements that include insensitive value. Note: Uses Predicate | def find_ele_by_predicate_include(class_name: '*', value:)
elements = find_eles_by_predicate_include(class_name: class_name, value: value)
raise _no_such_element if elements.empty?
elements.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_wa(elements)\n elements.any? do |i|\n if i.class == String \n if i.start_with?\"wa\"\n return i\n end\n end\n end\nend",
"def first_wa(collections)\n collections.find{|element| element.to_s.start_with?(\"wa\")}\nend",
"def first_matching(key)\n @attributes.find do |a|\n a[... | [
"0.6008626",
"0.5993267",
"0.58944714",
"0.5858174",
"0.57964283",
"0.56728584",
"0.5652361",
"0.5630794",
"0.5610461",
"0.5604588",
"0.56044406",
"0.5538528",
"0.5494508",
"0.54767305",
"0.5472508",
"0.54685456",
"0.5459235",
"0.54492825",
"0.5401974",
"0.5398838",
"0.539817... | 0.591615 | 2 |
Get elements that include case insensitive value. Note: Uses Predicate | def find_eles_by_predicate_include(class_name: '*', value:)
predicate = if class_name == '*'
%(name contains[c] "#{value}" || label contains[c] "#{value}" || value contains[c] "#{value}")
else
%(type == "#{class_name}" && ) +
%((name ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(field, value)\n @rows.select {|row| get_variable(row, field).downcase == value.downcase}\n end",
"def case_insensitive_match; end",
"def ilike(*args)\n SQL::StringExpression.like(*(args << {:case_insensitive=>true}))\n end",
"def test_case_insensitivity\n data = JSON.par... | [
"0.6371388",
"0.6323839",
"0.618747",
"0.6130563",
"0.609258",
"0.60481554",
"0.5910682",
"0.59081286",
"0.58648247",
"0.5848808",
"0.5809977",
"0.5738495",
"0.572309",
"0.5703053",
"0.56821847",
"0.5675676",
"0.5653045",
"0.56419075",
"0.56330454",
"0.559655",
"0.5559514",
... | 0.57887524 | 11 |
Get the first tag that matches class_name | def first_ele(class_name)
ele_index class_name, 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_ele(class_name)\n tag(class_name)\n end",
"def tag(class_name)\n find_element :class, class_name\n end",
"def get_tag(tag_class); end",
"def classByName(className)\r\n\t\t# we keep a blacklist of classes. For instance\r\n\t\t# if you are using say QT, you'll have constant references... | [
"0.8118293",
"0.7332952",
"0.6790733",
"0.65368474",
"0.6455647",
"0.6332808",
"0.6310681",
"0.6175639",
"0.61187875",
"0.60413426",
"0.5985038",
"0.595403",
"0.59358335",
"0.5831728",
"0.5824074",
"0.5808413",
"0.57907516",
"0.57436866",
"0.5690894",
"0.5685166",
"0.5634362"... | 0.7550879 | 1 |
Get the last tag that matches class_name | def last_ele(class_name)
ele_index class_name, 'last()'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_ele tag_name\n xpath \"//#{tag_name}[last()]\"\n end",
"def last_tab_class(klass, tab_classes)\n tab_classes.last == klass ? 'last' : ''\n end",
"def tag(class_name)\n find_element :class, class_name\n end",
"def last_text\n last_ele static_text_class\n end",
"def click_on_... | [
"0.6693642",
"0.64208484",
"0.63004625",
"0.6291356",
"0.6264255",
"0.625977",
"0.61414546",
"0.61096627",
"0.6052655",
"0.58395296",
"0.5783595",
"0.57393533",
"0.56951994",
"0.568048",
"0.5650578",
"0.5609743",
"0.5577413",
"0.55577266",
"0.5514036",
"0.55063033",
"0.550517... | 0.7419824 | 1 |
Returns the first visible element matching class_name | def tag(class_name)
ele_by_json(typeArray: [class_name], onlyVisible: true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_ele(class_name)\n ele_index class_name, 1\n end",
"def complex_find_exact(class_name, value)\n find_element :uiautomator, string_visible_exact(class_name, value)\n end",
"def complex_finds_exact(class_name, value)\n find_elements :uiautomator, string_visible_exact(class_name, val... | [
"0.7009957",
"0.64581823",
"0.60777885",
"0.605078",
"0.59652394",
"0.5844093",
"0.58250654",
"0.58241177",
"0.5819316",
"0.571309",
"0.568779",
"0.56193316",
"0.5542056",
"0.5539842",
"0.5490055",
"0.548029",
"0.5449258",
"0.5441699",
"0.54185486",
"0.5408466",
"0.5395972",
... | 0.5592096 | 12 |
Returns all visible elements matching class_name | def tags(class_name)
eles_by_json(typeArray: [class_name], onlyVisible: true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(class_name)\n find_elements :class, class_name\n end",
"def div_by_class(class_name)\n return @browser.div(:class, cuke_class(class_name))\nend",
"def complex_finds_contains(class_name, value)\n find_elements :uiautomator, string_visible_contains(class_name, value)\n end",
"def find... | [
"0.6076856",
"0.6061966",
"0.5995089",
"0.59356856",
"0.5933736",
"0.58430743",
"0.57802254",
"0.57344204",
"0.57324034",
"0.5728903",
"0.570532",
"0.56116796",
"0.5578441",
"0.55760443",
"0.55676174",
"0.5558516",
"0.5536007",
"0.5524586",
"0.5424356",
"0.5391998",
"0.537842... | 0.50039285 | 68 |
Returns all visible elements matching class_names and value This method calls find_element/s and element.value/text many times. So, if you set many class_names, this method's performance become worse. | def tags_include(class_names:, value: nil)
return unless class_names.is_a? Array
class_names.flat_map do |class_name|
value ? eles_by_json_visible_contains(class_name, value) : tags(class_name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elements\n if @frame.nil?\n $driver.switch_to.default_content\n else\n $driver.switch_to.frame(@frame.element)\n end\n for locator in @locators\n by, value = locator.first\n if not @root == nil and @root.instance_variable_defined?(\"@locators\") and not @root.locators.nil?\n ... | [
"0.6498291",
"0.6472403",
"0.63697326",
"0.6264759",
"0.6023003",
"0.58021814",
"0.570789",
"0.56959224",
"0.5656965",
"0.5538087",
"0.54534084",
"0.5409297",
"0.53958523",
"0.53738064",
"0.53119904",
"0.52838165",
"0.52491754",
"0.5240138",
"0.52268666",
"0.5225299",
"0.5211... | 0.0 | -1 |
Returns all visible elements matching class_names and value. This method calls find_element/s and element.value/text many times. So, if you set many class_names, this method's performance become worse. | def tags_exact(class_names:, value: nil)
return unless class_names.is_a? Array
class_names.flat_map do |class_name|
value ? eles_by_json_visible_exact(class_name, value) : tags(class_name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elements\n if @frame.nil?\n $driver.switch_to.default_content\n else\n $driver.switch_to.frame(@frame.element)\n end\n for locator in @locators\n by, value = locator.first\n if not @root == nil and @root.instance_variable_defined?(\"@locators\") and not @root.locators.nil?\n ... | [
"0.6447007",
"0.63826936",
"0.6299099",
"0.62659866",
"0.5994708",
"0.5737948",
"0.56685853",
"0.5661237",
"0.5575916",
"0.54779685",
"0.544485",
"0.5366141",
"0.53323144",
"0.5276201",
"0.52424765",
"0.5220474",
"0.52165824",
"0.5213039",
"0.51636857",
"0.51589197",
"0.51511... | 0.44125238 | 96 |
Find the first element that contains value. For Appium(automation name), not XCUITest | def ele_by_json_visible_contains(element, value)
ele_by_json string_visible_contains element, value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_element_by_value(locator, value)\n @browser.find_elements(locator).select { |el| el.attribute('value') == value }.first\n end",
"def complex_find_exact(class_name, value)\n find_element :uiautomator, string_visible_exact(class_name, value)\n end",
"def find_exact(value)\n ele_by_j... | [
"0.6837498",
"0.68217415",
"0.66933054",
"0.66696924",
"0.6634701",
"0.66165704",
"0.66026086",
"0.65397733",
"0.6475052",
"0.61740905",
"0.6164298",
"0.61564225",
"0.6133062",
"0.61172426",
"0.6099853",
"0.60568243",
"0.6053137",
"0.60278946",
"0.59975845",
"0.59933454",
"0.... | 0.61113274 | 14 |
Find all elements containing value For Appium(automation name), not XCUITest | def eles_by_json_visible_contains(element, value)
eles_by_json string_visible_contains element, value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complex_finds_exact(class_name, value)\n find_elements :uiautomator, string_visible_exact(class_name, value)\n end",
"def complex_finds_contains(class_name, value)\n find_elements :uiautomator, string_visible_contains(class_name, value)\n end",
"def elements_by_xpath(value)\n find_by... | [
"0.67231905",
"0.66944605",
"0.65056497",
"0.6492043",
"0.6479291",
"0.64575285",
"0.6312249",
"0.6257989",
"0.5986118",
"0.5950939",
"0.5943426",
"0.5901093",
"0.58917236",
"0.5889418",
"0.58754224",
"0.5870049",
"0.5869375",
"0.5864831",
"0.58557343",
"0.5853534",
"0.584512... | 0.0 | -1 |
Find the first element exactly matching value For Appium(automation name), not XCUITest | def ele_by_json_visible_exact(element, value)
ele_by_json string_visible_exact element, value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_exact name\n # exact description\n result = mobile :find, [ [ [5, name] ] ]\n\n return result if result.kind_of? Selenium::WebDriver::Element\n\n if result.length > 0\n result.first\n else\n Appium::Common.raise_no_element_error\n end\n end",
"def complex_find_exact(class_na... | [
"0.7042881",
"0.69133943",
"0.6661308",
"0.6576121",
"0.6565939",
"0.64118314",
"0.64031595",
"0.63373315",
"0.6258938",
"0.62309766",
"0.62041056",
"0.61387056",
"0.60972106",
"0.59692454",
"0.5948665",
"0.5939786",
"0.5932717",
"0.58896226",
"0.5877823",
"0.585009",
"0.5832... | 0.5991746 | 13 |
Find all elements exactly matching value For Appium(automation name), not XCUITest | def eles_by_json_visible_exact(element, value)
eles_by_json string_visible_exact element, value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complex_finds_exact(class_name, value)\n find_elements :uiautomator, string_visible_exact(class_name, value)\n end",
"def complex_finds_contains(class_name, value)\n find_elements :uiautomator, string_visible_contains(class_name, value)\n end",
"def complex_find_exact(class_name, value)\n ... | [
"0.69478077",
"0.6570468",
"0.65072316",
"0.6504782",
"0.6425075",
"0.6423188",
"0.63442546",
"0.6335679",
"0.63009727",
"0.6249892",
"0.6194833",
"0.61350375",
"0.6085912",
"0.603362",
"0.60228395",
"0.5964982",
"0.59619814",
"0.59574753",
"0.5907864",
"0.588169",
"0.5877107... | 0.0 | -1 |
predicate the predicate to evaluate on the main app visible if true, only visible elements are returned. default true | def _all_pred(opts)
predicate = opts[:predicate]
raise 'predicate must be provided' unless predicate
visible = opts.fetch :visible, true
%($.mainApp().getAllWithPredicate("#{predicate}", #{visible});)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visible?\n end",
"def visible?\n true\n end",
"def visible?\n el.displayed?\n end",
"def visible?\n wd_element.displayed?\n end",
"def visible?() \n if @visible.nil?\n visible = parent.nil? ? true : parent.visible?\n else\n visible = @vi... | [
"0.7149325",
"0.7003015",
"0.69494474",
"0.6901894",
"0.6847585",
"0.6807638",
"0.6807638",
"0.67617744",
"0.66496",
"0.664519",
"0.66396177",
"0.6613326",
"0.6575461",
"0.65089613",
"0.6449173",
"0.63903445",
"0.63903445",
"0.63903445",
"0.63903445",
"0.6348927",
"0.62814355... | 0.6459401 | 14 |
returns element matching predicate contained in the main app predicate the predicate to evaluate on the main app visible if true, only visible elements are returned. default true | def ele_with_pred(opts)
# true = return only visible
find_element(:uiautomation, _all_pred(opts))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visible?\n el.displayed?\n end",
"def visible?\n wd_element.displayed?\n end",
"def _all_pred(opts)\n predicate = opts[:predicate]\n raise 'predicate must be provided' unless predicate\n\n visible = opts.fetch :visible, true\n %($.mainApp().getAllWithPredicate(\"#{pr... | [
"0.64317083",
"0.63548326",
"0.6203854",
"0.615038",
"0.6124172",
"0.60154307",
"0.6011217",
"0.58392376",
"0.5836192",
"0.5836192",
"0.5768463",
"0.5752963",
"0.5727628",
"0.5717397",
"0.5710415",
"0.5686586",
"0.5631857",
"0.5630924",
"0.560769",
"0.5596688",
"0.5582891",
... | 0.68342257 | 0 |
returns elements matching predicate contained in the main app predicate the predicate to evaluate on the main app visible if true, only visible elements are returned. default true | def eles_with_pred(opts)
find_elements(:uiautomation, _all_pred(opts))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _all_pred(opts)\n predicate = opts[:predicate]\n raise 'predicate must be provided' unless predicate\n\n visible = opts.fetch :visible, true\n %($.mainApp().getAllWithPredicate(\"#{predicate}\", #{visible});)\n end",
"def ele_with_pred(opts)\n # true = return only visible\n f... | [
"0.6873556",
"0.6582519",
"0.5983667",
"0.596539",
"0.58759916",
"0.5854318",
"0.57948714",
"0.57349217",
"0.5659715",
"0.56550324",
"0.5611982",
"0.5550254",
"0.5550254",
"0.55442774",
"0.55389017",
"0.55348945",
"0.55210286",
"0.5513848",
"0.55065334",
"0.54724365",
"0.5431... | 0.0 | -1 |
open the current annotation in the viewer | def open
annotation = Annotation.find(params["id"])
redirect_to :controller => :viewer,
:annotation => annotation.name,
:username => annotation.user.username
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_in_viewer\n fork { exec \"#{Seee::Config.application_paths[:pdf_viewer]} \\\"#{current_path}\\\"\" }\n end",
"def view\n\t `ruby #{File.dirname(__FILE__) + \"/viewer/viewer.rb\"}`\n end",
"def open(sender)\n open = NSOpenPanel.openPanel\n open.setAllowsMultipleSelection(true)\n open... | [
"0.6773773",
"0.5950442",
"0.5833134",
"0.5714083",
"0.5682408",
"0.56801045",
"0.5679086",
"0.5620165",
"0.56156874",
"0.55570775",
"0.5521898",
"0.5502944",
"0.5467594",
"0.5467584",
"0.5467584",
"0.5467584",
"0.5467584",
"0.54398394",
"0.54254615",
"0.54254615",
"0.5393909... | 0.8164466 | 0 |
only public annotations may be accessed | def public_annotation?
if params["id"] # == only for actions working on a single record
annotation = Annotation.find(params["id"])
redirect_to root_url unless annotation.public
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extra_annotations; end",
"def annotations; end",
"def annotations; end",
"def annotations; end",
"def annotations; end",
"def annotations; end",
"def annotations; end",
"def annotations; end",
"def annotations; end",
"def accessibility; end",
"def annotator; end",
"def private; end",
"d... | [
"0.76262456",
"0.7521316",
"0.7521316",
"0.7521316",
"0.7521316",
"0.7521316",
"0.7521316",
"0.7521316",
"0.7521316",
"0.71115196",
"0.690523",
"0.66299134",
"0.66125184",
"0.66125184",
"0.64082134",
"0.6406277",
"0.6406277",
"0.6406277",
"0.6406277",
"0.6406277",
"0.6211173"... | 0.5667729 | 45 |
Use callbacks to share common setup or constraints between actions. | def set_pain_score
@pain_score = PainScore.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 list of trusted parameters through. | def pain_score_params
params.require(:pain_score).permit(:day, :patient, :procedure, :score)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Here is where you will write the url_builder method that are defined in the associated specifications file. For more information about methods and their parameters I encourage you to read some of the following: | def url_builder(url,parameters = {}) # vals = {} assigns emtpy hash as default if nothing passed in
parameters[:results] = 10 unless parameters.key?(:results)
#debugger
# -OR-
## sets defaults and overrides original parameters with passed in vals
#parameters = { :results => 10, :sort_by => "date"}.merge(pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_url path, params={}\n full_path = @uri.path + path\n super full_path, params, @uri.query\n end",
"def build_url path, params={}\n full_path = @uri.path + path\n super full_path, params, @uri.query\n end",
"def build_url path, params={}\n full_path = @uri.path + path\n super full_p... | [
"0.6715006",
"0.6715006",
"0.6715006",
"0.6601095",
"0.6591605",
"0.65538365",
"0.64725083",
"0.644101",
"0.6350226",
"0.62875575",
"0.6268549",
"0.6251081",
"0.6251081",
"0.6251081",
"0.6246072",
"0.6239774",
"0.6231336",
"0.62222123",
"0.6212218",
"0.61692613",
"0.6132249",... | 0.6349138 | 9 |
GET /signatures GET /signatures.json | def index
@all_signatures = @petition.signatures.limit(900)
per_page = 100
@page = if params[:page].to_i > 0
params[:page].to_i
elsif params[:signature_id]
(@all_signatures.pluck(:id).index(params[:signature_id].to_i).to_f / per_page).floor + 1
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @signatures = Signature.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @signatures }\n end\n end",
"def get_signatures(limit = 100, offset = 0, conditions = {})\n params = extract_query_params conditions\n\n ... | [
"0.7352595",
"0.7293869",
"0.71673274",
"0.68973875",
"0.6848121",
"0.67847145",
"0.6708128",
"0.66092",
"0.6427227",
"0.64176315",
"0.6407403",
"0.6290917",
"0.6276798",
"0.6269559",
"0.6131402",
"0.59418297",
"0.59418297",
"0.5939492",
"0.59176624",
"0.59176624",
"0.5873143... | 0.6617593 | 7 |
POST /signatures POST /signatures.json | def create
# try to find old signature first
email = signature_params[:person_email]
@signature = Signature.find_by(person_email: email, petition: @petition)
unless @signature
@signature = NewSignature.find_by(person_email: email, petition: @petition)
end
if @signature
# we found a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @signature = Signature.new(signature_params)\n @signature.save\n\n respond_to do |format|\n if @signature.save\n #format.html { redirect_to @signature, notice: 'Signature was successfully created.' }\n format.json { render :json => @signature.to_json({}) }\n else\n ... | [
"0.68267846",
"0.6709192",
"0.6684488",
"0.66836125",
"0.65567523",
"0.6516735",
"0.63993657",
"0.63775295",
"0.61152303",
"0.60940313",
"0.6085073",
"0.6085073",
"0.6085073",
"0.6085073",
"0.6072999",
"0.60723627",
"0.6056149",
"0.602669",
"0.6017604",
"0.6001365",
"0.597111... | 0.5915523 | 30 |
get signature confirm page view the details of your signature | def confirm
@petition = @signature.petition
# generate the update signature url
@url = petition_signature_confirm_submit_path(@petition, @signature.unique_key)
# check if we are in the unconfirmed table
if @signature.class == NewSignature
# check if we need to have extra information
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @signature = Signature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @signature }\n end\n end",
"def show\n @signature = Signature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ... | [
"0.67588735",
"0.6608238",
"0.6438406",
"0.6311278",
"0.61721987",
"0.61606324",
"0.614404",
"0.61047494",
"0.60954183",
"0.6071842",
"0.6063601",
"0.59811693",
"0.5955249",
"0.5942255",
"0.59330964",
"0.5889091",
"0.5889091",
"0.58739334",
"0.58475506",
"0.5823783",
"0.58122... | 0.6283076 | 4 |
Add all the element_id's that need to be correct highlight them in javascript TODO add proper validation | def add_check_fields
@check_fields = []
if @signature.require_full_address?
new_fields = %w[
person_street
person_city
person_street_number
person_postalcode]
@check_fields.push(*new_fields)
end
@check_fields.push('person_country') if @signature.require_person... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def highlights; end",
"def highlights; end",
"def highlights; end",
"def highlight_element(element)\n execute_script(\"arguments[0].style.border='3px solid red'\", element)\n end",
"def id_and_class(options = {}) # change to {}\n\t\tids = [\"id='td_#{self.cell_id(options[:number])}' class='#{self.class... | [
"0.5766376",
"0.5766376",
"0.5766376",
"0.56302136",
"0.54579455",
"0.5412248",
"0.5369385",
"0.52818185",
"0.5209337",
"0.5199844",
"0.51836246",
"0.5182516",
"0.514347",
"0.51129353",
"0.51097775",
"0.5081656",
"0.5078933",
"0.5042618",
"0.50363344",
"0.50363344",
"0.503497... | 0.0 | -1 |
POST a signature update by user a save update on a signature. | def confirm_submit
@petition = @signature.petition
if @petition && @signature.update(signature_params) && @signature.valid?
# signature also passed validation
@signature.confirmed = true
respond_to do |format|
format.json { render :show, status: :ok }
format.html do
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_signature!; end",
"def update_signature!; end",
"def update\n respond_to do |format|\n if @user_signature.update(user_signature_params)\n format.html { redirect_to @user_signature, notice: 'User signature was successfully updated.' }\n format.json { head :no_content }\n el... | [
"0.7392692",
"0.7392692",
"0.72993124",
"0.708355",
"0.6988832",
"0.6988832",
"0.6984091",
"0.6950457",
"0.6644867",
"0.6501066",
"0.6378675",
"0.62824786",
"0.6246343",
"0.6199955",
"0.61670303",
"0.6161105",
"0.61553353",
"0.61484635",
"0.61484635",
"0.6138038",
"0.61119866... | 0.5999922 | 26 |
ONLY ALLOWED FOR ADMINS TO update special status of signature PATCH/PUT /signatures/1 PATCH/PUT /signatures/1.json | def special_update
@petition = @signature.petition
# only allow updates from admins
authorize @petition
respond_to do |format|
if @signature.update(special_params)
format.html { redirect_to @petition, notice: 'Signature was successfully updated.' }
format.json { render :show, sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_signature!; end",
"def update_signature!; end",
"def update\n respond_to do |format|\n if @signature.update(signature_params)\n format.html { redirect_to @signature, notice: 'Signature was successfully updated.' }\n format.json { head :no_content }\n else\n format.h... | [
"0.703356",
"0.703356",
"0.67906874",
"0.6664607",
"0.65660733",
"0.6535333",
"0.6535333",
"0.64857185",
"0.64857185",
"0.6341453",
"0.6234716",
"0.6193889",
"0.61657387",
"0.61492056",
"0.6125917",
"0.6057963",
"0.6045571",
"0.6017546",
"0.598317",
"0.59529054",
"0.59520334"... | 0.7320666 | 0 |
DELETE /signatures/1 DELETE /signatures/1.json | def destroy
@petition = @signature.petition
# only allow deletes from owners
authorize @petition
@signature.destroy
respond_to do |format|
format.html { redirect_to signatures_url, notice: 'Signature was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @signature = Signature.find(params[:id])\n @signature.destroy\n\n respond_to do |format|\n format.html { redirect_to signatures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @signature = Signature.find(params[:id])\n @signature.destroy\n\n res... | [
"0.7766996",
"0.7766996",
"0.7717916",
"0.7612425",
"0.7322239",
"0.7182167",
"0.6723235",
"0.66333187",
"0.6588641",
"0.6512779",
"0.64696693",
"0.6458786",
"0.6451155",
"0.64483494",
"0.64415914",
"0.64342195",
"0.6429447",
"0.6426784",
"0.6394779",
"0.6376099",
"0.63747585... | 0.67746955 | 6 |
Use callbacks to share common setup or constraints between actions. | def set_signature
@signature = Signature.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 signature_params
params.require(:signature).permit(
:person_city, :more_information, :person_name, :person_email,
:person_street, :person_street_number, :person_born_at, :person_postalcode,
:person_function, :person_country, :person_famous,
:person_street_number_suffix,
:subscribe,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
log file creation helper | def log_to_file(filepath, object)
#puts "log_to_file #{filepath}"
final_path = File.join($boxes_logs_dir, filepath)
pn = Pathname.new(final_path).cleanpath
FileUtils.mkdir_p(pn.dirname)
File.write(File.join(final_path), object)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_file_creation()\n\tcurrent_path = File.dirname(File.realpath(__FILE__))\n\t$csv_path = \"#{current_path}/Attachments.csv\"\n\tif !File.directory?(\"#{current_path}/logs\")\n\t\tFileUtils.mkdir_p \"#{current_path}/logs\"\n\tend\n\t$log_path = \"#{current_path}/logs/jira-attachment-upload.txt\"\n\t$log = Log... | [
"0.829126",
"0.787744",
"0.76640725",
"0.7613303",
"0.7608568",
"0.7585881",
"0.7524745",
"0.7382075",
"0.73549616",
"0.72487396",
"0.7228444",
"0.7189704",
"0.7173503",
"0.7165274",
"0.71569157",
"0.71549594",
"0.71541786",
"0.7153607",
"0.7126931",
"0.71077716",
"0.7102981"... | 0.70622474 | 23 |
load yaml helper (includes ERB interpolation) | def load_yaml(yaml_path, variables = nil)
#puts "load_yaml #{yaml_path}"
if variables
YAML.load(ERB.new(File.read(yaml_path)).result(OpenStruct.new(variables).instance_eval { binding }))
else
YAML.load(ERB.new(File.read(yaml_path)).result)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_yaml(filename); end",
"def yaml_load filename\n yaml_string = File.read filename\n\n YAML::load yaml_string\nend",
"def yaml_load filename\n yaml_string = File.read filename\n\n YAML::load yaml_string\nend",
"def load_yml(filename); end",
"def loadyaml(filename) YAML.load_file(filename) end"... | [
"0.7794761",
"0.72796285",
"0.72796285",
"0.72698134",
"0.721363",
"0.71662337",
"0.7138019",
"0.7138019",
"0.7002716",
"0.69431067",
"0.69361067",
"0.69339585",
"0.69074064",
"0.6898113",
"0.6872477",
"0.6862132",
"0.68451697",
"0.6830225",
"0.67919755",
"0.6693796",
"0.6687... | 0.746403 | 1 |
load definitions from a directory path | def load_user(filepath)
$user = load_yaml(filepath)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_definitions(dirpath)\n Dir.glob(dirpath) do |item|\n namespace = File.basename(item, \".*\")\n definitions = load_yaml(item)\n definitions.each do |key, value|\n definition_key = \"#{key}.#{namespace}\"\n if $definitions[definition_key]\n $definitions[definition_key] = $definiti... | [
"0.74322623",
"0.70922047",
"0.679865",
"0.67795324",
"0.6689976",
"0.6663391",
"0.66476655",
"0.6556623",
"0.6504245",
"0.64854366",
"0.64715886",
"0.6453516",
"0.6453516",
"0.64127606",
"0.64052826",
"0.6267528",
"0.62250257",
"0.6187034",
"0.6185087",
"0.6176527",
"0.61722... | 0.0 | -1 |
load definitions from a directory path | def load_definitions(dirpath)
Dir.glob(dirpath) do |item|
namespace = File.basename(item, ".*")
definitions = load_yaml(item)
definitions.each do |key, value|
definition_key = "#{key}.#{namespace}"
if $definitions[definition_key]
$definitions[definition_key] = $definitions[definition_k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_factories_if_directory(path)\n if File.directory?(path)\n Dir[File.join(path, '**', '*.rb')].sort.each { |file| Kernel.load file }\n end\n end",
"def load_definitions\n clear_definitions\n Dir[File.expand_path('../../data/*.json', __dir__)].each { |f| load_json(f) }\n ... | [
"0.70922047",
"0.679865",
"0.67795324",
"0.6689976",
"0.6663391",
"0.66476655",
"0.6556623",
"0.6504245",
"0.64854366",
"0.64715886",
"0.6453516",
"0.6453516",
"0.64127606",
"0.64052826",
"0.6267528",
"0.62250257",
"0.6187034",
"0.6185087",
"0.6176527",
"0.61722195",
"0.61570... | 0.74322623 | 0 |
load definitions from a directory path | def load_provisions(dirpath)
Dir.glob(dirpath) do |item|
namespace = File.basename(item, ".*")
provisions = load_yaml(item)
provisions.each do |key, value|
provision_key = "#{key}.#{namespace}"
if $provisions[provision_key]
$provisions[provision_key] = $provisions[provision_key].deep_m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_definitions(dirpath)\n Dir.glob(dirpath) do |item|\n namespace = File.basename(item, \".*\")\n definitions = load_yaml(item)\n definitions.each do |key, value|\n definition_key = \"#{key}.#{namespace}\"\n if $definitions[definition_key]\n $definitions[definition_key] = $definiti... | [
"0.74322623",
"0.70922047",
"0.679865",
"0.67795324",
"0.6689976",
"0.6663391",
"0.66476655",
"0.6556623",
"0.6504245",
"0.64854366",
"0.64715886",
"0.6453516",
"0.6453516",
"0.64127606",
"0.64052826",
"0.6267528",
"0.62250257",
"0.6187034",
"0.6185087",
"0.6176527",
"0.61722... | 0.0 | -1 |
load vms from a directory path | def load_vms_dir(dirpath, vagrant_config)
Dir.glob(dirpath) do |filepath|
namespace = File.basename(filepath, ".*") # stackfilename
vms_file = load_yaml(filepath)
vms_file.each do |key, value|
vm_config = value
vm_config['lib'] = vm_config['lib'] || {}
vm_config['lib']['namespace']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vms\n load! if !loaded?\n @vms ||= load_vms!\n end",
"def load(path); end",
"def load(path)\n if File.file? path\n load_file path\n elsif File.directory? path\n Dir.foreach(path) do |file|\n file = \"#{path}/#{file}\"\n next unless File.stat(file).file?\n l... | [
"0.64006066",
"0.63489175",
"0.60538745",
"0.5990201",
"0.5967208",
"0.5936905",
"0.581512",
"0.57853234",
"0.57853234",
"0.57635504",
"0.56550854",
"0.5620009",
"0.56005657",
"0.5480424",
"0.5447931",
"0.5444479",
"0.54222345",
"0.541522",
"0.5409521",
"0.53960687",
"0.53948... | 0.68452764 | 0 |
loop to configure all vms from $vms | def configure_vms(config)
$vms.each do |key,vm_config|
# pp vm_config
config.vm.define key, autostart: vm_config['autostart'] || false do |node|
# node.ssh.insert_key = true
# node.ssh.username = "toto"
configure_node(vm_config, node)
vm_config_copy = object_clone(vm_config)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_vms\n @vms = []\n\n response = @conn.get do |req|\n req.url \"/api/v1/vms\"\n req.headers = rest_headers\n end\n\n @vms = json(response.body)[:vms]\n end",
"def create_vm(vms, vm_type, config)\n vms.each do | vm |\n hostname = vm.get_hostname\n \n ... | [
"0.6616966",
"0.6337401",
"0.6254927",
"0.61814713",
"0.61482275",
"0.6132569",
"0.6059571",
"0.6056293",
"0.60294384",
"0.60231715",
"0.5992558",
"0.59683996",
"0.5855628",
"0.5847098",
"0.5823786",
"0.58200353",
"0.57997954",
"0.57950425",
"0.5782607",
"0.57749754",
"0.5753... | 0.7495985 | 0 |
=begin def check_date date1 = release_date 1 date2 = Time.now() date2 > date1 end =end Devuelve TRUE si la historia ha sido adquirida por el usuario 'user'. | def has_been_acquired_by_user?(user)
current_user_profile = Profile.find_by(user_id: user.id)
addition = Addition.find_by(profile_id: current_user_profile, story_id: self.id)
addition != nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_date()\n event = Event.find_by(id: self.event_id) \n if Time.now > event.start_date then\n halt msg: 'check_date() fail' \n false\n else\n true\n end\n end",
"def check_dates\n # TODO the init_time must be less then the end_time\n true\n end",
"def check_before_d... | [
"0.7092684",
"0.70564276",
"0.6678671",
"0.664222",
"0.66059613",
"0.65916234",
"0.65556276",
"0.65480363",
"0.6537661",
"0.6526731",
"0.6482575",
"0.64685863",
"0.646026",
"0.6440376",
"0.64196503",
"0.6412423",
"0.64065105",
"0.6391602",
"0.637839",
"0.637839",
"0.63767505"... | 0.0 | -1 |
Executes the given rake command on the VMs that are represented by this environment. | def execute
target_vms.each { |vm| execute_on_vm(vm, mysql_command) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute\n command = (rake_command || []).join(\" \")\n target_vms.each { |vm| execute_on_vm(vm, command) }\n end",
"def rake(*args) run_command('rake', args) end",
"def execute_on_vm(vm, command)\n vm.env.actions.run(:rake,\n \"rake.command\" => command,\n ... | [
"0.8131426",
"0.72917926",
"0.7223231",
"0.7189712",
"0.6822084",
"0.6757947",
"0.67568064",
"0.6617506",
"0.6589051",
"0.64814186",
"0.64814186",
"0.64814186",
"0.64716476",
"0.64471316",
"0.6405091",
"0.6293217",
"0.61496097",
"0.61230016",
"0.61002934",
"0.6084538",
"0.600... | 0.5847154 | 25 |
Executes a command on a specific VM. | def execute_on_vm(vm, command)
vm.env.actions.run(:mysql, "mysql.command" => command)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec_vm_command(task)\n\t\t# Format alternate version of tenant alias for backend scripts\n\t\tcamelcase_tenant = task['tenant'].split('-').select { |w| w.capitalize! || w }.join('')\n\n\t\t# Connect to VM using SSH key\n\t\tssh = Net::SSH.start($vm_hostname, \"vagrant\", {:keys => [$ssh_key]})\n\n\t\tscript =... | [
"0.73105645",
"0.72420174",
"0.6800336",
"0.66921383",
"0.6608815",
"0.6531938",
"0.65235245",
"0.65227824",
"0.6494855",
"0.6415447",
"0.640798",
"0.640021",
"0.6359468",
"0.63593435",
"0.6342959",
"0.63376004",
"0.63243985",
"0.62772566",
"0.62697524",
"0.62697524",
"0.6267... | 0.73235154 | 0 |
used by index page to get all jokes | def index
@jokes = Joke.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if is_clean_mode?\n @jokes = Joke.where('is_kid_safe = 1')\n else\n @jokes = Joke.all\n end\n\n generate_title \"All Jokes\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jokes }\n end\n end",
"def index\n @pokes = Po... | [
"0.735839",
"0.7140097",
"0.70686877",
"0.6774691",
"0.63934195",
"0.63700324",
"0.6313435",
"0.6265866",
"0.6228165",
"0.62162316",
"0.61828494",
"0.61544275",
"0.6144401",
"0.6143949",
"0.61402255",
"0.6112529",
"0.6112529",
"0.6109756",
"0.61072403",
"0.6101773",
"0.609590... | 0.7702325 | 0 |
user makes new joke | def new
@joke = current_user.jokes.build
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def joke_randomizer(user)\n puts \" \"\n puts \"Hope this makes you laugh! \"\n puts \" \"\n puts \"*********************\"\n random_joke = Joke.all.sample.text\n puts... | [
"0.70351315",
"0.68743795",
"0.68219686",
"0.6783006",
"0.6723649",
"0.65354085",
"0.65338427",
"0.64615494",
"0.64615494",
"0.6346308",
"0.6307725",
"0.6278217",
"0.6175062",
"0.6136417",
"0.6121969",
"0.5940324",
"0.5940281",
"0.58404857",
"0.58271897",
"0.58220774",
"0.573... | 0.65755093 | 5 |
save joke into database if it has required params | def create
@joke = current_user.jokes.build(joke_params)
if @joke.save
upvote_on_post
redirect_to @joke
else
render 'new'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def joke_params\n params.require(:joke).permit(:joke_posts, :user_id)\n end",
"def save!\n end",
"def save\n # 1. What am I saving?\n # 2. input => username, message\n\n # if i saved\n # update OI don't want to do thjis!!!\n # else\n\n sql = <<-SQL\n INSERT INTO tweets (us... | [
"0.6299245",
"0.6085406",
"0.60391897",
"0.6034203",
"0.6033705",
"0.5985924",
"0.5953525",
"0.5921365",
"0.5910245",
"0.5900028",
"0.5881556",
"0.5860185",
"0.5860185",
"0.5860185",
"0.5860185",
"0.5860185",
"0.5860185",
"0.5860185",
"0.5860185",
"0.5838066",
"0.5821951",
... | 0.5354088 | 98 |
Factorisation // A revoir // | def factorial(a)
return 1 if a == 1 || a == 0
return a*factorial(a-1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def factor\n raise NotImplementedError, \"The #factor method should be implemented for each subclass\"\n end",
"def factor\n @factor if valid?\n end",
"def factors(num)\n\nend",
"def factors(num)\n\nend",
"def factors(num)\n\nend",
"def factor\n fail NotImplementedError,\n \"Th... | [
"0.74981",
"0.7426705",
"0.74038494",
"0.74038494",
"0.74038494",
"0.7280496",
"0.70711905",
"0.706972",
"0.69908947",
"0.6818988",
"0.6800303",
"0.6800303",
"0.6800303",
"0.67892736",
"0.6753885",
"0.67034733",
"0.6673323",
"0.6668212",
"0.66654545",
"0.6598573",
"0.6597707"... | 0.0 | -1 |
Allows us to grab current_user profile pic in all cases (if there is no attached avatars, we display a default avatar) | def avatar(avatar_holder)
if avatar_holder.avatar.attached?
avatar = avatar_holder.avatar
else
avatar = "https://arena-fighter.s3.eu-west-3.amazonaws.com/avatar.jpg"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile_picture_for(user)\n if user.picture?\n image_tag(user.picture.url, alt: user.name, class: \"profile_picture\")\n else\n image_tag(random_default_image, alt: user.name, class: \"profile_picture\")\n end\n end",
"def user_profile_img(user)\n if user.avatar?\n return image_ta... | [
"0.8122425",
"0.8121273",
"0.80766296",
"0.8042478",
"0.799892",
"0.7915834",
"0.7866489",
"0.78501195",
"0.78382355",
"0.7825136",
"0.7695405",
"0.76557094",
"0.7566331",
"0.75525683",
"0.7535628",
"0.75205815",
"0.74896306",
"0.74794006",
"0.7466956",
"0.7464786",
"0.742641... | 0.72608733 | 31 |
The implementation of the MPEG frames parsing is mostly based on tinytag, a sweet little Python library for parsing audio metadata do check it out if you have a minute. | def parse_mpeg_frames(io)
mpeg_frames = []
MAX_FRAMES_TO_SCAN.times do |frame_i|
# Read through until we can latch onto the 11 sync bits. Read in 4-byte
# increments to save on read() calls
data = io.read(4)
# If we are at EOF - stop iterating
break unless data && data.bytesize =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_metadata\n path = audio.queued_for_write[:original].path\n open_opts = { :encoding => 'utf-8' }\n TagLib::FileRef.open(path) do |fileref|\n tag = fileref.tag\n properties = fileref.audio_properties\n self.update_attributes(:artist => tag.artist,:album=> tag.album,:title => tag.t... | [
"0.69804627",
"0.6682132",
"0.6641856",
"0.652377",
"0.6358772",
"0.6357542",
"0.62699395",
"0.6193",
"0.6193",
"0.6140023",
"0.59926474",
"0.5978472",
"0.59147555",
"0.5877515",
"0.58756256",
"0.58558756",
"0.57312423",
"0.56908166",
"0.56881934",
"0.56822324",
"0.5672792",
... | 0.6338091 | 6 |
Scan 4 byte values, and check whether there is a pattern of the 11 set bits anywhere within it or whether there is the 0xFF byte at the end | def sync_bytes_offset_in_4_byte_seq(four_bytes)
four_bytes[0...3].each_with_index do |byte, i|
next_byte = four_bytes[i + 1]
return i if byte == 0xFF && next_byte > 0xE0
end
four_bytes[-1] == 0xFF ? 3 : 4
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binary_multiple_of_4?(s)\n (/^[10]*00$/ =~ s) != nil\nend",
"def binary_multiple_of_4? s\n if /^[10]*00$/.match(s) or /^[10]*0$/.match(s) \n return true\n else \n return false\n end\nend",
"def binary_multiple_of_4?(str)\n str =~ /^[01]*1[01]*00$/\nend",
"def binary_multiple_of_4?(s)\n return... | [
"0.6726322",
"0.6699251",
"0.6635013",
"0.66345274",
"0.6524545",
"0.64704645",
"0.641499",
"0.6384451",
"0.6373228",
"0.63503474",
"0.62992775",
"0.6274525",
"0.62715375",
"0.6266443",
"0.6229396",
"0.6215188",
"0.6211182",
"0.6205655",
"0.6192934",
"0.6174821",
"0.6162433",... | 0.523227 | 65 |
The mappings table will tell us what other concepts have been directly mapped to the concepts passed in | def related_concept_ids(db, *ids)
ids = ids.flatten
other_ids = db[:mappings].where(concept_2_id: ids).where{Sequel.function(:lower, :relationship_id) =~ 'is_a'}.select_map(:concept_1_id)
other_ids + ids
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mappings\n @mappings ||= []\n end",
"def mappings\n @mappings ||= []\n end",
"def resourceType\n 'ConceptMap'\n end",
"def resourceType\n 'ConceptMap'\n end",
"def mapping; end",
"def mapping; end",
"def get_mapped_concept_name(concept_name)\n ... | [
"0.62377197",
"0.61708057",
"0.6150791",
"0.6150791",
"0.6089947",
"0.6089947",
"0.5927841",
"0.5927003",
"0.5918812",
"0.5918812",
"0.57329285",
"0.5721439",
"0.5699986",
"0.5690009",
"0.5681578",
"0.5645252",
"0.5644367",
"0.5601652",
"0.55581564",
"0.54615235",
"0.54057777... | 0.48740897 | 49 |
Use callbacks to share common setup or constraints between actions. | def set_volunteer
@volunteer = Volunteer.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 volunteer_params
params.fetch(:volunteer, {})
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 |
Verifies the access_token so the client app would know if to login the user. | def verify_access_token
debugger
@user = User.find_by(access_token: params[:session][:access_token])
if @user
render text: "verified", status: 200
else
render text: "Token failed verification", status: 422
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_access_token\n if bypass_auth?\n true\n else\n authenticate_or_request_with_http_token do |token, opts|\n current_user && token && current_user.access_token.token == token\n end\n end\n end",
"def verify_access_token\n \tuser = User.find_by(auth_token: params[:sessio... | [
"0.80923986",
"0.7891219",
"0.76969707",
"0.7543955",
"0.7466597",
"0.74484265",
"0.7262408",
"0.7237163",
"0.72368175",
"0.7201034",
"0.71170384",
"0.71011156",
"0.7089162",
"0.70496136",
"0.697737",
"0.69404244",
"0.6915416",
"0.68367225",
"0.68097806",
"0.6761794",
"0.6692... | 0.7675956 | 3 |
return true if post is faved by current user | def is_fav?(user)
user.favs.find_by(post_id: self.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fave?(post)\n self.faves.find_by_post_id(post.id)\n end",
"def saved?\n user_id?\n end",
"def authorized_to_edit?(post)\n post.user == current_user\n end",
"def authorized_to_edit?(post)\n post.user == current_user\n end",
"def saved_by?(some_user)\n saved_blogposts.find_by(u... | [
"0.74679226",
"0.7197764",
"0.71519196",
"0.71519196",
"0.6761685",
"0.67412615",
"0.6686952",
"0.66789234",
"0.6612456",
"0.6566793",
"0.6495914",
"0.64808583",
"0.64673835",
"0.64672685",
"0.6461862",
"0.6438933",
"0.64115167",
"0.6410031",
"0.6407328",
"0.6387386",
"0.6374... | 0.6011563 | 77 |
return post create date | def create_date
date = self.created_at
date.strftime("%B %d, %Y")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_date(post)\n \" created at: \" + post.created_at.strftime(\"%d %b. %Y\") + \" - \" + post.created_at.strftime(\"%H:%M\") \n end",
"def create_date\n\t\tcreated_at.to_date\n\tend",
"def create_date\n data.create_date\n end",
"def create_date\n data.create_date\n end",
"def cre... | [
"0.8145294",
"0.78244203",
"0.75977415",
"0.75977415",
"0.75977415",
"0.7576225",
"0.7576225",
"0.7527071",
"0.74623764",
"0.7446449",
"0.73993343",
"0.7383411",
"0.73578316",
"0.7296232",
"0.723718",
"0.71601737",
"0.71290535",
"0.7125477",
"0.71241647",
"0.71241647",
"0.712... | 0.77369505 | 3 |
return number of comments on a post | def num_comments
self.comments.count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comment_count\n comments.length\n end",
"def number_of_comments\n\t \tcomments.count\n\t end",
"def number_comments \n self.comments.count\n end",
"def count_of_comment\n Comment.number_of_comment(self)\n end",
"def comments_count\n self.comments.count\n end",
"def comments_... | [
"0.8252414",
"0.81067806",
"0.7910759",
"0.7885333",
"0.7877095",
"0.7682957",
"0.76399636",
"0.76399636",
"0.74591094",
"0.7379139",
"0.735235",
"0.7327981",
"0.7278845",
"0.71774405",
"0.7101983",
"0.70946205",
"0.7089872",
"0.7039299",
"0.7029295",
"0.6955377",
"0.69373465... | 0.8042726 | 2 |
return when a post was faved | def faved_date(user)
if self.is_fav?(user)
Fav.find_by(post_id: self.id).create_date
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fave?(post)\n self.faves.find_by_post_id(post.id)\n end",
"def fave!(post)\n self.faves.create!(post_id: post.id)\n end",
"def save #always post\n #TODO: don't let people overwrite others' posts by changing the URL\n @post ||= generate_post(@user, {\n :paint_time=>0, \n :in_... | [
"0.7078461",
"0.696548",
"0.6358954",
"0.6211392",
"0.62011486",
"0.6178651",
"0.613961",
"0.6131836",
"0.61069036",
"0.6105776",
"0.60660344",
"0.6064586",
"0.6049372",
"0.6049372",
"0.60204625",
"0.59913677",
"0.5982714",
"0.59641325",
"0.595269",
"0.58991647",
"0.5879407",... | 0.6331066 | 3 |
Maps the model and produces a corresponding output. | def map
raise 'subclass must implement to return a value', NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_to_model(ot)\n merge(ot)\n self\n end",
"def output\n MappedRecord.new(self.to_hash)\n end",
"def map\n \n # parse source data \n @source_record = parse_input\n\n # validate the source record\n return Hash.new if !source_valid?\n\n # create... | [
"0.6257991",
"0.59143853",
"0.58511215",
"0.5827301",
"0.5717518",
"0.56972396",
"0.5693417",
"0.5691793",
"0.56798387",
"0.56396496",
"0.56052315",
"0.55510205",
"0.5517984",
"0.5472049",
"0.5428505",
"0.5408416",
"0.5408416",
"0.5351632",
"0.5351632",
"0.53193",
"0.53180397... | 0.0 | -1 |
characterizes the file_set passed into this service Default options are: save: true | def characterize(save: true)
unzip_original_file if zip_file?
new_file = original_file.new(file_characterization_attributes.to_h)
@file_set.file_metadata = @file_set.file_metadata.select { |x| x.id != new_file.id } + [new_file]
@file_set = @persister.save(resource: @file_set) if save
clean_up_zip_di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def characterize(save: true)\n TikaFileCharacterizationService.new(file_set: file_set, persister: persister).characterize\n end",
"def characterize(save: true)\n [:original_file, :intermediate_file, :preservation_file].each do |type|\n @target_file = @file_set.try(type)\n next unless @target_fil... | [
"0.7810337",
"0.7669975",
"0.75611305",
"0.74711883",
"0.70036656",
"0.62600434",
"0.62492436",
"0.62108284",
"0.6209448",
"0.6162707",
"0.60981387",
"0.6041992",
"0.5961001",
"0.56767654",
"0.5596409",
"0.5287256",
"0.5240678",
"0.51438457",
"0.51251787",
"0.50941527",
"0.50... | 0.710813 | 4 |
Path to the dataset. The path points to a directory for file formats that are saved as zip files. The path points to the original file for formats that are not saved as zip files. | def dataset_path
@dataset_path ||= filename
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_path(path)\n return File.expand_path(File.join(@@config['dataPath'], path))\n end",
"def com_dataset_file_path\n \"#{@tmp_dir}/#{@province.code}-8.geojson\"\n end",
"def data_file!(path)\n path = Pathname.new(path)\n if relative_data_files.include?(path)\n data_dir/path\n ... | [
"0.74198115",
"0.69077337",
"0.6823959",
"0.6593147",
"0.6497813",
"0.64443964",
"0.64398724",
"0.64052814",
"0.64052814",
"0.6334445",
"0.63330567",
"0.6174578",
"0.6172243",
"0.61415076",
"0.6126401",
"0.6049162",
"0.60376334",
"0.6021472",
"0.60146207",
"0.6010367",
"0.599... | 0.69346774 | 1 |
Determines the location of the file on disk for the file_set | def filename
return Pathname.new(file_object.io.path) if file_object.io.respond_to?(:path) && File.exist?(file_object.io.path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_location(options={})\n self.class.file_location(options)\n end",
"def fileset_download_path(fileset, opts = {})\n download_path(fileset.id, fileset.file_metadata.first.id, opts)\n end",
"def file_set\n @file_set ||= resource_decorator.geo_members&.first\n end",
"def find_orig... | [
"0.6664266",
"0.63895315",
"0.6382981",
"0.6378814",
"0.62515116",
"0.62491596",
"0.6192602",
"0.6156177",
"0.61422765",
"0.6122011",
"0.61171055",
"0.61164904",
"0.6039684",
"0.59989655",
"0.5968189",
"0.5933916",
"0.5932832",
"0.5923915",
"0.592019",
"0.5915292",
"0.5889873... | 0.0 | -1 |
Provides the file attached to the file_set | def file_object
@file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file\n return @file\n end",
"def file\n return @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n files.first\n end",
"def fil... | [
"0.7509791",
"0.7509791",
"0.7491785",
"0.7491785",
"0.7491785",
"0.7491785",
"0.7483948",
"0.7483948",
"0.7482117",
"0.7464276",
"0.72877234",
"0.72877234",
"0.7251363",
"0.70694196",
"0.7058848",
"0.70025235",
"0.7001671",
"0.6995098",
"0.6980568",
"0.6899519",
"0.688326",
... | 0.6499236 | 46 |
Gets a file's 'geo mime type' by looking up the format's driver in a controlled vocabulary. If the driver is not found, the original mime_type is returned. | def mime_type
term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }
term ? term.value : original_file.mime_type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : primary_file.mime_type\n end",
"def geo_mime_type\n return unless file_set\n file_set.mime_type.first\n end",
"def geo_mime_type\n return if ... | [
"0.79029524",
"0.74853265",
"0.7385808",
"0.7243917",
"0.7104706",
"0.69545543",
"0.693114",
"0.6763933",
"0.6731218",
"0.6703547",
"0.66408557",
"0.6635211",
"0.6609531",
"0.66063154",
"0.6583841",
"0.6582962",
"0.6581435",
"0.65786475",
"0.6578028",
"0.65685034",
"0.6553312... | 0.77780586 | 1 |
Uncompresses a zipped file and sets dataset_path variable to the resulting directory. | def unzip_original_file
system "unzip -qq -o -j #{filename} -d #{zip_file_directory}" unless File.directory?(zip_file_directory)
@dataset_path = zip_file_directory
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unzip_original_file\n system %(unzip -qq -o -j \"#{filename}\" -d #{zip_file_directory}) unless File.directory?(zip_file_directory)\n @dataset_path = zip_file_directory\n end",
"def unzip_package(zip_file)\n @log.info 'Unzipping ' + zip_file\n\n unless File.exist?(zip_file)\n @log.error zip_file ... | [
"0.7832313",
"0.6556571",
"0.6467353",
"0.6394386",
"0.6313615",
"0.6299965",
"0.6230267",
"0.6229006",
"0.62157565",
"0.60566646",
"0.5981744",
"0.5959067",
"0.5943539",
"0.59387046",
"0.5934511",
"0.5906173",
"0.589568",
"0.5895675",
"0.5849852",
"0.5844543",
"0.5827287",
... | 0.78495604 | 0 |
Tests if original file is a zip file | def zip_file?
@zip_file ||= original_file.mime_type == ["application/zip"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zip_file?\n @target_file.mime_type == [\"application/zip\"]\n end",
"def zip?\n parser_fields&.[]('import_file_path') && MIME::Types.type_for(parser_fields['import_file_path']).include?('application/zip')\n end",
"def zip?\n begin\n ::Zip::File.open input.path\n true\n rescue ::... | [
"0.837596",
"0.7992786",
"0.77132195",
"0.7670621",
"0.70248634",
"0.6661971",
"0.6584291",
"0.64963734",
"0.6385379",
"0.63271827",
"0.62716544",
"0.62050706",
"0.62036896",
"0.6193972",
"0.61675125",
"0.61288536",
"0.6127366",
"0.604483",
"0.60440767",
"0.6027535",
"0.60245... | 0.8646797 | 0 |
Path to directory in which to extract zip file | def zip_file_directory
"#{File.dirname(filename)}/#{File.basename(filename, '.zip')}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_zipfile_path\n Pathname.new(output_final_directory_path).dirname.to_s + '/' + zip_filename\n end",
"def zip_file_directory\n # Get the base file name and remove problematic parens\n basename = File.basename(filename, \".zip\").delete(\"(\").delete(\")\")\n \"#{File.dirname(filename)}/#{ba... | [
"0.8170722",
"0.7859215",
"0.7583757",
"0.75429595",
"0.7270947",
"0.6997568",
"0.6857483",
"0.66793156",
"0.6674835",
"0.6581761",
"0.6558289",
"0.6530374",
"0.65109676",
"0.6490205",
"0.6485061",
"0.6475193",
"0.6461047",
"0.6417612",
"0.64066",
"0.6371356",
"0.6338679",
... | 0.8202472 | 0 |
Attributes to apply to the file node | def file_characterization_attributes
{
mime_type: mime_type
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def internal_file_attributes; end",
"def external_file_attributes; end",
"def internal_file_attributes=(_arg0); end",
"def file_attributes\n {}\n end",
"def file_attributes\n {}\n end",
"def add_doc_specific_attributes(filepath, is_src, attributes); end",
"def external_f... | [
"0.7694681",
"0.74246484",
"0.737052",
"0.7351086",
"0.7351086",
"0.71561277",
"0.71081495",
"0.7082288",
"0.7082288",
"0.67303324",
"0.6623502",
"0.6270999",
"0.60629386",
"0.6045103",
"0.6038286",
"0.5921153",
"0.5918912",
"0.5918912",
"0.58906996",
"0.5853532",
"0.5831801"... | 0.62132293 | 12 |
Service that provides information about a raster dataset | def info_service
@info_service ||= GeoWorks::Derivatives::Processors::Raster::Info.new(dataset_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info_service\n GeoDerivatives::Processors::Raster::Info.new(@dataset_path)\n end",
"def info_service\n GeoDerivatives::Processors::Vector::Info.new(@dataset_path)\n end",
"def metadata\n DatasetService.get_metadata dataset_id\n end",
"def info_service\n @info_service ||= GeoWorks... | [
"0.78696966",
"0.6418473",
"0.5896756",
"0.57840884",
"0.56626165",
"0.5422141",
"0.5369086",
"0.53486836",
"0.52943635",
"0.52943635",
"0.52943635",
"0.52504057",
"0.5225154",
"0.52084947",
"0.5154588",
"0.5142185",
"0.5141378",
"0.51247495",
"0.5081253",
"0.5066027",
"0.504... | 0.7102218 | 1 |
Attributes to apply to the file node | def file_characterization_attributes
{
geometry: info_service.geom,
mime_type: mime_type
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def internal_file_attributes; end",
"def external_file_attributes; end",
"def internal_file_attributes=(_arg0); end",
"def file_attributes\n {}\n end",
"def file_attributes\n {}\n end",
"def add_doc_specific_attributes(filepath, is_src, attributes); end",
"def external_f... | [
"0.7694681",
"0.74246484",
"0.737052",
"0.7351086",
"0.7351086",
"0.71561277",
"0.71081495",
"0.7082288",
"0.7082288",
"0.67303324",
"0.6623502",
"0.6270999",
"0.62132293",
"0.60629386",
"0.6045103",
"0.6038286",
"0.5921153",
"0.58906996",
"0.5853532",
"0.5831801",
"0.5831801... | 0.5918912 | 18 |
Service that provides information about a vector dataset | def info_service
@info_service ||= GeoWorks::Derivatives::Processors::Vector::Info.new(dataset_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info_service\n GeoDerivatives::Processors::Vector::Info.new(@dataset_path)\n end",
"def inspect\n \"<Vector #{object_id} : dim = #{@dim} values = #{@vector}>\"\n end",
"def metadata\n DatasetService.get_metadata dataset_id\n end",
"def info_service\n GeoDerivatives::Processors::R... | [
"0.7485638",
"0.60616034",
"0.5991658",
"0.5969776",
"0.5780633",
"0.57308644",
"0.56456274",
"0.5616348",
"0.5596034",
"0.55924183",
"0.55432653",
"0.5531176",
"0.5497517",
"0.54863626",
"0.5485565",
"0.5484635",
"0.54545593",
"0.54545593",
"0.54545593",
"0.54518163",
"0.544... | 0.6621004 | 1 |
GET /clothing_types GET /clothing_types.json | def index
@clothing_types = ClothingType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cloth_types = ClothType.all\n end",
"def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def index\n @thing_types = ThingType.all\n end",
"def show\n @type... | [
"0.70642656",
"0.7027218",
"0.6997094",
"0.6672735",
"0.66132736",
"0.66014564",
"0.6505474",
"0.6468698",
"0.63808423",
"0.63202006",
"0.6308912",
"0.6285922",
"0.6278189",
"0.62206423",
"0.6144221",
"0.6140485",
"0.6123922",
"0.61126137",
"0.61112255",
"0.61107725",
"0.6109... | 0.73588574 | 0 |
GET /clothing_types/1 GET /clothing_types/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @clothing_types = ClothingType.all\n end",
"def show\n @type = Type.find(params[:id])\n @things = @type.things\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type }\n end\n end",
"def index\n @cloth_types = ClothType.all\n end",... | [
"0.7121874",
"0.6982048",
"0.6806908",
"0.6798231",
"0.65696514",
"0.64863837",
"0.642877",
"0.63273156",
"0.61915356",
"0.61869097",
"0.61211514",
"0.612019",
"0.6099007",
"0.6094248",
"0.6072369",
"0.6071808",
"0.606753",
"0.6066789",
"0.6061196",
"0.6054044",
"0.60429764",... | 0.0 | -1 |
POST /clothing_types POST /clothing_types.json | def create
@clothing_type = ClothingType.new(clothing_type_params)
respond_to do |format|
if @clothing_type.save
format.html { redirect_to @clothing_type, notice: 'Clothing type was successfully created.' }
format.json { render :show, status: :created, location: @clothing_type }
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clothing_type_params\n params.require(:clothing_type).permit(:name)\n end",
"def create\n @thing_type = ThingType.new(thing_type_params)\n\n respond_to do |format|\n if @thing_type.save\n format.html { redirect_to @thing_type, notice: 'Thing type was successfully created.' }\n ... | [
"0.6938193",
"0.6623524",
"0.657161",
"0.65166533",
"0.64354146",
"0.6347525",
"0.6198048",
"0.61233634",
"0.6100035",
"0.6085468",
"0.60600364",
"0.6036329",
"0.5986902",
"0.5967095",
"0.5925536",
"0.59198445",
"0.5916416",
"0.5903897",
"0.58836997",
"0.587639",
"0.5831898",... | 0.70167 | 0 |
PATCH/PUT /clothing_types/1 PATCH/PUT /clothing_types/1.json | def update
respond_to do |format|
if @clothing_type.update(clothing_type_params)
format.html { redirect_to @clothing_type, notice: 'Clothing type was successfully updated.' }
format.json { render :show, status: :ok, location: @clothing_type }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @thing_type.update(thing_type_params)\n format.html { redirect_to @thing_type, notice: 'Thing type was successfully updated.' }\n format.json { render :show, status: :ok, location: @thing_type }\n else\n format.html { render :edit }\n ... | [
"0.68707484",
"0.6705496",
"0.64052624",
"0.63278955",
"0.63267475",
"0.6291772",
"0.6291403",
"0.6138089",
"0.6135121",
"0.606297",
"0.6053189",
"0.60364556",
"0.6021643",
"0.6018961",
"0.6011001",
"0.598943",
"0.5961755",
"0.5938475",
"0.5932852",
"0.59265625",
"0.5913644",... | 0.7212358 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.