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 |
|---|---|---|---|---|---|---|
Variant of join that matches the native CFN syntax. | def join_list(delim, list) { :'Fn::Join' => [ delim, list ] } end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join(separator = T.unsafe(nil)); end",
"def join(input, glue = T.unsafe(nil)); end",
"def safe_join(array, sep = T.unsafe(nil)); end",
"def join(*rest) end",
"def fn_join(separator, lines)\n {\n \"Fn::Join\" => [\n separator, lines\n ]\n }\n end",
"def join(*) end"... | [
"0.74079114",
"0.72608316",
"0.7009137",
"0.69258386",
"0.6808972",
"0.68065315",
"0.67462856",
"0.66812664",
"0.65974003",
"0.65858924",
"0.6553574",
"0.65027755",
"0.65022755",
"0.6454494",
"0.6386242",
"0.63283026",
"0.62973225",
"0.62739456",
"0.624097",
"0.62259954",
"0.... | 0.6486517 | 13 |
deprecated, for backward compatibility | def no_value()
warn_deprecated('no_value()', 'aws_no_value()')
aws_no_value()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def private_method\n end",
"def deprecated_key=(_arg0); end",
"def internal; end",
"def custom; end",
"def custom; end",
"def refutal()\n end",
"def extra; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def raise_deprecations; ... | [
"0.7727115",
"0.6584592",
"0.6545251",
"0.65368354",
"0.6475306",
"0.6475306",
"0.64053524",
"0.6340444",
"0.6340188",
"0.6340188",
"0.6340188",
"0.6340188",
"0.6320009",
"0.6272062",
"0.62613577",
"0.6156687",
"0.6149567",
"0.6105834",
"0.6077154",
"0.60624367",
"0.6042197",... | 0.0 | -1 |
Read the specified file and return its value as a string literal | def file(filename) File.read(File.absolute_path(filename, File.dirname($PROGRAM_NAME))) end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_string_from_file(filename)\n File.open(filename, \"rb\") do |f|\n return f.read\n end\nend",
"def get_file_as_string(filename)\n data = ''\n\n File.open(filename, \"r\") { |f|\n data = f.read\n }\n \n return data\nend",
"def get_file_as_string(filename)\n data = ''\n f = File.o... | [
"0.7949392",
"0.7447994",
"0.7242557",
"0.7236779",
"0.7225098",
"0.71421325",
"0.71199423",
"0.7043029",
"0.6868293",
"0.68633693",
"0.68163925",
"0.68117195",
"0.67981225",
"0.6789452",
"0.6780929",
"0.6746901",
"0.66504884",
"0.66472965",
"0.66323423",
"0.6609966",
"0.6587... | 0.6573174 | 26 |
Collect base job data | def initialize(dflow_api:, treenode_id:, copyright:, columns:, row:)
@dflow_api = dflow_api
@treenode_id = treenode_id
@copyright = copyright
fixed_row = row.map do |val|
if val.is_a? Float
val.to_i.to_s
else
val
end
end
@file_data = Hash[c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_new_jobs\n raise NotImplementedError\n end",
"def collect_joblist(data_path,script_path)\n \n # define list of ignored files/dirs\n to_ignore = ['.','..','.DS_Store']\n \n res = []\n \n # open dir\n directory=Dir.open(data_path)\n \n ... | [
"0.65410084",
"0.6514092",
"0.6364172",
"0.6269818",
"0.62418526",
"0.6234954",
"0.61828107",
"0.6148867",
"0.5999805",
"0.5991655",
"0.59138614",
"0.58892757",
"0.5885048",
"0.5878118",
"0.5859627",
"0.5846254",
"0.58459824",
"0.58123064",
"0.5756786",
"0.5721944",
"0.570752... | 0.0 | -1 |
Generate a complete job data before created | def generate_full_data
return @job_data if @full_data_generated
@job_data["name"] = @name if @name
@job_data["metadata"] ||= {}
@job_data["metadata"].merge!(@file_data)
@job_data["source"] = @job_data["source_name"].dup
@job_data.delete("source_name")
@full_data_generated = tru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_dc_job_data\n @job_data[\"name\"] = @name if @name\n @row_hash[\"source\"] = @row_hash[\"dc_source\"]\n @row_hash.delete(\"dc_source\")\n @job_data = @source.fetch_source_data(nil, @row_hash)\n end",
"def generate_job\n if Backdat::Config[:json].empty?\n Backdat::Confi... | [
"0.6945282",
"0.6672054",
"0.64193654",
"0.6387489",
"0.6350692",
"0.6283273",
"0.62153023",
"0.61839145",
"0.61747706",
"0.61483204",
"0.6115674",
"0.6094607",
"0.60712296",
"0.603993",
"0.60308844",
"0.5998643",
"0.59979707",
"0.5987966",
"0.5984896",
"0.59670854",
"0.59615... | 0.74403036 | 0 |
Actually create job in dFlow | def create(validate_only: false)
job = generate_full_data
job["treenode_id"] = @treenode_id
job["copyright"] = @copyright
params = {}
params[:validate_only] = true if validate_only
@dflow_api.create_job(job: job, params: params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_job(params = {})\n Bitmovin::Job.create(params)\n end",
"def create_job(options = {})\n Job.create({:title => \"Another Dummy Job\", :description => \"This is just another dummy job\"}.merge(options))\n end",
"def create_job(job:, params: {})\n response = HTTParty.post(\"#{@host}/api... | [
"0.72429556",
"0.6981046",
"0.69755787",
"0.696967",
"0.6964872",
"0.68603945",
"0.67842567",
"0.6773829",
"0.6746426",
"0.6741604",
"0.66750777",
"0.6593276",
"0.65782386",
"0.6505978",
"0.64807826",
"0.6466952",
"0.6463815",
"0.64531785",
"0.6449622",
"0.64221483",
"0.64204... | 0.7261892 | 0 |
Check with dFlow if job would be valid to create or not. Return error if not valid. | def invalid?
response = create(validate_only: true)
return response['error'] if response['error']
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @job = Job.new(job_params)\n if @job.save\n redirect_to jobs_path\n else\n puts @job.errors.full_messages\n redirect_to new_job_path, :notice => \"Please ensure that your Job name is unique and at least 4 characters long. Also, job prices must be at least $1,000, the number of... | [
"0.66602904",
"0.65733105",
"0.6186442",
"0.61615044",
"0.6104487",
"0.59972423",
"0.59560204",
"0.5941555",
"0.5935399",
"0.58890593",
"0.5880856",
"0.5876075",
"0.58755314",
"0.58546716",
"0.58155936",
"0.58155465",
"0.57931674",
"0.57824606",
"0.57356215",
"0.5706816",
"0.... | 0.58918136 | 9 |
GET /salary_heads GET /salary_heads.json | def index
@salary_heads = SalaryHead.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @salary_slips = SalarySlip.where(:employee_detail_id => current_user.id)\n #@salary_slips = SalarySlip.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @salary_slips }\n end\n end",
"def index\n @worker_salaries = WorkerSalary.pagina... | [
"0.6232838",
"0.6219984",
"0.6217483",
"0.6080055",
"0.60787827",
"0.59604716",
"0.5955176",
"0.5954713",
"0.5908468",
"0.5872632",
"0.5856257",
"0.58093536",
"0.57831585",
"0.57233673",
"0.5712256",
"0.5698152",
"0.56864303",
"0.56801826",
"0.56785136",
"0.5671236",
"0.56393... | 0.72083807 | 0 |
GET /salary_heads/1 GET /salary_heads/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @salary_heads = SalaryHead.all\n end",
"def show\n @salary = Salary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @salary }\n end\n end",
"def set_salary_head\n @salary_head = SalaryHead.find(params[:id])\n en... | [
"0.6862195",
"0.6454197",
"0.6339935",
"0.6155893",
"0.6107599",
"0.6018362",
"0.5996773",
"0.5956794",
"0.5876968",
"0.58543193",
"0.5722031",
"0.56691074",
"0.5668395",
"0.56560606",
"0.5635643",
"0.5562446",
"0.5558137",
"0.5543318",
"0.55411154",
"0.5534796",
"0.55322224"... | 0.0 | -1 |
POST /salary_heads POST /salary_heads.json | def create
@salary_head = SalaryHead.new(salary_head_params)
respond_to do |format|
if @salary_head.save
format.html { redirect_to @salary_head, notice: 'Salary head was successfully created.' }
format.json { render :show, status: :created, location: @salary_head }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @salary_allotment = SalaryAllotment.new(salary_allotment_params)\n @salary_allotment.salary_head_hash = params[:salary_allotment][:salary_head_hash]\n\n\n respond_to do |format|\n if @salary_allotment.save\n format.html { redirect_to @salary_allotment, notice: 'Salary allotment wa... | [
"0.66329163",
"0.6527387",
"0.63504875",
"0.6001452",
"0.59549457",
"0.5869756",
"0.58695877",
"0.5799344",
"0.5723417",
"0.5688264",
"0.5684817",
"0.56414",
"0.5605518",
"0.5586332",
"0.5584665",
"0.55800915",
"0.5549986",
"0.5538419",
"0.5523076",
"0.5510993",
"0.5483272",
... | 0.6897621 | 0 |
PATCH/PUT /salary_heads/1 PATCH/PUT /salary_heads/1.json | def update
respond_to do |format|
if @salary_head.update(salary_head_params)
format.html { redirect_to @salary_head, notice: 'Salary head was successfully updated.' }
format.json { render :show, status: :ok, location: @salary_head }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @salary_allotment.update(salary_allotment_params)\n @salary_allotment.salary_head_hash = params[:salary_allotment][:salary_head_hash]\n format.html { redirect_to @salary_allotment, notice: 'Salary allotment was successfully updated.' }\n format.... | [
"0.65659386",
"0.63672984",
"0.6171686",
"0.6157062",
"0.6111571",
"0.6110595",
"0.60324275",
"0.6025655",
"0.60188854",
"0.6014169",
"0.59960115",
"0.5969341",
"0.59620935",
"0.5961331",
"0.5934579",
"0.592412",
"0.58819515",
"0.5868102",
"0.586252",
"0.58383524",
"0.5821463... | 0.7004507 | 0 |
DELETE /salary_heads/1 DELETE /salary_heads/1.json | def destroy
@salary_head.destroy
respond_to do |format|
format.html { redirect_to salary_heads_url, notice: 'Salary head was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @salary = Salary.find(params[:id])\n @salary.destroy\n\n respond_to do |format|\n format.html { redirect_to salaries_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
... | [
"0.6788037",
"0.66127604",
"0.64723754",
"0.6416538",
"0.64074165",
"0.63585585",
"0.63468665",
"0.6339041",
"0.633646",
"0.63305026",
"0.62114674",
"0.6206646",
"0.61926794",
"0.6177939",
"0.6174635",
"0.6160293",
"0.61595196",
"0.6153152",
"0.615232",
"0.6147873",
"0.614747... | 0.70789725 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_salary_head
@salary_head = SalaryHead.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.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def salary_head_params
params.require(:salary_head).permit(:salaryname, :earnings, :deduction)
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 |
Created 09/06/2019 by David Wing Edited 09/07/2019 by David Wing Edited 09/08/2019 by David Wing Edited 09/09/2019 by Sri Ramya Dandu: changed cardsShowing to a global variable Edited 09/12/2019 by David Wing: Optimized table searching Edited 09/16/2019 by Sri Ramya Dandu: replaced for loops with ruby convention Given ... | def valid_table(cards_showing)
# make hash of all table cards
# id is the key, location is the value
table_hash = Hash.new
return [] if cards_showing.length < 1
(0...cards_showing.length).each {|i| table_hash[cards_showing[i].id] = i}
(0...cards_showing.length).each do |card1|
(1...car... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_a_set?(cards)\n result = [false, 0]\n (0..(NB_CARAC-1)).inject(true) do |result[0], carac|\n nb_uniq = cards.map{|card|CARDS[card][carac]}.uniq.size\n result[1] += (nb_uniq == NB_ETAT ? 1 : 0)\n result[0] &&= nb_uniq == 1 || nb_uniq == NB_ETAT\n end\n result\n end",
"def valid_... | [
"0.6730271",
"0.67143947",
"0.66970384",
"0.64075154",
"0.6298123",
"0.62791747",
"0.62781626",
"0.62218785",
"0.6182628",
"0.6156735",
"0.61516786",
"0.61082536",
"0.61038834",
"0.60701627",
"0.60696757",
"0.6068585",
"0.60676813",
"0.6054866",
"0.60526985",
"0.6029316",
"0.... | 0.7523868 | 0 |
Creates instance of the application plan resource manager | def initialize(http_client, app_plan = nil, metric: nil)
super(http_client, entity_name: 'limit', collection_name: 'limits')
@service = app_plan.service
@application_plan = app_plan
@metric = metric
@resource_instance = ApplicationPlanLimit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def application_plans\n manager_instance(ApplicationPlanManager)\n end",
"def service_plans\n manager_instance(ServicePlanManager)\n end",
"def get_resource\n\t\t\tlogger.debug {\"ALLOCATING NEW RESOURCE --> #{ ActiveOrient.db_pool.size }\" }\n login = [ActiveOrient.default_server[... | [
"0.62986773",
"0.57335633",
"0.56076205",
"0.55880517",
"0.54311657",
"0.53971916",
"0.5336882",
"0.5336882",
"0.53138244",
"0.53119665",
"0.5301755",
"0.5252183",
"0.5230076",
"0.52292365",
"0.5192473",
"0.5180293",
"0.5166",
"0.5155371",
"0.51497453",
"0.5123586",
"0.511487... | 0.5037398 | 31 |
Base path for the REST call | def base_path
super.concat "/application_plans/#{application_plan['id']}/metrics/#{metric['id']}/limits"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_path\n \"/api/v1\"\n end",
"def basepath; end",
"def base_path\n super.concat '/services'\n end",
"def path\n @base\n end",
"def api_path(path)\n \"#{options[:base_path]}/#{path}\" || \"/#{path}\"\n end",
"def base_uri\n\t\t\t\"#{server}/api/v4\"\n\t\tend"... | [
"0.8309447",
"0.74877745",
"0.744401",
"0.7418756",
"0.73570424",
"0.7343453",
"0.73245466",
"0.7320147",
"0.72025347",
"0.71659255",
"0.7146667",
"0.7121914",
"0.71125436",
"0.7082526",
"0.7050298",
"0.7032062",
"0.70231164",
"0.7004639",
"0.69764245",
"0.69477445",
"0.69424... | 0.0 | -1 |
Binds metric to Application plan limit | def set_metric(metric)
@metric = metric
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call\n result[:limits] = plan.limits.map do |limit|\n limit.tap { |l| l['metric'] = metric_info(l, 'Limit') }\n end\n end",
"def application_plan_limits(app_plan)\n ApplicationPlanLimitManager.new(@http_client, app_plan, metric: self)\n end",
"def app... | [
"0.7276973",
"0.722923",
"0.722923",
"0.65283096",
"0.64093196",
"0.64093196",
"0.63445866",
"0.6303952",
"0.6264503",
"0.621565",
"0.62140775",
"0.61676383",
"0.6122303",
"0.6091755",
"0.60578924",
"0.6038749",
"0.6033014",
"0.6031056",
"0.60293174",
"0.601114",
"0.6001717",... | 0.0 | -1 |
Construct an application plan limit resource | def initialize(client, manager, entity)
super(client, manager, entity)
@service = manager.service
@metric = manager.metric
@application_plan = manager.application_plan
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_limits; end",
"def resource_limits; end",
"def application_plan_limits(app_plan)\n ApplicationPlanLimitManager.new(@http_client, app_plan, metric: self)\n end",
"def application_plan_limits(app_plan)\n ApplicationPlanLimitManager.new(@http_client, app_plan, metric: self)\n ... | [
"0.7047363",
"0.7047363",
"0.69795644",
"0.69795644",
"0.6666787",
"0.64372617",
"0.61466664",
"0.60517544",
"0.60482657",
"0.59945947",
"0.5948633",
"0.59338707",
"0.58600277",
"0.5858434",
"0.58233684",
"0.573822",
"0.5721906",
"0.5671225",
"0.5641668",
"0.5637451",
"0.5619... | 0.0 | -1 |
Should merge this into LastSeen, but will test it here Get just the ping records for the hosts with a specific ping time | def cache_online(mysql_conf:, ping_time:)
query = <<~SQL
SELECT hostname FROM lastping WHERE ping_time = '#{ping_time}'
SQL
online = {}
WIKK::SQL.connect(mysql_conf) do |sql|
sql.each_hash(query) do |row|
online[row['hostname']] = true
end
end
return online
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ping\n self.last_ping = Time.now\n end",
"def ping(t)\n while !@timestamps.empty? && @timestamps.first < t - 3000\n @timestamps.shift\n end\n @timestamps << t\n @timestamps.size\n end",
"def pinger\n binding.pry\n @livehosts = []\n @ips_to_check.each do |ip|\n if(ip.... | [
"0.6405045",
"0.6186173",
"0.57383823",
"0.570747",
"0.56221",
"0.55856776",
"0.557364",
"0.55569845",
"0.5556884",
"0.55564904",
"0.55459386",
"0.5508718",
"0.54470056",
"0.5444338",
"0.5433056",
"0.54277754",
"0.54263663",
"0.54084754",
"0.54039776",
"0.53988254",
"0.537265... | 0.62274927 | 1 |
If API token changes change variable's name | def set_token
@token = ENV["TYPEFORM_API_TOKEN"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_current_user_api(api)\n #const_set('SDK_API', api)\n $SDK_API = api\nend",
"def set_token\n self.token = Digest::SHA2.hexdigest \"#{username}-#{lastvisitDate.to_i}\" if self.token.blank?\n end",
"def api_token\n if @yaml[\"deployment\"][\"api_token\"] != \"example\"\n @yaml[\"depl... | [
"0.63318235",
"0.6311341",
"0.6190614",
"0.61663926",
"0.6115254",
"0.6056588",
"0.6030384",
"0.60015184",
"0.5992754",
"0.59868807",
"0.597033",
"0.59610915",
"0.5943649",
"0.5924564",
"0.5906375",
"0.59004545",
"0.5898411",
"0.5898411",
"0.5898411",
"0.5885533",
"0.58811",
... | 0.60789406 | 5 |
"Hi, Are you having fun?" arr of strings | def process_text arr
puts arr.map { |s| s.strip }.join(" ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_array\n @phrase_string.downcase.split(WORD_SPLIT).reject(&:empty?)\n end",
"def awesomesauced(strings)\n index = 0\n awesomesauced_array = []\n\n while index < strings.length\n awesomesauced_array << strings[index]\n if index != strings.length - 1\n awesomesauced_array << \"awesomesauce... | [
"0.6600978",
"0.65453535",
"0.64341545",
"0.6385024",
"0.6343417",
"0.63412285",
"0.621448",
"0.62002134",
"0.6189659",
"0.6182448",
"0.61054355",
"0.6102072",
"0.6098961",
"0.60908276",
"0.60859936",
"0.6078846",
"0.60730344",
"0.6072397",
"0.60522014",
"0.6048987",
"0.60353... | 0.5799679 | 49 |
The process that runs when this command is used in battle. Override this function for subclasses. | def run(user, enemy)
print "Nothing happens.\n\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process\n return @args[:process]\n end",
"def process\n self\n end",
"def process_id\n return @process_id\n end",
"def initialize(process)\n self.process = process\n end",
"def process\n @process ||= Bumbleworks::Process.new(@fei.wfid)\n end",
... | [
"0.73377097",
"0.68746614",
"0.65873647",
"0.649368",
"0.6486828",
"0.6450103",
"0.6433817",
"0.64180684",
"0.6398114",
"0.63752663",
"0.6303401",
"0.6281708",
"0.6213658",
"0.6202873",
"0.62025756",
"0.6200518",
"0.6175934",
"0.6142473",
"0.6134848",
"0.6131784",
"0.61314446... | 0.0 | -1 |
GET /post125s/1 GET /post125s/1.xml | def show
@post125 = Post125.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @post125 }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @post75 = Post75.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post75 }\n end\n end",
"def show\n @post150 = Post150.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml ... | [
"0.6460782",
"0.6390966",
"0.6336833",
"0.632767",
"0.6319558",
"0.6307991",
"0.63047576",
"0.6290415",
"0.6274426",
"0.6274382",
"0.6271078",
"0.6269637",
"0.6255178",
"0.62440515",
"0.6243412",
"0.6236876",
"0.62326247",
"0.6228564",
"0.6225476",
"0.62235284",
"0.6213398",
... | 0.6613181 | 0 |
GET /post125s/new GET /post125s/new.xml | def new
@post125 = Post125.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @post125 }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @post75 = Post75.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post75 }\n end\n end",
"def new\n @post150 = Post150.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post150 }\n ... | [
"0.75601786",
"0.75296754",
"0.7511047",
"0.75104654",
"0.7504779",
"0.74931896",
"0.74792343",
"0.74777013",
"0.74694586",
"0.74511194",
"0.7450107",
"0.7449536",
"0.74475855",
"0.7424835",
"0.7422489",
"0.74210614",
"0.74176395",
"0.7409099",
"0.740744",
"0.74061006",
"0.74... | 0.7692271 | 0 |
POST /post125s POST /post125s.xml | def create
@post125 = Post125.new(params[:post125])
respond_to do |format|
if @post125.save
format.html { redirect_to(@post125, :notice => 'Post125 was successfully created.') }
format.xml { render :xml => @post125, :status => :created, :location => @post125 }
else
format.h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"d... | [
"0.6321378",
"0.6260651",
"0.60596323",
"0.59499353",
"0.59428287",
"0.592711",
"0.59229535",
"0.5892806",
"0.5888302",
"0.58499205",
"0.58339244",
"0.5785387",
"0.57849264",
"0.57635295",
"0.57620215",
"0.57609683",
"0.57397705",
"0.5726083",
"0.57116795",
"0.5709964",
"0.57... | 0.6195227 | 2 |
PUT /post125s/1 PUT /post125s/1.xml | def update
@post125 = Post125.find(params[:id])
respond_to do |format|
if @post125.update_attributes(params[:post125])
format.html { redirect_to(@post125, :notice => 'Post125 was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def res... | [
"0.6730009",
"0.6466401",
"0.61685497",
"0.59518224",
"0.58876514",
"0.5798805",
"0.5784773",
"0.57591265",
"0.57456374",
"0.5736031",
"0.57291424",
"0.57271546",
"0.5714285",
"0.5688205",
"0.5678177",
"0.56523347",
"0.5640963",
"0.5633387",
"0.5629885",
"0.56241053",
"0.5606... | 0.613109 | 3 |
DELETE /post125s/1 DELETE /post125s/1.xml | def destroy
@post125 = Post125.find(params[:id])
@post125.destroy
respond_to do |format|
format.html { redirect_to(post125s_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @post150 = Post150.find(params[:id])\n @post150.destroy\n\n respond_to do |format|\n format.html { redirect_to(post150s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post445 = Post445.find(params[:id])\n @post445.destroy\n\n respond_to do |format|\n... | [
"0.6960687",
"0.69151896",
"0.69034255",
"0.68992335",
"0.6897706",
"0.6896016",
"0.6878025",
"0.68750125",
"0.68557984",
"0.68462867",
"0.68388075",
"0.68387145",
"0.68156856",
"0.68080366",
"0.67900604",
"0.6757599",
"0.6754943",
"0.6740431",
"0.67401177",
"0.6735021",
"0.6... | 0.7052096 | 0 |
Doesn't use fake frozen time, since we want to test record time | def test_format_strftime_record
d = create_driver %[
tag #{@tag}
key #{@key}
format %d/%b/%Y:%H:%M:%S %z
source record
standard localtime
]
d.run do
d.emit({"a"=>1}, Time.parse("1990-04-14 09:45:15 UTC").to_i)
end
record = d.emits.first.last
assert_equal "14... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix_time\n Time.stubs(:now => Time.at(1439200000))\n end",
"def freeze_time(time)\n Time.stubs(:now).returns time\n end",
"def to_time()\n #This is a stub, used for indexing\n end",
"def test_time_now_is_being_mocked_correctly\n assert_equal Time.at(0), Time.now\n end",
"def test_... | [
"0.728359",
"0.6946252",
"0.68496686",
"0.6831988",
"0.6728217",
"0.66025496",
"0.66025496",
"0.66025496",
"0.66025496",
"0.66025496",
"0.66025496",
"0.66025496",
"0.66025496",
"0.66025496",
"0.659703",
"0.6592585",
"0.6527776",
"0.6429819",
"0.64239186",
"0.6417081",
"0.6415... | 0.0 | -1 |
Replace this with your real tests. | def test_create_batch
batch_upload = uploaded_file("#{File.expand_path(Rails.root)}/test/fixtures/batch_import.csv")
count = Batch.count
post :create, {:upload => {'file' => batch_upload}, :type => 'batch'}, {:user => 15}
new_count = Batch.count
last_batch = Batch.find(:all).last
assert_equal(la... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testing\n # ...\n end",
"def __dummy_test__\n end",
"def tests; end",
"def tests; end",
"def spec; end",
"def spec; end",
"def self_test; end",
"def self_test; end",
"def test \n end",
"def test_0_dummy\n\t\tend",
"def test\n\n end",
"def test\n end",
"def test\n end"... | [
"0.7446459",
"0.6956364",
"0.69155836",
"0.69155836",
"0.6864151",
"0.6864151",
"0.66406286",
"0.66406286",
"0.66253287",
"0.6547665",
"0.6524571",
"0.6484549",
"0.6484549",
"0.6484549",
"0.6403847",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188"... | 0.0 | -1 |
get us an object that represents an uploaded file | def uploaded_file(path, content_type="application/octet-stream", filename=nil)
filename ||= File.basename(path)
t = Tempfile.new(filename)
FileUtils.copy_file(path, t.path)
(class << t; self; end;).class_eval do
alias local_path path
define_method(:original_filename) { filename }
defin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uploaded_file\n instance_read(:uploaded_file)\n end",
"def object\n case type\n when \"file\" then @filepath\n when \"atom\" then @atomentry.xml\n when \"multipart\" then @multipart.filepath\n end\n end",
"def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(... | [
"0.7943286",
"0.7681313",
"0.7324911",
"0.7324911",
"0.7324911",
"0.7318267",
"0.7234063",
"0.7115608",
"0.7063307",
"0.6863662",
"0.6831545",
"0.68127227",
"0.68127227",
"0.68127227",
"0.68127227",
"0.6797088",
"0.6755555",
"0.674465",
"0.674465",
"0.6737964",
"0.6725986",
... | 0.59884095 | 90 |
Check the Current Space in the container | def check_current_space
if @parcels.empty?
puts @volume.to_i
else
sum = 0
@parcels.each do |parcel|
sum += parcel.volume.to_i
end
puts @volume.to_i - sum
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_space?(spot)\n !@occupied_spaces.key?(spot)\n end",
"def victory?\n self.grid.flatten.select {|space| !space.mine }.\n all? {|space| space.visible }\n end",
"def space_available?(space)\n \t@spaces[to_space_sym(space)] == \" \" ? true : false\n end",
"def misplaced_spa... | [
"0.66209185",
"0.62633824",
"0.6193466",
"0.6192564",
"0.6083761",
"0.6055701",
"0.6040168",
"0.59375685",
"0.5912366",
"0.58986944",
"0.5882266",
"0.58808",
"0.5848527",
"0.58074754",
"0.57979393",
"0.5767878",
"0.57368994",
"0.5703694",
"0.5693718",
"0.56509113",
"0.5647284... | 0.6013497 | 7 |
Check's if there's any space left | def any_space?(volume_to_add)
if current_space > volume_to_add.to_i
true
else
puts 'Can\'t add parcel. Too Big'
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isFull? \n return @slots[NUMBER_OF_SLOTS-1].content != \" \" \n end",
"def empty_space(counter)\r\n if counter == 64\r\n return true\r\n else \r\n false\r\n end\r\n end",
"def space_available?(space)\n \t@spaces[to_space_sym(space)] == \" \" ? true : false\n end",
"def free_spa... | [
"0.7260164",
"0.7168569",
"0.7109353",
"0.69231194",
"0.6854582",
"0.6849136",
"0.6842414",
"0.6660956",
"0.66514796",
"0.66390294",
"0.6626211",
"0.65568143",
"0.65513664",
"0.65296197",
"0.65083",
"0.6477439",
"0.6474458",
"0.64296275",
"0.64145726",
"0.64141595",
"0.640057... | 0.63471246 | 24 |
Calulate the Current Space in the container | def current_space
if @parcels.empty?
@volume.to_i
else
sum = 0
@parcels.each do |parcel|
sum += parcel.volume.to_i
end
@volume.to_i - sum
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def space()\n #This is a stub, used for indexing\n end",
"def draw_current \t \n \t\" #{@spaces[:space_1]} | #{@spaces[:space_2]} | #{@spaces[:space_3]}\\n\" +\n \t\t\t\t\t \" _____|_____|____\\n\" +\n \t\" #{@spaces[:space_4]} | #{@spaces[:space_5]} | #{@spac... | [
"0.6339131",
"0.60183907",
"0.60140944",
"0.5991987",
"0.5947861",
"0.59192955",
"0.5883604",
"0.5689463",
"0.5599994",
"0.55688983",
"0.55568165",
"0.55447793",
"0.55183274",
"0.5505187",
"0.541837",
"0.5414836",
"0.53998756",
"0.5395844",
"0.53866905",
"0.53817123",
"0.5329... | 0.6318117 | 1 |
Check's if the parcel is already in the container | def parcel_in_container?(id)
found = 0
if @parcels.empty?
false
else
@parcels.each do |parcel|
if parcel.id == id
puts 'Parcel with this ID is already in the container - Can\'t add'
found = 1
end
end
end
found == 1 ? true : false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def present?\n container.present?\n end",
"def contained?\n !container.nil?\n end",
"def container?\n !@container.nil?\n end",
"def has?(name)\n @_componentable_container.include?(name)\n end",
"def is_container?\n\t\treturn false\n\tend",
"def container_available?\n return... | [
"0.6625114",
"0.65254945",
"0.64847153",
"0.64057577",
"0.6238831",
"0.60284746",
"0.589795",
"0.58896303",
"0.58836234",
"0.5878832",
"0.5819617",
"0.5815212",
"0.57944286",
"0.57822734",
"0.57299083",
"0.5695028",
"0.5686151",
"0.5671465",
"0.5653338",
"0.563055",
"0.563020... | 0.7869464 | 0 |
opts A slop command object (acts like superhash) Only allowed option is 'integrationpath' which should have defaulted to 'integration' | def initialize opts
opts = opts.to_hash if opts.is_a?(Slop)
Bwoken.integration_path = opts[:'integration-path']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize opts\n opts = opts.to_hash if opts.is_a?(Slop)\n self.options = opts.to_hash.tap do |o|\n o[:formatter] = 'passthru' if o[:verbose]\n o[:formatter] = select_formatter(o[:formatter])\n o[:simulator] = use_simulator?(o[:simulator])\n o[:family] = o[:fa... | [
"0.6874083",
"0.6858481",
"0.67168194",
"0.6625943",
"0.6607699",
"0.6485538",
"0.6356843",
"0.6349736",
"0.6181544",
"0.6137303",
"0.6100179",
"0.60550535",
"0.60543054",
"0.60412383",
"0.60412383",
"0.60218847",
"0.6009793",
"0.60085565",
"0.59933364",
"0.5934732",
"0.59149... | 0.7457155 | 0 |
Helper function that writes the current results to the html file. | def update_html_file
html = File.read("./statuspage-template.html");
success_fragment = File.read("./statuspage-fragment-success.html");
failure_fragment = File.read("./statuspage-fragment-failure.html");
almost_fragment = File.read("./statuspage-fragment-almostthere.html");
nailedit_fragment = File.read(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_to_file\n File.open(@output, 'w+') do |file|\n file.puts HEADER if @additional_html\n file.puts @data_for_output.join(\"\\n\")\n file.puts FOOTER if @additional_html\n end\n end",
"def write_html_file(name, type, html)\n if ENV['WRITE_HTML_FILE'] != 'false'\n file_name = \"#{Fi... | [
"0.730464",
"0.7203759",
"0.70795643",
"0.70213944",
"0.6954855",
"0.68930084",
"0.68002385",
"0.67174053",
"0.6684488",
"0.6658239",
"0.66517097",
"0.66255534",
"0.65824944",
"0.65429175",
"0.65165913",
"0.6503218",
"0.6499819",
"0.6472279",
"0.64550805",
"0.64475167",
"0.64... | 0.57961863 | 81 |
Instantiates a Session object (presumed to already exist) | def initialize(instance, id, info=nil)
@instance = instance
@id = id
@info = info
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @session = Session.new\n end",
"def new\n @session = Session.new('')\n end",
"def new\n @session = Session.new\n end",
"def init_session\n if session\n if session.updated_at < Time.now - ::Gricer.config.max_session_duration\n self.session = Session... | [
"0.7528784",
"0.7508495",
"0.7461572",
"0.73579293",
"0.7296919",
"0.7274016",
"0.725608",
"0.71929437",
"0.71683264",
"0.7129062",
"0.70902354",
"0.708931",
"0.708931",
"0.70646304",
"0.70646304",
"0.70646304",
"0.7024976",
"0.70097905",
"0.7002985",
"0.69760406",
"0.6971215... | 0.0 | -1 |
Returns the Session's group id | def group_id
get_info[:groupID]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get group_identifier\n groups.fetch self.class.identifierize(group_identifier), nil\n end",
"def group\n Group.get!(gidnumber)\n end",
"def get_group_id( group_name )\n check_user_pass\n # First we need to clean the group_name since jangosmtp only allows alphanumeric characters\n gro... | [
"0.74466366",
"0.7400943",
"0.7195273",
"0.71402955",
"0.71402955",
"0.71402955",
"0.7057238",
"0.70023143",
"0.6938201",
"0.6830321",
"0.6830321",
"0.6791102",
"0.6791048",
"0.67682344",
"0.6767673",
"0.67425025",
"0.6697539",
"0.66914755",
"0.667879",
"0.667879",
"0.6669232... | 0.78656954 | 0 |
Returns the Session's group | def group
@group ||= Group.new @instance, group_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group\n Group.get!(gidnumber)\n end",
"def group\n return @group\n end",
"def group\n return @group\n end",
"def group\n @group.name\n end",
"def get_current_group\n sd = get_security_descriptor\n\n sd&.group\n end",
"... | [
"0.7632153",
"0.7568868",
"0.7568868",
"0.7517761",
"0.75070393",
"0.74236596",
"0.7399304",
"0.7372274",
"0.72558975",
"0.71687174",
"0.7157946",
"0.7157946",
"0.7108926",
"0.70380527",
"0.70017624",
"0.69943404",
"0.69239366",
"0.69156617",
"0.6903441",
"0.68907523",
"0.689... | 0.6463319 | 48 |
Returns the Session's author id | def author_id
get_info[:authorID]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_author\n @current_author ||= session[:current_user_id] && Author.find(session[:current_user_id])\n end",
"def get_author\n\t\t# TODO\n\t\tauthor_id\n\tend",
"def current_user\n @current_author ||= Author.find_by(id: session[:author_id])\n end",
"def author; User.get(self.author_id); end",
"... | [
"0.7759066",
"0.7419436",
"0.7411283",
"0.7383411",
"0.7250756",
"0.7175539",
"0.71643853",
"0.7159822",
"0.71426696",
"0.71209556",
"0.7096755",
"0.70270944",
"0.70128936",
"0.6960077",
"0.6910642",
"0.6901423",
"0.6881983",
"0.68273807",
"0.6761213",
"0.66923404",
"0.667169... | 0.789357 | 0 |
Returns the Session's author | def author
@author ||= Author.new @instance, author_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_author\n @current_author ||= session[:current_user_id] && Author.find(session[:current_user_id])\n end",
"def author\n return User.find(self.user_id).user_name\n end",
"def author\n object.user\n end",
"def author; User.get(self.author_id); end",
"def author\n @author ||=... | [
"0.79732156",
"0.77069974",
"0.77020216",
"0.7701174",
"0.7603093",
"0.7545944",
"0.75428516",
"0.7538264",
"0.7520839",
"0.75155216",
"0.74376285",
"0.743275",
"0.7417018",
"0.7415006",
"0.7369921",
"0.73356",
"0.73346573",
"0.732152",
"0.7313129",
"0.72772974",
"0.72691894"... | 0.0 | -1 |
Returns the Session's expiration date is a Unix timestamp in seconds | def valid_until
get_info[:validUntil]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expiry_time\n session[:expires_at] || 3.days.from_now\n end",
"def session_expires_at\n @expires_at ||= begin\n node = REXML::XPath.first(document, \"/p:Response/a:Assertion/a:AuthnStatement\", { \"p\" => PROTOCOL, \"a\" => ASSERTION })\n Time.parse(node.attributes[\"SessionNotOnOrAfte... | [
"0.7948215",
"0.7611387",
"0.7573868",
"0.74748653",
"0.74748653",
"0.74748653",
"0.74748653",
"0.74748653",
"0.74748653",
"0.74467725",
"0.7419294",
"0.7347362",
"0.7347362",
"0.723946",
"0.70440066",
"0.696856",
"0.69552386",
"0.69542396",
"0.6941866",
"0.69265854",
"0.6909... | 0.0 | -1 |
Returns true if the session is not expired | def valid?
valid_until > Time.now.to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expired_session?\n if session_info.nil?\n false\n else\n creds = session_info['credentials']\n creds['expires'] && creds['expires_at'] <= Time.now.to_i\n end\n end",
"def session_expired?\n ! (Time.now < session[:expire_at])\n end",
"def session_expired?\n retu... | [
"0.8931346",
"0.8908785",
"0.864554",
"0.86447597",
"0.86014575",
"0.85558146",
"0.83655745",
"0.8243039",
"0.8182678",
"0.81483465",
"0.8075291",
"0.8040853",
"0.8022778",
"0.7993279",
"0.7986471",
"0.79864174",
"0.7960638",
"0.79532236",
"0.79479563",
"0.7931675",
"0.789367... | 0.0 | -1 |
Returns true if the session is expired | def expired?
not valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expired_session?\n if session_info.nil?\n false\n else\n creds = session_info['credentials']\n creds['expires'] && creds['expires_at'] <= Time.now.to_i\n end\n end",
"def session_expired?\n ! (Time.now < session[:expire_at])\n end",
"def session_expired?\n if s... | [
"0.885394",
"0.88016164",
"0.8696868",
"0.85812014",
"0.83014405",
"0.8261055",
"0.81836236",
"0.8113799",
"0.8081865",
"0.80799705",
"0.8033122",
"0.8007028",
"0.7998733",
"0.7992833",
"0.79780084",
"0.79573977",
"0.79305017",
"0.79232436",
"0.7899828",
"0.78968036",
"0.7895... | 0.73541266 | 73 |
Request and cache session info from the server | def get_info
@info ||= @instance.client.getSessionInfo(sessionID: @id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session() request.session end",
"def session ; request.session ; end",
"def cached_session_data\n Authentication::RedisStore.instance.json_get(auth_token)\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def session\n... | [
"0.7635172",
"0.7356814",
"0.7033222",
"0.6925676",
"0.6925676",
"0.6925676",
"0.69229615",
"0.69229615",
"0.69229615",
"0.69229615",
"0.69229615",
"0.6912928",
"0.6880986",
"0.68473727",
"0.68473727",
"0.68473727",
"0.68325144",
"0.6826043",
"0.6803423",
"0.6790538",
"0.6790... | 0.66948754 | 28 |
Return the default values for DSL properties | def default_value_for(prop)
case prop
when :install_path
"/opt/#{package_name}"
when :omnibus_project
package_name
when :downloads_product_page_url
"#{Mixlib::Install::Dist::DOWNLOADS_PAGE}/#{product_key}"
when :github_repo
"#{Mixlib::Insta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_properties\n begin\n SETTINGS[self.class.to_s.downcase]['default_properties']\n rescue\n []\n end\n end",
"def default_properties\n @properties ||= @options[:properties] || {}\n end",
"def declared_property_defaults\n @_default_property_values ||= {}\n ... | [
"0.7481252",
"0.74740416",
"0.7112429",
"0.6744879",
"0.6617052",
"0.6597648",
"0.6596642",
"0.659262",
"0.65543395",
"0.6545851",
"0.6531744",
"0.65075654",
"0.64628625",
"0.64506114",
"0.6444719",
"0.6412886",
"0.6405245",
"0.64028025",
"0.6347931",
"0.6322844",
"0.6307948"... | 0.0 | -1 |
Return all known omnibus project names for a product | def known_omnibus_projects
# iterate through min/max versions for all product names
# and collect the name for both versions
projects = %w{ 0.0.0 1000.1000.1000 }.collect do |v|
@version = v
omnibus_project
end
# remove duplicates and return multiple known nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_pending_refund_payments_projects_name\n object.pending_refund_payments_projects.map(&:name).uniq\n end",
"def display_pending_refund_payments_projects_name\n source.pending_refund_payments_projects.map(&:name).uniq\n end",
"def project_names\n repositories.map { |s| s.match(/[^\\/]*$/)... | [
"0.64755666",
"0.6470661",
"0.6421222",
"0.63264567",
"0.6279038",
"0.6147668",
"0.61264473",
"0.60827285",
"0.60629576",
"0.6058758",
"0.6057389",
"0.60304844",
"0.60304844",
"0.60290396",
"0.60284",
"0.59969866",
"0.5972488",
"0.59522706",
"0.5944653",
"0.593924",
"0.593813... | 0.8390739 | 0 |
Sets or retrieves the version for the product. This is used later when we are reading the value of a property if a Proc is specified | def version(value = nil)
if value.nil?
@version
else
@version = value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version=(v)\n @version = v\n end",
"def version=(value)\n @version = value\n end",
"def version=(value)\n @version = value\n end",
"def version=(value)\n @version = value\n end",
"def version=(value)\n @ver... | [
"0.7129519",
"0.7117316",
"0.7117316",
"0.7117316",
"0.7117316",
"0.7117316",
"0.7117316",
"0.7117316",
"0.7117316",
"0.7117316",
"0.71162033",
"0.7066828",
"0.70070416",
"0.69506043",
"0.6907698",
"0.6850457",
"0.6791644",
"0.67739993",
"0.6694962",
"0.6693877",
"0.66768074"... | 0.67775697 | 17 |
Helper method to convert versions from String to Mixlib::Version | def version_for(version_string)
Mixlib::Versioning.parse(version_string)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_version(str)\n default = \"0.0.1\"\n\n if str.nil? or str.empty?\n default\n elsif str.match /^(\\d)+[.](\\d)+[.](\\d)+$/\n str\n elsif str.match /^((\\d)+[.])*(\\d)+$/\n fix_version(str)\n else\n raise VersionError, \"need a vali... | [
"0.67618465",
"0.6672501",
"0.647239",
"0.6463644",
"0.645182",
"0.6417481",
"0.64043146",
"0.63876784",
"0.6328605",
"0.62862796",
"0.6187154",
"0.61436415",
"0.6142295",
"0.6135853",
"0.6101909",
"0.60598415",
"0.60598415",
"0.6011642",
"0.6001923",
"0.6000002",
"0.59864104... | 0.78446776 | 0 |
The only DSL method of this class. It creates a Product with given `key` and stores it. | def product(key, &block)
@product_map[key] = Product.new(key, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n data = self.class.create_product(self)\n self.id = data.id\n data\n end",
"def product_key=(value)\n @product_key = value\n end",
"def product_key=(value)\n @product_key = value\n end",
"def build_product\n bundle = Bundle.de... | [
"0.67161524",
"0.6433913",
"0.6433913",
"0.635692",
"0.63173354",
"0.62939924",
"0.6255398",
"0.6229637",
"0.60187966",
"0.59739375",
"0.59391755",
"0.5933275",
"0.5903313",
"0.58934146",
"0.58372915",
"0.5817098",
"0.5817098",
"0.58140045",
"0.5794391",
"0.57828945",
"0.5776... | 0.7747336 | 0 |
Fetches the keys of available products. | def products
@product_map.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keys\n ::M2X::Client::Key.list(@client, params.merge(device: self[\"id\"]))\n end",
"def get_enterable_products\n return call('Product.get_enterable_products')\n end",
"def keys\n IbmCloudRest.get \"#{@uri}/keys\"\n end",
"def fetch_collection_of_keys\n cmd_out, cmd_err, status = f... | [
"0.6682065",
"0.635878",
"0.6321813",
"0.6262242",
"0.62325674",
"0.6204477",
"0.6169122",
"0.6166336",
"0.61423564",
"0.6127802",
"0.61185855",
"0.6080266",
"0.60692847",
"0.6065034",
"0.60539323",
"0.6031471",
"0.6029494",
"0.6024061",
"0.59975874",
"0.59896165",
"0.5988509... | 0.6918689 | 0 |
Looks up a product and sets version on it to be used later by the Product. | def lookup(key, version = :latest)
# return nil unless the product exists
return nil unless @product_map.key?(key)
product = @product_map[key]
# We set the lookup version for the product to a very high number in
# order to mimic :latest so that one does not need to handle this
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_product_product\n @product_product = Product::Product.find(params[:id])\n end",
"def set_product\n @product = current_api_v1_user.products.find(params[:id])\n end",
"def set_product\n @product = params[:id] ? Product.find(params[:id]) : Product.find(params[:product_id])\n end",
... | [
"0.7162781",
"0.7122311",
"0.70577",
"0.7055588",
"0.7053552",
"0.7052769",
"0.7024406",
"0.700602",
"0.700602",
"0.700602",
"0.700602",
"0.700602",
"0.7000143",
"0.6988055",
"0.69513005",
"0.6941637",
"0.69323933",
"0.6931655",
"0.6931655",
"0.6931655",
"0.6931655",
"0.693... | 0.0 | -1 |
GET /se_use_products/1 GET /se_use_products/1.xml | def show
@se_product = SeProduct.find(params[:id])
@product = @se_product.product
add_breadcrumb _("My products").html_safe, :products_url
add_breadcrumb @se_product.product.name, edit_product_url(@se_product.product)
add_breadcrumb _("Environmental Assessment").html_safe, se_production_init_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @products = CatalogMebeli.find(params[:id]).products\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\n... | [
"0.691038",
"0.6862698",
"0.68592167",
"0.67222446",
"0.66898227",
"0.6662869",
"0.6590769",
"0.6533521",
"0.65212977",
"0.64811355",
"0.64611846",
"0.6449989",
"0.64449733",
"0.6440105",
"0.6397201",
"0.63803476",
"0.63727736",
"0.63611346",
"0.6357887",
"0.63404244",
"0.630... | 0.5993517 | 67 |
GET /se_use_products/new GET /se_use_products/new.xml | def new
@se_use_product = SeUseProduct.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @se_use_product }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product_software }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product }\n end\n end",... | [
"0.7451348",
"0.72373253",
"0.70304143",
"0.70304143",
"0.70304143",
"0.70304143",
"0.70304143",
"0.70304143",
"0.70304143",
"0.70304143",
"0.70304143",
"0.70304143",
"0.70304143",
"0.7022077",
"0.70209026",
"0.7016889",
"0.6996211",
"0.69870245",
"0.697957",
"0.6913355",
"0.... | 0.75232846 | 0 |
POST /se_use_products POST /se_use_products.xml | def create
@se_use_product = SeUseProduct.new(params[:se_use_product])
respond_to do |format|
if @se_use_product.save
format.html { redirect_to(@se_use_product, :notice => 'Se use product was successfully created.') }
format.xml { render :xml => @se_use_product, :status => :created... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def omega\n products = GetProducts.new.send_request\n SaveProducts.new(products[:productRecords]).save\n end",
"def post_to_newgistics\n document = Spree::Newgistics::DocumentBuilder.build_product([self])\n response = Spree::Newgistics::HTTPManager.post('/post_products.aspx', document)\n\n if res... | [
"0.67274886",
"0.64476025",
"0.6424628",
"0.6386143",
"0.62842375",
"0.6249762",
"0.613069",
"0.6064519",
"0.6001375",
"0.60007095",
"0.5974796",
"0.59490085",
"0.5921849",
"0.59124744",
"0.59095615",
"0.58822924",
"0.587554",
"0.5871584",
"0.5863393",
"0.5839447",
"0.583599"... | 0.6809525 | 0 |
PUT /se_use_products/1 PUT /se_use_products/1.xml | def update
@se_use_product = SeUseProduct.find(params[:id])
respond_to do |format|
if @se_use_product.update_attributes(params[:se_use_product])
format.html { redirect_to(@se_use_product, :notice => 'Se use product was successfully updated.') }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_at... | [
"0.65797824",
"0.64186555",
"0.63903314",
"0.6358381",
"0.6306349",
"0.6230251",
"0.6153323",
"0.61233425",
"0.61095643",
"0.6096843",
"0.60892045",
"0.60853744",
"0.60616034",
"0.60588735",
"0.60575956",
"0.6051458",
"0.60425",
"0.6041759",
"0.60361814",
"0.6024051",
"0.6022... | 0.7069739 | 0 |
DELETE /se_use_products/1 DELETE /se_use_products/1.xml | def destroy
@se_use_product = SeUseProduct.find(params[:id])
@se_use_product.destroy
respond_to do |format|
format.html { redirect_to(se_use_products_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_configuration_product\r\n # node = ProductPackageProduct.find(params[:id].to_i).destroy\r\n # redirect_to :action => \"configuration_products\", :id => node.parent_id\r\n ExampleConfigurationProduct.delete params[:id]\r\n redirect_to :action => \"configuration_products\", :id => params[:id]\... | [
"0.69456536",
"0.6708615",
"0.65659815",
"0.6543889",
"0.64903814",
"0.63962054",
"0.63809586",
"0.6373782",
"0.63674796",
"0.6343029",
"0.63260007",
"0.63062376",
"0.6271553",
"0.6256116",
"0.6256116",
"0.6254587",
"0.6249022",
"0.6238053",
"0.622323",
"0.6203882",
"0.620257... | 0.694085 | 1 |
Never trust parameters from the scary internet, only allow the white list through. | def comment_params
params.require(:comment).permit(:content)
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 |
Run query :remote_query : submit query to the cluster using qsub | def run_query(query_file , exp , o = {})
index_path = o[:index_path] || @index_path
cmd = fwrite('cmd_galago_run_query.log' , "#{$galago_path}/bin/galago batch-search --index=#{index_path} #{o[:param_query]} \
#{to_path(query_file)} |grep -e ^[0-9] > #{to_path(exp+'.res')}" , :mode=>'a')
`#{cmd}`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_remote(query)\n raise \"You must override `execute_remote' in your class\"\n end",
"def remote_query\n raise \"You must override `remote_query' in your class\"\n end",
"def run_query(query, server)\n query_command = \"echo -e \\\"#{query}\\\"| mysql\"\n ... | [
"0.68768996",
"0.66492116",
"0.6487054",
"0.61856544",
"0.6158365",
"0.6143736",
"0.6123904",
"0.6070572",
"0.6068436",
"0.6066184",
"0.60309047",
"0.6007831",
"0.6004137",
"0.59897345",
"0.59897345",
"0.59897345",
"0.5960221",
"0.5951865",
"0.59513247",
"0.5891002",
"0.58898... | 0.54328203 | 56 |
Input: Real name string Steps: 1. Split the string into words, make that an array 2. Reverse the order of the array 3. Join the array back into a string, make it all lowercase. 4. Split the string into characters. 5. Create 2 arrays, of vowels and consonants 6. Iterate through the array of letters If character is a spa... | def create_alias(real_name)
vowels = ["a", "e", "i", "o", "u"]
consonants = ["b", "c", "d", "f", "g", "h", "j",
"k", "l", "m", "n", "p", "q", "r", "s", "t",
"v", "w", "x", "y", "z"]
# takes the real name, splits into words, reverses the order, joins into string again, and lowercases
reversed_lowcase_str =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aliass(full_name)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\tvowels = \"aeiou\"\n\tnew_string = \"\"\n\n full_name.split('').each do |letter|\n \t\tif vowels.include?(letter)\n \t\t\tnew_string += vowel(letter)\n \t\telsif alphabet.include?(letter)\n \t\t\tnew_string += consonant(letter)\n \t\telse\n \t\t\tne... | [
"0.82006925",
"0.8022588",
"0.7949577",
"0.79471743",
"0.7918117",
"0.77937996",
"0.773638",
"0.76843435",
"0.7606727",
"0.75920755",
"0.7540992",
"0.7511174",
"0.74694115",
"0.73990273",
"0.73779005",
"0.7366184",
"0.73343533",
"0.72984457",
"0.7238156",
"0.7236727",
"0.7229... | 0.0 | -1 |
This method sends the needed HTTP header and statuscode (401) to force the user to login. | def require_login
@response.add_header('WWW-Authenticate', "Basic realm=\"#{@realm}\"")
@response.status = 401
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_client_to_handle_unauthorized_status\n headers.delete('WWW-Authenticate')\n end",
"def not_authorized\r\n render :file => 'public/401.html', :status => 401, :layout => false\r\n end",
"def unauthorized\n render \"errors/401\", :status => 401\n\tend",
"def handle_unverified_request\n ... | [
"0.7340483",
"0.7257311",
"0.71321076",
"0.7124463",
"0.70340496",
"0.7032337",
"0.70099515",
"0.6979237",
"0.6955228",
"0.6950101",
"0.69462717",
"0.6875144",
"0.68281925",
"0.6824383",
"0.6809889",
"0.6803843",
"0.6785241",
"0.6785241",
"0.67560923",
"0.67504555",
"0.674164... | 0.77386844 | 0 |
Evaluates the value via valuecall | def call(instance)
self.value.call(instance, self.attribute)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval(_)\n value\n end",
"def evaluate(value)\n if value.is_a?(Proc)\n value.call\n else\n value\n end\n end",
"def eval_value(*args)\n eval(*args).value\n end",
"def evaluate(value, _scope)\n value\n end",
"de... | [
"0.7845965",
"0.7764402",
"0.7729603",
"0.72269547",
"0.71120596",
"0.7078567",
"0.70746344",
"0.6838328",
"0.6810098",
"0.6804283",
"0.67281",
"0.67067266",
"0.65691864",
"0.65448385",
"0.6501459",
"0.64488834",
"0.6434999",
"0.6417141",
"0.6408588",
"0.6392851",
"0.6373542"... | 0.6284205 | 27 |
open & exec contextMenu | def openContextPopup(pos, wItem)
poRow = wItem.row
poColumn = wItem.column
process = taskItemAtRow(wItem.row).process
menu = Qt::Menu.new
insertDefaultActions(menu, poColumn, process)
createPlayerMenu(menu, poColumn, process)
action =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_menu\n h = { \n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :s => :sort_menu, \n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindke... | [
"0.6566565",
"0.6522927",
"0.65209556",
"0.65030664",
"0.6416414",
"0.63887095",
"0.6349498",
"0.63416725",
"0.6326582",
"0.6321304",
"0.6317152",
"0.6317152",
"0.6221848",
"0.62150604",
"0.61806196",
"0.6162328",
"0.6161081",
"0.61528414",
"0.61445355",
"0.612191",
"0.611707... | 0.67386895 | 0 |
API: GETSTATE (returns the warden's state file) | def update_path_and_ip
raise ArgumentError, "container handle must not be nil" unless @handle
request = ::Warden::Protocol::InfoRequest.new(:handle => @handle)
response = call(:info, request)
raise RuntimeError, "container path is not available" unless response.container_path
@path = response.cont... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state\n send_request(FUNCTION_GET_STATE, [], '', 2, '? ?')\n end",
"def state\n ret = request('getState')\n STATE_TO_STR[ ret['statecode'] ]\n end",
"def state_file\n return File.join(File.dirname(__FILE__), 'state.json')\n end",
"def get_state\n @client.get_stat... | [
"0.7805632",
"0.7428762",
"0.74187243",
"0.73090434",
"0.7039802",
"0.6847581",
"0.68205607",
"0.6771427",
"0.67425275",
"0.67089206",
"0.66912687",
"0.6606863",
"0.65941167",
"0.6574521",
"0.65718347",
"0.65122104",
"0.6497965",
"0.6438358",
"0.6426886",
"0.6403134",
"0.6403... | 0.0 | -1 |
API: within DESTROY what do we do with link requests | def call_with_retry(name, request)
count = 0
response = nil
begin
response = call(name, request)
rescue ::EM::Warden::Client::ConnectionError => error
count += 1
logger.warn("Request failed: #{request.inspect}, retrying ##{count}.")
logger.error(error)
retry
end
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n destroy_and_respond(@link)\n end",
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def remove_link\n\t\tfname = \"#{self.class.name}.#{__method__}\"\n\t\t#LOG.info(\"#{self.class.name}.#{__method__}\") { \"params=#{params}\" }\n\t\t@link = Link.f... | [
"0.76637465",
"0.72477764",
"0.72477764",
"0.69180584",
"0.68578595",
"0.68195784",
"0.6802847",
"0.6777624",
"0.67712086",
"0.6764358",
"0.67548764",
"0.67385083",
"0.66904414",
"0.6684744",
"0.6677779",
"0.66521156",
"0.66521156",
"0.66521156",
"0.66521156",
"0.66521156",
"... | 0.0 | -1 |
x and y coordinates start out 0 | def initialize
@start_vertical = nil
@start_horizontal = nil
@processed_maze = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n self.x, self.y = 0, 0\n end",
"def coords; {:x => @x, :y => @y} end",
"def normalize_coords(x, y)\n x = x * -1 - 1 if x < 0\n y = y * -1 - 1 if y > -1\n [x, y]\n end",
"def start_at(x, y = nil)\n from.coord x, y\n end",
"def identity_x\r\n new_point = ident... | [
"0.7397222",
"0.72179157",
"0.7082751",
"0.70497435",
"0.7023301",
"0.70199335",
"0.69634277",
"0.69134104",
"0.6876232",
"0.6863095",
"0.68206835",
"0.6797209",
"0.67936313",
"0.67752707",
"0.67692065",
"0.6766827",
"0.67607147",
"0.6757311",
"0.67478853",
"0.6717781",
"0.67... | 0.0 | -1 |
open the file read a line FOR each line create a new array UNTIL you find a newline make each part a unique element within the array return the array of arrays | def convert_maze_to_array(file)
@processed_maze = File.readlines(file)
@processed_maze = @processed_maze.map do |row|
row.chomp!
row.split('')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_to_array file\n lines = []\n File.open(file, \"r\") do |infile|\n while (line = infile.gets)\n lines.push(line.gsub(\"\\n\", \"\").rstrip)\n end\n end\n lines\n end",
"def q1_read_to_array(data_file_name)\r\n array2d = []\r\n \r\n read_file(\"data/\"+data... | [
"0.70943063",
"0.67380434",
"0.666764",
"0.6657416",
"0.6600309",
"0.64757144",
"0.64422333",
"0.63980097",
"0.63945395",
"0.634442",
"0.62965906",
"0.62545824",
"0.6254573",
"0.6211592",
"0.6192069",
"0.6182472",
"0.61787623",
"0.611573",
"0.6110598",
"0.60966766",
"0.605829... | 0.6218011 | 13 |
get the starting node of the maze | def get_start(processed_maze)
# start_horizontal; start_vertical = nil
processed_maze.each_with_index do |row, vertical_index|
row.each_with_index do |item, horizontal_index|
if item == 'o'
@start_vertical = vertical_index
@start_horizontal = horizontal_index
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_start_floor(the_maze) \r\n the_maze.each_with_index do |floor, index| \r\n return index if get_start_position(floor) != nil \r\n end \r\nend",
"def get_start_node\n return @nodes.reduce{|sum, pair| pair[0] < sum[0] ? pair : sum}[1] \n end",
"def find_start\n find_cell(START)\n end",
... | [
"0.69944227",
"0.6837364",
"0.6700363",
"0.65952456",
"0.6399987",
"0.6358887",
"0.6336665",
"0.63354325",
"0.63111794",
"0.6231262",
"0.6158607",
"0.613091",
"0.6122865",
"0.61219174",
"0.609784",
"0.6064497",
"0.6047905",
"0.6011019",
"0.60093164",
"0.59558904",
"0.5927179"... | 0.7773278 | 0 |
print the "array'd" maze | def print_maze(maze_array)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_maze\n\t\tcount = 1\n\t\t@maze.each do |x|\n\t\t\tputs x.to_s\n\t\tend\n\tend",
"def display()\n\t\tmaze.each do|x| \n\t\t\tx.each {|j| print j}\n\t\t\tputs\n\t\tend\n\tend",
"def print\n @maze[:matrix].each do |line|\n puts line.join\n end\n end",
"def print_maze(maze)\n $debu... | [
"0.78904164",
"0.7771652",
"0.7725846",
"0.73921025",
"0.7314605",
"0.72233874",
"0.7191134",
"0.7188598",
"0.69593954",
"0.69393533",
"0.69393533",
"0.69216084",
"0.6896333",
"0.6851368",
"0.67798847",
"0.6779034",
"0.6770019",
"0.6721572",
"0.6721572",
"0.67037404",
"0.6701... | 0.83284 | 0 |
GET /repairs GET /repairs.json | def index
#conducting simple search
@repairs = Repair.search(params[:search])
#@repairs = Repair.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @chairs = Chair.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chairs }\n end\n end",
"def index\n @repairs = Repair.all.order(:updated_at).reverse_order.paginate(page: params[:page], per_page: 10)\n #Yes本社の場合全件表示、それ以外の場合は自社の管轄のエン... | [
"0.66440576",
"0.6272067",
"0.6162068",
"0.6054164",
"0.5961583",
"0.5944926",
"0.5925249",
"0.5823921",
"0.5807819",
"0.5807819",
"0.5787523",
"0.57873815",
"0.5766766",
"0.57662475",
"0.57194567",
"0.5717884",
"0.57108176",
"0.5707626",
"0.56998104",
"0.5698738",
"0.5682722... | 0.5668826 | 21 |
GET /repairs/1 GET /repairs/1.json | def show
#insert now
@repair = Repair.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @chairs = Chair.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chairs }\n end\n end",
"def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n en... | [
"0.6435687",
"0.6339014",
"0.61843336",
"0.615426",
"0.6149624",
"0.6139124",
"0.6037865",
"0.6010096",
"0.5961243",
"0.5941201",
"0.5927493",
"0.591112",
"0.5897157",
"0.58956945",
"0.5848618",
"0.5848618",
"0.584833",
"0.58416307",
"0.5838751",
"0.5838751",
"0.58315206",
... | 0.0 | -1 |
POST /repairs POST /repairs.json | def create
# @repair = Repair.new(repair_params) this change to current_user jkm
# this will let us know the user who created the repair
#added jkm
@serviceproviders = Serviceprovider.all
@repair = current_user.repairs.new(repair_params)
respond_to do |format|
if @repair.save
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n #@workshop = Workshop.new(params[:workshop][:name])\n req = params[:workshop]\n @workshop = Workshop.new(:name => req[:name] , :address => req[:address] , :contact_numbers => req[:contact_numbers],\n :contact_person => req[:contact_person], :is_premium => req[:is_p... | [
"0.6007228",
"0.58258444",
"0.57600874",
"0.5517804",
"0.5517348",
"0.5508584",
"0.55033493",
"0.5493124",
"0.54753447",
"0.5444167",
"0.5419673",
"0.5391874",
"0.5383637",
"0.53745294",
"0.5345976",
"0.5321443",
"0.5316856",
"0.5316098",
"0.5315796",
"0.53114563",
"0.5277948... | 0.5239868 | 29 |
PATCH/PUT /repairs/1 PATCH/PUT /repairs/1.json | def update
@serviceproviders = Serviceprovider.all
respond_to do |format|
if @repair.update(repair_params)
format.html { redirect_to @repair, notice: 'Repair was successfully updated.' }
format.json { render :show, status: :ok, location: @repair }
else
format.html { render :e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => ... | [
"0.65073365",
"0.64846456",
"0.62763196",
"0.6198802",
"0.6141665",
"0.61325836",
"0.6121517",
"0.6119303",
"0.6050345",
"0.6050345",
"0.60330063",
"0.60172206",
"0.600749",
"0.5955607",
"0.5950598",
"0.59261984",
"0.58958423",
"0.5895498",
"0.5883116",
"0.58759916",
"0.58742... | 0.0 | -1 |
DELETE /repairs/1 DELETE /repairs/1.json | def destroy
@repair.destroy
respond_to do |format|
format.html { redirect_to repairs_url, notice: 'Repair was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @repair.destroy\n respond_to do |format|\n format.html { redirect_to repairs_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n ... | [
"0.6901845",
"0.68810034",
"0.68472195",
"0.66945624",
"0.66695",
"0.6625393",
"0.6594856",
"0.6594856",
"0.6534298",
"0.6529141",
"0.6451642",
"0.6445709",
"0.64353746",
"0.63797927",
"0.63783264",
"0.63721985",
"0.63693213",
"0.63391566",
"0.6337023",
"0.63334113",
"0.63316... | 0.65382206 | 8 |
Use callbacks to share common setup or constraints between actions. | def set_repair
@repair = Repair.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.6163821",
"0.6045432",
"0.5945441",
"0.5916224",
"0.58894575",
"0.5834073",
"0.57764685",
"0.5702474",
"0.5702474",
"0.5653258",
"0.56211996",
"0.54235053",
"0.5410683",
"0.5410683",
"0.5410683",
"0.53948104",
"0.5378064",
"0.5356684",
"0.53400385",
"0.53399503",
"0.533122... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def repair_params
params.require(:repair).permit(:job_number, :fault, :descrition, :repair_type, :booking_date, :location, :repairer, :serviceprovider_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.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.629... | 0.0 | -1 |
Checks to make sure the environment variable exists or has a specific value | def has_environment_variable(name, value = nil)
name, value = name.to_s, value.to_s
if ENV['os'] =~ /win/i
# use set | findstr to avoid shell substitution, which does not appear to work reliably with Kernel.system
command = "set #{name} | findstr /c:\"#{name}=\""
command <<... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def var_present?(var)\n !ENV[var].nil? && !ENV[var].empty?\n end",
"def from_env\n ENV_VARS.any? { |key| @env.key?(key) } || NoValue\n end",
"def env?(key)\n blank?(ENV[key])\n end",
"def check_vars\n req_env_vars = ['REDMINE_BASE_URL', 'REDMINE_API_KEY', 'SLACK_WEBHOOK... | [
"0.76174366",
"0.7152717",
"0.71256787",
"0.70985675",
"0.70595247",
"0.6916606",
"0.67186517",
"0.671431",
"0.6667867",
"0.66500074",
"0.6597954",
"0.6594224",
"0.6594224",
"0.6583098",
"0.65444046",
"0.6535175",
"0.6523953",
"0.64552194",
"0.6420145",
"0.63929164",
"0.63854... | 0.8116456 | 0 |
Checks to make sure the environment variable contains the given text | def environment_variable_contains(name, text)
name, text = name.to_s, text.to_s
if ENV['os'] =~ /win/i
# use set | findstr to avoid shell substitution, which does not appear to work reliably with Kernel.system
command = "set #{name} | findstr /c:\"#{text}\""
command << ' > ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_environment_variable(name, value = nil)\n name, value = name.to_s, value.to_s\n if ENV['os'] =~ /win/i\n # use set | findstr to avoid shell substitution, which does not appear to work reliably with Kernel.system\n command = \"set #{name} | findstr /c:\\\"#{name}=\\\"\"\n ... | [
"0.7049718",
"0.6061592",
"0.5991578",
"0.5811177",
"0.57999027",
"0.579972",
"0.57905036",
"0.5728796",
"0.5650689",
"0.563401",
"0.55115885",
"0.5425195",
"0.53906816",
"0.5383663",
"0.53798544",
"0.5352474",
"0.5324334",
"0.53218013",
"0.53173393",
"0.5297782",
"0.5287669"... | 0.7620124 | 0 |
Create a Line instance | def initialize(text = "", prompt: "", separator: nil)
@text = text.dup
@prompt = prompt.dup
@prompt_size = prompt_display_width
break_chars = DEFAULT_WORD_BREAK_CHARACTERS.chars
@separator = separator || Regexp.union(break_chars)
@cursor = [0, @text.length].max
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linechart(*args)\n Line.new(self, *args)\n end",
"def create_line(instance_name, class_name, which=0)\n raise StandardError, \"Line object already exists. (#{instance_name})\" if self.instance_variables.include?(\"@#{instance_name}\".to_sym)\n new_line_name = instance_name\n make_... | [
"0.7344675",
"0.70497125",
"0.7019216",
"0.6895869",
"0.67123234",
"0.671047",
"0.6681086",
"0.66623497",
"0.662725",
"0.662341",
"0.6611613",
"0.6577729",
"0.65739095",
"0.65739095",
"0.6534495",
"0.65282583",
"0.6500369",
"0.647189",
"0.6453315",
"0.64123464",
"0.63891536",... | 0.0 | -1 |
Check if line is in edit mode | def editing?
@mode == :edit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle_editmode\n\t\t@editmode = true\n\t\t$screen.write_message(\"Edit mode\")\n\tend",
"def editable?\n false\n end",
"def editable?\n true\n end",
"def editable?\n true\n end",
"def editable?\n true\n end",
"def edit?\n false\n end",
"def edited?\n @description =~ ... | [
"0.670314",
"0.66965437",
"0.6669561",
"0.6669561",
"0.6669561",
"0.64916784",
"0.6468862",
"0.6458108",
"0.64184034",
"0.6388222",
"0.636477",
"0.63636625",
"0.6262902",
"0.623804",
"0.6234598",
"0.6170959",
"0.6160128",
"0.615652",
"0.614502",
"0.6136966",
"0.6134029",
"0... | 0.7584038 | 0 |
Check if line is in replace mode | def replacing?
@mode == :replace
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_line?(line)\n end",
"def replace(line)\n return line if line !~ /\\{\\{Gc/\n return line if line =~ /link=none/ || line =~ /dis=false/ || line =~ /dis=true/\n return line.gsub!(/\\{\\{[Gg]c|mod=(\\S+)\\|/, '{{Gc|mod=\\1|dis=false|')\nend",
"def search_file_replace_line(regex, newline)\n sea... | [
"0.59201455",
"0.58917195",
"0.5719262",
"0.5697132",
"0.5683551",
"0.5658915",
"0.55935526",
"0.55729896",
"0.5531417",
"0.54596806",
"0.54317194",
"0.5336058",
"0.5328602",
"0.53227776",
"0.53227776",
"0.52971923",
"0.52697355",
"0.5257933",
"0.52039444",
"0.5200938",
"0.51... | 0.72960377 | 0 |
Check if cursor reached beginning of the line | def start?
@cursor.zero?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_of_line\n self.cursor = 0\n end",
"def start?\n @cursor == 0\n end",
"def same_cursor_position?\n window.cursor[1] == @history.start_pos && \n window.cursor[0] == @history.line_number\n end",
"def rl_beg_of_line(count, key)\r\n @rl_point = 0\r\n 0\r\n end",
"def ... | [
"0.8368088",
"0.7556794",
"0.68444836",
"0.6727841",
"0.671608",
"0.66563976",
"0.6642125",
"0.66303414",
"0.65856236",
"0.6560831",
"0.6525185",
"0.651841",
"0.6369552",
"0.6366693",
"0.63661397",
"0.63661397",
"0.63630116",
"0.6359526",
"0.6349856",
"0.63454926",
"0.6341072... | 0.73034286 | 2 |
Check if cursor reached end of the line | def end?
@cursor == @text.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_of_line\n self.cursor = :end\n end",
"def end?\r\n\t\tif(@allLines.empty?)\r\n\t\t\treturn true\r\n\t\telse\r\n\t\t\treturn false\r\n\t\tend\r\n\tend",
"def eof?\n wait_for_chars(1)\n @cursor == @buffer.length && @eof_found\n end",
"def at_end?\n peek.type == :eof\n end",... | [
"0.817206",
"0.7198399",
"0.70131385",
"0.7000966",
"0.6906059",
"0.6851561",
"0.680684",
"0.67719465",
"0.67547643",
"0.674396",
"0.6719426",
"0.6661845",
"0.6630677",
"0.6621213",
"0.65888566",
"0.6585013",
"0.65470606",
"0.6534025",
"0.65293425",
"0.6506182",
"0.6411721",
... | 0.80136013 | 2 |
Move line position to the left by n chars | def left(n = 1)
@cursor = [0, @cursor - n].max
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shift_left!(options={})\n max = 10000\n sep = options[:sep] || \"\\n\"\n (lines = split(sep)).each { |line| \n if m = line.match(/^\\s+/)\n spaces = m[0].gsub('\\t',' '*(options[:tab] || 2))\n line.gsub!(/^\\s+/,spaces)\n max = [max,spaces.length].min\n else\n max... | [
"0.67867",
"0.6762537",
"0.67510664",
"0.66752374",
"0.65656203",
"0.65656203",
"0.65639937",
"0.6458076",
"0.6440356",
"0.6422979",
"0.63066405",
"0.6296576",
"0.61829007",
"0.616647",
"0.6121381",
"0.6026884",
"0.5912396",
"0.59042645",
"0.5866475",
"0.585568",
"0.58394617"... | 0.6588297 | 5 |
Move line position to the right by n chars | def right(n = 1)
@cursor = [@text.length, @cursor + n].min
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shift_right!(count=2)\n self.gsub!(/^./m,' '*count + '\\0')\n end",
"def truncate(n)\n super\n self.pos = n if self.pos > n\n self.length = n\n end",
"def move increment\n\t\tnew_text = Array.new\n\t\tif increment > 0\n\t\t\t@text_spacer += \" \" * increment\n\t\telse\n\t\t\t@text_spa... | [
"0.70506966",
"0.6691053",
"0.64851415",
"0.6425493",
"0.6386166",
"0.6384698",
"0.6361993",
"0.6334083",
"0.61834985",
"0.6172775",
"0.61108565",
"0.6091501",
"0.6031858",
"0.5986525",
"0.59624445",
"0.59618413",
"0.59055173",
"0.59055173",
"0.5901512",
"0.5898759",
"0.58979... | 0.74133813 | 1 |
Move cursor to beginning position | def move_to_start
@cursor = 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cursor_move_to_beginning\n @cursor_position = 0\n self.reset_cursor_blinking\n end",
"def start_of_line\n self.cursor = 0\n end",
"def cursor_home\n @curpos = 0\n @pcol = 0\n set_col_offset 0\n end",
"def restore_cursor_position() set_cursor_position(@event[\"line\"], @event[\"co... | [
"0.90372145",
"0.7680856",
"0.76380837",
"0.7423694",
"0.7404973",
"0.7333849",
"0.72615844",
"0.7076191",
"0.68494636",
"0.6765013",
"0.6732365",
"0.67092586",
"0.670148",
"0.67000383",
"0.6645287",
"0.66056055",
"0.65798473",
"0.6557287",
"0.65467066",
"0.65226483",
"0.6501... | 0.8857556 | 2 |
Move cursor to end position | def move_to_end
@cursor = @text.length # put cursor outside of text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cursor_move_to_end\n @cursor_position = @text.scan(/./m).size\n self.reset_cursor_blinking\n end",
"def cursor_end\n blen = @buffer.rstrip.length\n if blen < @width\n set_col_offset blen\n else\n @pcol = blen-@width\n #set_form_col @width-1\n set_col_offset blen\n end\n... | [
"0.83602965",
"0.7586571",
"0.74854976",
"0.7378244",
"0.7369303",
"0.7369303",
"0.71118534",
"0.70679754",
"0.706377",
"0.68999934",
"0.68498147",
"0.68233556",
"0.67857116",
"0.66844904",
"0.6627413",
"0.65794903",
"0.6576182",
"0.6559504",
"0.654315",
"0.654315",
"0.649858... | 0.86068106 | 1 |
Insert characters inside a line. When the lines exceeds maximum length, an extra space is added to accomodate index. | def []=(i, chars)
edit_mode
if i.is_a?(Range)
@text[i] = chars
@cursor += chars.length
return
end
if i <= 0
before_text = ""
after_text = @text.dup
elsif i > @text.length - 1 # insert outside of line input
before_text ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_new_line(str, length)\n str.split(/\\r\\n|\\n/).map do |line|\n line.strip!\n if line.display_width < 1\n line\n else\n display_length = pastel.strip(line).display_width\n split_length = (line.length * length / display_length).to_i\n line.sca... | [
"0.6924924",
"0.6343138",
"0.62316877",
"0.62257",
"0.61498684",
"0.6105443",
"0.6084934",
"0.6021946",
"0.59873915",
"0.59785265",
"0.59774685",
"0.59393",
"0.5926488",
"0.5926488",
"0.59165114",
"0.5906234",
"0.5903009",
"0.58755773",
"0.58650917",
"0.5857922",
"0.58178914"... | 0.6265062 | 2 |
Find a word under the cursor based on a separator | def word(before: true)
start_pos = word_start_pos(before: before)
@text[start_pos..word_end_pos(from: start_pos)]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_word(lexical_item)\n \n end",
"def start_of_word; end",
"def find_word(word)\n chars = word.chars\n current = @root\n\n word_found =\n chars.all? { |c| current = current.children.find { |n| n.value == c } }\n yield word_found, current if block_given?\n\n current\n end",
... | [
"0.66967386",
"0.6268766",
"0.6260188",
"0.6157812",
"0.6078612",
"0.60154474",
"0.5968498",
"0.59597963",
"0.5917612",
"0.58788675",
"0.58640766",
"0.58354115",
"0.5828095",
"0.5827133",
"0.5808564",
"0.57764375",
"0.577251",
"0.57691973",
"0.5726228",
"0.5721767",
"0.570757... | 0.6018676 | 5 |
Find a word up to a cursor position | def word_to_complete(before: true)
@text[word_start_pos(before: before)...@cursor]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_next_word(word)\n @info.focus\n highlight_word word\n cursor = @info.index('insert')\n pos = @info.search_with_length(Regexp.new(Regexp::quote(word), Regexp::IGNORECASE), cursor + ' 1 chars')[0]\n if pos.empty?\n @app.status = 'Cannot find \"%s\"' % word\n else\n set_cursor(p... | [
"0.7630919",
"0.74698746",
"0.7115611",
"0.68204963",
"0.672618",
"0.6715377",
"0.663316",
"0.6618977",
"0.66138786",
"0.6602885",
"0.6592333",
"0.6539389",
"0.6536857",
"0.6466783",
"0.6434926",
"0.6413484",
"0.6359706",
"0.62761307",
"0.627352",
"0.6269409",
"0.62612116",
... | 0.7016268 | 3 |
Find word start position | def word_start_pos(from: @cursor, before: true)
# move back or forward by one character when at a word boundary
if word_boundary?
from = before ? from - 1 : from + 1
end
start_pos = @text.rindex(separator, from) || 0
start_pos += 1 unless start_pos.zero?
start_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_of_word; end",
"def get_word_start_marks(startpos, endpos)\n startpos = 0 if startpos < 0\n endpos = self.size if endpos > self.size\n search_str = self[(startpos)..(endpos)]\n return if search_str == nil\n wsmarks = scan_indexes(search_str, /(?<=[^\\p{Word}])\\p{Word}/)\n wsmarks = w... | [
"0.79639655",
"0.794543",
"0.7811137",
"0.7809796",
"0.7406703",
"0.736675",
"0.7365201",
"0.73170567",
"0.72733915",
"0.72618806",
"0.72594327",
"0.7176109",
"0.7151459",
"0.7126088",
"0.70654804",
"0.7009078",
"0.69519234",
"0.6939268",
"0.68588203",
"0.66920924",
"0.661935... | 0.78677005 | 2 |
Find word end position | def word_end_pos(from: @cursor)
end_pos = @text.index(separator, from) || text_size
end_pos -= 1 unless @text.empty?
end_pos
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_word_end_marks(startpos, endpos)\n startpos = 0 if startpos < 0\n endpos = self.size if endpos > self.size\n search_str = self[(startpos)..(endpos)]\n return if search_str == nil\n wsmarks = scan_indexes(search_str, /(?<=\\p{Word})[^\\p{Word}]/)\n wsmarks = wsmarks.collect { |x| x + start... | [
"0.8051949",
"0.72468334",
"0.69646055",
"0.68871605",
"0.68871605",
"0.68827516",
"0.66592264",
"0.66059357",
"0.6509227",
"0.6474669",
"0.6447217",
"0.6411035",
"0.63892615",
"0.6387776",
"0.63211006",
"0.62875485",
"0.6259961",
"0.6257138",
"0.6214424",
"0.620633",
"0.6205... | 0.8137827 | 0 |
Check if cursor is at a word boundary | def word_boundary?
@text[@cursor] =~ separator
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kill_word(*)\n first_non_letter = current_buffer.index(/\\P{L}/, current_buffer.point) || current_buffer.length\n word_beginning = current_buffer.index(/\\p{L}/, first_non_letter) || current_buffer.length\n current_buffer.slice!(current_buffer.point, word_beginning - current_buffer.point)\n true\nend",
"... | [
"0.6933785",
"0.68596804",
"0.65479267",
"0.649962",
"0.642309",
"0.62228703",
"0.61716413",
"0.6077603",
"0.6073976",
"0.6055554",
"0.60384846",
"0.6036075",
"0.60204405",
"0.60105",
"0.595366",
"0.5928068",
"0.5901927",
"0.589931",
"0.58692926",
"0.58623725",
"0.5844656",
... | 0.83600026 | 0 |
Replace current line with new text | def replace(text)
@text = text
@cursor = @text.length # put cursor outside of text
replace_mode
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_line(line)\n cursor = text_cursor\n\n cursor.position = document.character_count - 1\n cursor.set_position(@min_position, Qt::TextCursor::KeepAnchor)\n\n cursor.insert_text line\n\n change_cursor { |c| c.position = document.character_count - 1 }\n\n highlight\n end",
... | [
"0.7351338",
"0.72873205",
"0.7253665",
"0.6917317",
"0.68584263",
"0.68477976",
"0.68403596",
"0.677787",
"0.67285794",
"0.6721903",
"0.6719069",
"0.65736485",
"0.65728563",
"0.6519824",
"0.6364772",
"0.6353474",
"0.63391304",
"0.62678725",
"0.6195272",
"0.6189163",
"0.61741... | 0.6480826 | 14 |
Insert char(s) at cursor position | def insert(chars)
self[@cursor] = chars
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_text_at_cursor(text) \n\t\tinsert_text(@cursor_row, @cursor_col, text)\n\t\n\t\tif text.include?(\"\\n\")\n\t\t\t#todo what about multiple \\n's\n\t\t\t@cursor_row += 1\n\t\t\t@cursor_col = 0\n\t\t\t#resize_contents(500, line_num_to_coord(@text.num_lines + 1))\n\t\t\temit_changed(@cursor_row - 1)\n\t\te... | [
"0.7437797",
"0.73845625",
"0.7238568",
"0.7074957",
"0.7066532",
"0.7066532",
"0.70533097",
"0.69843286",
"0.69611996",
"0.696079",
"0.6900836",
"0.68509555",
"0.68423367",
"0.6803925",
"0.6782522",
"0.67403567",
"0.6737003",
"0.67316854",
"0.6689383",
"0.6656764",
"0.663481... | 0.8372321 | 1 |
Add char and move cursor | def <<(char)
@text << char
@cursor += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addchar(c)\n\t\tif @marked == false\n\t\t\tinsertchar(@row,@col,c.chr)\n\t\telse\n\t\t\tmark_row,row = ordered_mark_rows\n\t\t\tfor r in mark_row..row\n\t\t\t\tif (@text[r].length==0)&&((c==?\\s)||(c==?\\t)||(c==$ctrl_i)||(c==$space))\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tif @colmode\n\t\t\t\t\tsc = bc2sc(@row... | [
"0.773349",
"0.76097155",
"0.75604993",
"0.7406455",
"0.7337742",
"0.7337742",
"0.7162253",
"0.7120677",
"0.70025796",
"0.6882183",
"0.68393606",
"0.68128395",
"0.680921",
"0.6757931",
"0.6719769",
"0.67026335",
"0.6655635",
"0.6598169",
"0.6579466",
"0.6573344",
"0.64976734"... | 0.78086966 | 1 |
Remove char from the line at current position | def delete(n = 1)
@text.slice!(@cursor, n)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_character\n @lines = lines.delete_character(y, x - 1)\n\n left\n\n refresh\n end",
"def delete_current_character() \n\t\tif @selection_start != -1\n\t\t\tl1, i1 = index_line_and_col(@selection_start)\n\t\t\tl2, i2 = index_line_and_col(@selection_end)\n\t\t\tremove_range(l1, i... | [
"0.7693725",
"0.73353434",
"0.72940946",
"0.72331744",
"0.72178304",
"0.72178304",
"0.70530653",
"0.70322025",
"0.6868722",
"0.68396974",
"0.678642",
"0.6751325",
"0.6690322",
"0.6642023",
"0.6518534",
"0.6444047",
"0.64423627",
"0.64220184",
"0.637737",
"0.6353228",
"0.63517... | 0.5693559 | 62 |
Remove char from the line in front of the cursor | def remove(n = 1)
left(n)
@text.slice!(@cursor, n)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backspace() \n\t\t#todo\n\t\tif @cursor_col > 0\n\t\t\tline = line(@cursor_row)\n\t\t\tline[@cursor_col - 1.. @cursor_col - 1] = \"\"\n\t\t\tchange_line(@cursor_row, line)\n\t\t\t@cursor_col -= 1\n\t\t\temit_changed(@cursor_row)\n\t\tend\n\tend",
"def erase_line_to_beginning\n ConsoleGlitter.escape('1K'... | [
"0.7353186",
"0.73491454",
"0.72436076",
"0.70682317",
"0.69451594",
"0.6938481",
"0.6936227",
"0.67926145",
"0.67214596",
"0.666757",
"0.6662169",
"0.66544336",
"0.6628276",
"0.6620941",
"0.6601018",
"0.6598005",
"0.6570525",
"0.654563",
"0.64990133",
"0.6498707",
"0.6497806... | 0.0 | -1 |
Full line with prompt as string | def to_s
"#{@prompt}#{@text}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_prompt(line)\n if !line.nil?\n prompt = line\n else\n print '> '\n prompt = gets\n end\n prompt.split\n end",
"def prompt(text)\n @output += %(#{text}\\n)\n print text\n STDIN.gets\n end",
"def prompt(string)\n puts \">> #{string}\"\nend",
"def prompt(st... | [
"0.746729",
"0.7419892",
"0.725973",
"0.725973",
"0.725973",
"0.725973",
"0.725973",
"0.725973",
"0.72292644",
"0.7215414",
"0.72021055",
"0.7199315",
"0.7192142",
"0.7192131",
"0.7101591",
"0.70957494",
"0.7088353",
"0.70698947",
"0.7062375",
"0.7020618",
"0.7014027",
"0.6... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.