query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Create and enter a buffer with the given contents | def create_buffer(contents)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buffer; end",
"def buffer; end",
"def buffer; end",
"def buffer(str)\n IntelligentBuffer.new(str)\n end",
"def open_buffer(io, options = T.unsafe(nil)); end",
"def open_buffer\n @out_buffers ||= []\n @out_buffers.push(@out)\n @out = \"\"\n end",
"def assemble_buffer(direction, fun... | [
"0.64580494",
"0.64580494",
"0.64580494",
"0.645514",
"0.64307946",
"0.64214927",
"0.6373565",
"0.6305096",
"0.6261392",
"0.61619186",
"0.61504847",
"0.61288255",
"0.6116715",
"0.61000973",
"0.61000973",
"0.6060957",
"0.60351145",
"0.60163367",
"0.6001304",
"0.59913576",
"0.5... | 0.843908 | 0 |
Enter the given key sequence in the active buffer | def press(key_sequence)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(key)\n cmd = \"input keyevent #{map_key(key)};\"\n @sequence == \"\" ? @sequence = cmd : @sequence = @sequence + cmd\n end",
"def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\n end",
"def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\... | [
"0.69253063",
"0.68007314",
"0.68007314",
"0.66498524",
"0.6583793",
"0.6340866",
"0.6340866",
"0.6331402",
"0.63207793",
"0.63171494",
"0.6314997",
"0.62860566",
"0.62041444",
"0.6201621",
"0.6168597",
"0.6153032",
"0.614488",
"0.6143033",
"0.6119854",
"0.6077393",
"0.607020... | 0.76466894 | 0 |
Deletes all entries with keys matching the regular expression. The +matcher+ must be valid pattern for N1QL +REGEXP_MATCHES+ function. More info at Because the operation performed on query engine, and it might take time to propagate changes from key/value engine to the indexer. Therefore the keys, that were created a m... | def delete_matched(matcher, _options = nil)
pattern =
case matcher
when Regexp
matcher.inspect[1..-2]
when String
matcher.tr("?", ".").gsub("*", ".*")
else
raise NotImplementedError, "Unable to convert #{matcher.inspect} to Regexp patte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_matched(matcher, options = nil)\n options = merged_options(options)\n instrument(:delete_matched, matcher.inspect) do\n failsafe(:read_multi, returning: false) do\n matcher = key_matcher(matcher, options)\n begin\n with do |store|\n ... | [
"0.7052915",
"0.6985551",
"0.6913937",
"0.68575263",
"0.6547291",
"0.65195936",
"0.6311247",
"0.58905625",
"0.57763535",
"0.57760274",
"0.569831",
"0.5563897",
"0.5508622",
"0.5440013",
"0.53916997",
"0.52703464",
"0.5154937",
"0.5077251",
"0.5032267",
"0.50318426",
"0.500873... | 0.7410343 | 0 |
Clears the entire cache. Be careful with this method since it could affect other processes if shared cache is being used. When +use_flush+ option set to +true+ it will flush the bucket. Otherwise, it uses N1QL query and relies on default index. | def clear(use_flush: false, **_options)
failsafe(:clear) do
if use_flush
cluster.buckets.flush_bucket(@couchbase_options[:bucket_name])
else
operation_options = ::Couchbase::Options::Query.new
operation_options.consistent_with(::Couchbase::MutationState.ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_clear\n @client.flushall\n end",
"def clear\r\n @cache.flush\r\n end",
"def clear\n @cache.clear\n end",
"def clear\n cache.clear\n end",
"def clearQueryCache\r\n result = request(\"DELETE\", \"_api/query-cache\")\r\n return return_delete(result)\... | [
"0.7180498",
"0.67801994",
"0.6739185",
"0.668363",
"0.65690064",
"0.65552306",
"0.65313053",
"0.6516901",
"0.6507856",
"0.6496872",
"0.6467607",
"0.64550734",
"0.6424165",
"0.6414535",
"0.6414535",
"0.641091",
"0.641091",
"0.6392268",
"0.6362332",
"0.6361445",
"0.63609797",
... | 0.7751576 | 0 |
Deletes multiple entries in the cache. Returns the number of entries deleted. | def delete_multi_entries(entries, **_options)
return if entries.empty?
failsafe(:delete_multi_entries, returning: nil) do
successful = collection.remove_multi(entries).select(&:success?)
return 0 if successful.empty?
@last_mutation_token = successful.max_by { |r| r.mutati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_multi_entries(entries, **options)\n entries.count { |key| delete_entry(key, **options) }\n end",
"def delete!\n count = 0\n uniq.bulk_job { |e| count += 1; e.delete! }\n count\n end",
"def delete_entries(entries)\n delete_all(:id => entries)\n en... | [
"0.7474177",
"0.6824208",
"0.6674753",
"0.6643579",
"0.66373324",
"0.66033",
"0.65767527",
"0.6558294",
"0.6550996",
"0.6542089",
"0.63723123",
"0.6368551",
"0.6355705",
"0.6317323",
"0.624858",
"0.62176305",
"0.61805487",
"0.61711884",
"0.61625236",
"0.6123495",
"0.61027884"... | 0.73292744 | 1 |
Connects to the Couchbase cluster | def build_cluster
::Couchbase::Cluster.connect(
@couchbase_options[:connection_string],
::Couchbase::Options::Cluster(authenticator: ::Couchbase::PasswordAuthenticator.new(
@couchbase_options[:username], @couchbase_options[:password]
))
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_cassandra\n @client = Cql::Client.connect(hosts: ['localhost'])\n @client.use('oink')\nend",
"def connect\n @cluster.connect\n end",
"def connect_to_cassandra\n if @client\n @client.disconnect! rescue nil\n end\n @client = nil\n\n @cassandra_servers.ea... | [
"0.69977397",
"0.6931105",
"0.64401364",
"0.6336397",
"0.6302618",
"0.62917763",
"0.62834406",
"0.6269196",
"0.6245404",
"0.61693275",
"0.6110907",
"0.60501176",
"0.59861284",
"0.5985573",
"0.5923251",
"0.59085757",
"0.5895992",
"0.5877469",
"0.5876451",
"0.58695453",
"0.5846... | 0.76647305 | 0 |
Connects to the Couchbase cluster, opens specified bucket and returns collection object. | def build_collection
bucket = cluster.bucket(@couchbase_options[:bucket])
if @couchbase_options[:scope] && @couchbase_options[:collection]
bucket.scope(@couchbase_options[:scope]).collection(@couchbase_options[:collection])
else
bucket.default_collection
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_cluster\n ::Couchbase::Cluster.connect(\n @couchbase_options[:connection_string],\n ::Couchbase::Options::Cluster(authenticator: ::Couchbase::PasswordAuthenticator.new(\n @couchbase_options[:username], @couchbase_options[:password]\n ))\n )\n end",... | [
"0.5900005",
"0.5791184",
"0.5688879",
"0.55614185",
"0.5553416",
"0.5511002",
"0.543184",
"0.54155535",
"0.53867275",
"0.53394616",
"0.53394616",
"0.5237352",
"0.5195417",
"0.51768064",
"0.5157064",
"0.51562643",
"0.51496845",
"0.5148446",
"0.51438856",
"0.5143261",
"0.51256... | 0.6535918 | 0 |
Creates a MageeTextEdit param parent, name: The QWidget's parent and name | def initialize(parent = nil, name = nil)
super(parent, name)
viewport.set_w_flags(Qt::WNoAutoErase | Qt::WStaticContents)
set_static_background(true)
@invalid_rows = []
@model = TextModel.new()
@model.set_first_line_in_view_handler { first_line_in_view }
@model.set_last_line_in_view_handler { last_lin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_NewParent(value)\n set_input(\"NewParent\", value)\n end",
"def new_parent=(a_parent)\n @new_parent = a_parent\n end",
"def t(name, *args)\n field = JTextField.new *args\n field.name = name\n field\n end",
"def parent=(_arg0); end",
"def parent=(_arg0); end",
"def parent... | [
"0.5725541",
"0.566465",
"0.55839866",
"0.5578601",
"0.5578601",
"0.5578601",
"0.5578601",
"0.5578601",
"0.5421841",
"0.5369704",
"0.5368662",
"0.53488046",
"0.5293775",
"0.52565765",
"0.5227468",
"0.52261025",
"0.52227575",
"0.51928705",
"0.51928705",
"0.51874185",
"0.516187... | 0.59607655 | 0 |
Returns the display coordinate of line 'n' | def line_num_to_coord(n)
(n + 1) * font_metrics.height
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line(n)\n @lines[n]\n end",
"def line_number\n number[6..-1]\n end",
"def line_for_position(position); end",
"def line_for_position(position); end",
"def line_for_position(position); end",
"def line(number); end",
"def coord_to_line_num(y)\n\t\ty / font_metrics.height - 1\n\tend",
"de... | [
"0.70057374",
"0.698374",
"0.68126297",
"0.68126297",
"0.68126297",
"0.669584",
"0.6666673",
"0.6630187",
"0.65918994",
"0.6552892",
"0.654642",
"0.65192235",
"0.6505281",
"0.64988106",
"0.64967704",
"0.6445515",
"0.6402056",
"0.63383925",
"0.6314022",
"0.6314022",
"0.6314022... | 0.8330883 | 0 |
Returns the line number of the display ycoordinate 'y' | def coord_to_line_num(y)
y / font_metrics.height - 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gety\n (@lines[0...@str_idx].map(&:ymax).reduce(:+) || 0) + @str_y_idx - @start_y\n end",
"def gety\n (@lines[0...@str_idx].map(&:ymax).reduce(:+) || 0) + @str_y_idx - @start_y\n end",
"def row_at(y)\n return (((y.to_f - window.container.header_height.to_f) - @view.y_offset.to_f) / @... | [
"0.7560261",
"0.7560261",
"0.7400839",
"0.73583233",
"0.73583233",
"0.6976197",
"0.6957617",
"0.6895108",
"0.68886316",
"0.6864265",
"0.6864265",
"0.68411833",
"0.68350965",
"0.67754537",
"0.6716687",
"0.6647342",
"0.66415983",
"0.6626125",
"0.6626125",
"0.65804946",
"0.65545... | 0.83822256 | 0 |
Returns the line number of the last visible line | def last_line_in_view()
coord_to_line_num(contents_y + height)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visible_line_number\n return ROWS_MAX\n end",
"def visible_line_number\n return 1\n end",
"def visible_line_number\n return 1\n end",
"def visible_line_number\r\n return 5\r\n end",
"def visible_line_number\n return 4\n end",
"def visible_line_number\n return 4\n end",
"def ... | [
"0.8016296",
"0.78399557",
"0.78399557",
"0.78125125",
"0.7704984",
"0.7704984",
"0.7699743",
"0.7699743",
"0.7699743",
"0.7699743",
"0.76581144",
"0.75609624",
"0.74392617",
"0.73366356",
"0.7335133",
"0.7335133",
"0.7335133",
"0.7335133",
"0.7335133",
"0.7335133",
"0.733513... | 0.8150478 | 0 |
Returns the number of lines that are visible | def num_lines_in_view()
last_line_in_view() - first_line_in_view() + 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_lines() @line_indices.length + 1 end",
"def visible_line_number\n @ev_height\n end",
"def line_count\n\t\tlines.size\n\tend",
"def line_count\n\t\tlines.size\n\tend",
"def visible_line_number\r\n return 5\r\n end",
"def visible_line_number\n return 1\n end",
"def visible_line_number... | [
"0.7354008",
"0.7268611",
"0.7230812",
"0.7230812",
"0.7180098",
"0.7135837",
"0.7135837",
"0.6989307",
"0.6989307",
"0.6962526",
"0.6962526",
"0.6962526",
"0.6962526",
"0.694949",
"0.69361705",
"0.69325227",
"0.68812764",
"0.67878985",
"0.67862135",
"0.6758374",
"0.6754014",... | 0.7968226 | 0 |
Adds 'amount' to all line indices with a current value greater than or equal to 'threshold' | def adjust_line_indices_after(threshold, amount)
@line_indices.map! { |l| l >= threshold ? l + amount : l }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def threshold=(threshold)\n @threshold = threshold\n \n @threshold = 100 if threshold > 100\n @threshold = 1 if threshold < 1\n end",
"def relaxed_threshold(threshold)\n\t\tif threshold > @threshold_gap\n\t\t\trelaxed_threshold = threshold - @threshold_gap\n\t\telse\n\t\t\trelaxed_thresh... | [
"0.5497338",
"0.51628816",
"0.49867752",
"0.4970769",
"0.4927415",
"0.47238207",
"0.4689792",
"0.46662536",
"0.4647617",
"0.46465495",
"0.46371502",
"0.46313834",
"0.46305835",
"0.46239343",
"0.46220207",
"0.46083945",
"0.46038696",
"0.45898765",
"0.45389003",
"0.45345128",
"... | 0.85977507 | 0 |
Removes the line numbered 'line_num' | def remove_line(line_num)
if @line_indices == []
@text = ""
else
length = line_index(line_num + 1) - line_index(line_num)
@text[line_index(line_num) + 1 .. line_index(line_num + 1)] = ""
@line_indices.delete_at(line_num)
(line_num...@line_indices.length).each { |i| @line_indices[i] -= length }
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_at(line_number)\n self[line_number].delete\n super(line_number)\n update_line_numbers!\n end",
"def noteboard_delete(line_number)\n \n\n end",
"def remove_line(line)\n\t\t@lines.delete(line)\n\tend",
"def removeLine(lineNumber)\n \n\n\tlineNumber = lineNumber - 1\n\tnewQuestio... | [
"0.75238675",
"0.72559553",
"0.71756136",
"0.6893151",
"0.68463844",
"0.6694514",
"0.6635316",
"0.6474661",
"0.6412143",
"0.637273",
"0.6341321",
"0.63086516",
"0.6296507",
"0.62349516",
"0.6228228",
"0.6216985",
"0.61865336",
"0.61761105",
"0.6110079",
"0.60851204",
"0.60775... | 0.8547995 | 0 |
Removes from 'line_from', 'index_from' up to but not including 'line_to', 'index_to' | def remove_range(line_from, index_from, line_to, index_to)
ix1 = index_of_position(line_from, index_from)
ix2 = index_of_position(line_to, index_to)
@text[ix1 ... ix2] = ""
@line_indices.delete_if { |i| i.between?(ix1, ix2) }
adjust_line_indices_after(ix2, -(ix2 - ix1))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_preceding(node_or_range, size); end",
"def remove_line(line_num)\n\t\tif @line_indices == []\n\t\t\t@text = \"\"\n\t\telse\n\t\t\tlength = line_index(line_num + 1) - line_index(line_num)\n\t\t\t@text[line_index(line_num) + 1 .. line_index(line_num + 1)] = \"\"\n\t\t\t@line_indices.delete_at(line_num)\... | [
"0.62792844",
"0.6189214",
"0.6107818",
"0.61052537",
"0.61052537",
"0.61052537",
"0.61052537",
"0.61052537",
"0.61052537",
"0.61052537",
"0.61052537",
"0.6097464",
"0.6032891",
"0.59996",
"0.59461457",
"0.5907957",
"0.5883209",
"0.58761173",
"0.5823448",
"0.58043784",
"0.578... | 0.82596976 | 0 |
Gets text from 'line_from', 'index_from' up to but not including 'line_to', 'index_to' | def get_range(line_from, index_from, line_to, index_to)
ix1 = index_of_position(line_from, index_from)
ix2 = index_of_position(line_to, index_to)
@text[ix1 ... ix2]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_range(line_from, index_from, line_to, index_to) \n\t\tix1 = index_of_position(line_from, index_from)\n\t\tix2 = index_of_position(line_to, index_to)\n\t\t@text[ix1 ... ix2] = \"\"\n\t\t@line_indices.delete_if { |i| i.between?(ix1, ix2) }\n\t\tadjust_line_indices_after(ix2, -(ix2 - ix1))\n\tend",
"def ... | [
"0.74373615",
"0.69180185",
"0.68700963",
"0.66062117",
"0.6275667",
"0.6266768",
"0.61057496",
"0.61057496",
"0.61057496",
"0.6042144",
"0.5999725",
"0.59089905",
"0.58547854",
"0.5843117",
"0.5837925",
"0.582337",
"0.58171666",
"0.5802001",
"0.57992876",
"0.57536846",
"0.57... | 0.8064715 | 0 |
Inserts text 'text' at line 'line', before column 'col' | def insert_text(line, col, text)
index = index_of_position(line, col)
@text.insert(index, text)
i = 0
i += 1 while i < @line_indices.length and @line_indices[i] < index
(0...text.length).each do |c|
if text[c,1] == "\n"
@line_indices.insert(i, index + c)
i += 1
end
end
(i ... @line_indices.... | {
"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.7264024",
"0.6832584",
"0.6745029",
"0.66017145",
"0.6530093",
"0.63915396",
"0.6282005",
"0.6271797",
"0.62317735",
"0.61838007",
"0.6153853",
"0.614321",
"0.6102728",
"0.6093982",
"0.606195",
"0.60552585",
"0.60202473",
"0.600556",
"0.5996389",
"0.598623",
"0.59469384",
... | 0.84449697 | 0 |
Changes the text of line 'line_num' to 'text | def change_line(line_num, text)
raise "no newlines here yet please" if text =~ /\n/
ix1, ix2 = line_index(line_num) + 1, line_index(line_num + 1)
@text[ix1...ix2] = text
(line_num...@line_indices.length).each { |i| @line_indices[i] += text.length - (ix2 - ix1) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normal_line(text)\n end",
"def remove_line(line_num)\n\t\tif @line_indices == []\n\t\t\t@text = \"\"\n\t\telse\n\t\t\tlength = line_index(line_num + 1) - line_index(line_num)\n\t\t\t@text[line_index(line_num) + 1 .. line_index(line_num + 1)] = \"\"\n\t\t\t@line_indices.delete_at(line_num)\n\t\t\t(line_num... | [
"0.6719064",
"0.66787726",
"0.6625625",
"0.6545188",
"0.6476965",
"0.64592564",
"0.64402807",
"0.6407536",
"0.6332513",
"0.6291928",
"0.62585914",
"0.6197664",
"0.6172941",
"0.61715883",
"0.6155007",
"0.6151595",
"0.61308306",
"0.6128319",
"0.60884655",
"0.60676867",
"0.60272... | 0.8175392 | 0 |
Returns the line numbered 'num' (first line is 0) | def line(num) lines(num, 1) end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_index(num)\n\t\tif num == 0\n\t\t\treturn -1\n\t\telsif num <= @line_indices.length\n\t\t\treturn @line_indices[num - 1]\n\t\telsif num == @line_indices.length + 1\n\t\t\treturn @text.length\n\t\telse\n\t\t\treturn -999 # todo\n\t\tend \n\tend",
"def line_number\n number[6..-1]\n end",
"def line_n... | [
"0.84106016",
"0.79114735",
"0.77193195",
"0.77130175",
"0.76239145",
"0.75851053",
"0.75791425",
"0.7510495",
"0.7502307",
"0.7428788",
"0.71273696",
"0.7097533",
"0.704864",
"0.704864",
"0.704864",
"0.704864",
"0.704864",
"0.704864",
"0.704864",
"0.7036752",
"0.70050186",
... | 0.79931754 | 1 |
Returns 'num' lines starting from line 'start' | def lines(start, num)
@text[index_of_position(start)...index_of_position(start + num) - 1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take_lines(start_line, num_lines)\n start_idx =\n if start_line >= 0\n @lines.index { |loc| loc.lineno >= start_line } || @lines.length\n else\n [@lines.length + start_line, 0].max\n end\n\n alter do\n @lines = @lines.slice(start_idx, num_lines)\n en... | [
"0.72183967",
"0.71518797",
"0.6923758",
"0.6923758",
"0.67764974",
"0.6596829",
"0.6540667",
"0.6475989",
"0.64405864",
"0.6342851",
"0.6335547",
"0.6253575",
"0.62462795",
"0.62190163",
"0.620429",
"0.61829734",
"0.6128401",
"0.60797524",
"0.6043772",
"0.6015493",
"0.597166... | 0.79685843 | 0 |
Sets the cursor's position to 'row', 'col' | def set_cursor_position(row, col)
invalid_rows = [@cursor_row, row]
@cursor_row, @cursor_col = row, col
if @cursor_row < first_line_in_view
set_contents_pos(0, line_num_to_coord(@cursor_row))
emit_changed(nil)
elsif @cursor_row > last_line_in_view
set_contents_pos(0, line_num_to_coord(@cursor_row - num... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_cursor_position() set_cursor_position(@event[\"line\"], @event[\"column\"]) end",
"def set_position(row, col)\n if row.between?(0, 7) && col.between?(0, 7)\n @position[:row] = row\n\t @position[:col] = col\n\tend\n end",
"def cursor_home\n @curpos = 0\n @pcol = 0\n set_col_offset... | [
"0.76773417",
"0.7410794",
"0.7367086",
"0.72834444",
"0.7256796",
"0.723927",
"0.72136575",
"0.72136575",
"0.72136575",
"0.7210068",
"0.7180605",
"0.7059563",
"0.70543504",
"0.6995929",
"0.69584244",
"0.68167746",
"0.6764925",
"0.6745875",
"0.67443615",
"0.6712027",
"0.67118... | 0.83647645 | 0 |
Inserts text at the cursor's current position and updates cursor | def insert_text_at_cursor(text)
insert_text(@cursor_row, @cursor_col, text)
if text.include?("\n")
#todo what about multiple \n's
@cursor_row += 1
@cursor_col = 0
#resize_contents(500, line_num_to_coord(@text.num_lines + 1))
emit_changed(@cursor_row - 1)
else
@cursor_col += text.length
emi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_text_insertion pos, text\n add_command InsertionCommand.new(pos, text)\n end",
"def insert(text, at: caret)\n editable? and @native.insert_text(at.to_i, text.to_s, text.to_s.length)\n end",
"def insertText cursor, text\n if @fileContent.size == 1 and @fileContent[0] == \"\"\n ... | [
"0.78739834",
"0.7795639",
"0.7627861",
"0.75727004",
"0.72709006",
"0.72687006",
"0.72687006",
"0.72526455",
"0.7165091",
"0.7125943",
"0.70980746",
"0.70634115",
"0.70015275",
"0.6886459",
"0.6852852",
"0.6845627",
"0.6751516",
"0.6738957",
"0.67093945",
"0.66722345",
"0.66... | 0.8378789 | 0 |
Deletes the character before the cursor (like pressing backspace) | def backspace()
#todo
if @cursor_col > 0
line = line(@cursor_row)
line[@cursor_col - 1.. @cursor_col - 1] = ""
change_line(@cursor_row, line)
@cursor_col -= 1
emit_changed(@cursor_row)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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, i1, l2, i2)\n\t\t\tclear_selection\n\t\t\temit_changed((l1...num_lines)) #todo\n\t\telse\n\t\t\tline = line(@cursor_row)\n\t... | [
"0.7839138",
"0.76375204",
"0.7370505",
"0.7297016",
"0.72069186",
"0.7041504",
"0.6990519",
"0.69695044",
"0.69440466",
"0.6920794",
"0.68249846",
"0.6771089",
"0.6688815",
"0.6669755",
"0.6600718",
"0.6580403",
"0.6573684",
"0.65690404",
"0.6564683",
"0.6563899",
"0.6563899... | 0.7675729 | 1 |
Deletes the character at the cursor (like pressing delete) | def delete_current_character()
if @selection_start != -1
l1, i1 = index_line_and_col(@selection_start)
l2, i2 = index_line_and_col(@selection_end)
remove_range(l1, i1, l2, i2)
clear_selection
emit_changed((l1...num_lines)) #todo
else
line = line(@cursor_row)
line[@cursor_col.. @cursor_col] = "... | {
"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 editor_delete_character!\n Vedeu.bind(:_editor_delete_character_) do |name|\n Vedeu.documents.by_name(name).delete_character\n end\n end",
"def delete_charact... | [
"0.80851126",
"0.77552146",
"0.74847394",
"0.74847394",
"0.7448047",
"0.7275868",
"0.7258426",
"0.69643384",
"0.69332397",
"0.6917795",
"0.68581516",
"0.67701685",
"0.65531725",
"0.6525773",
"0.6491013",
"0.64766586",
"0.64537454",
"0.6432829",
"0.62588584",
"0.6229734",
"0.6... | 0.82607466 | 0 |
Highlights all instances of 'pattern' in the text | def highlight(pattern)
pattern = Regexp.new(pattern) if pattern.is_a?(String)
@highlights = [[0, Qt::black]] # todo factor this
invalid_rows = []
(0...num_lines).each do |index|
line = line(index)
if line =~ pattern
#todo
#@highlights << HighlightData.new(index, $~.begin(0), index, $~.end(0), Qt::... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def highlight(keywords, replacement_pattern)\n s = self.clone\n keywords.each do|kw|\n r = replacement_pattern.is_a?(Array) ? \"#{replacement_pattern.first}\\\\1#{replacement_pattern}\" : replacement_pattern\n s.gsub!(/(#{kw})/i, replacement_pattern)\n end\n s\n end",
"def highlight(keywor... | [
"0.7007881",
"0.6570006",
"0.6157934",
"0.61531353",
"0.61190563",
"0.6077356",
"0.60678107",
"0.601119",
"0.601119",
"0.601119",
"0.5939517",
"0.5928957",
"0.5888052",
"0.58456266",
"0.584248",
"0.58179927",
"0.57969415",
"0.5784149",
"0.57815874",
"0.5753481",
"0.57060385",... | 0.7619761 | 0 |
GET /api/v1/poll_responses GET /api/v1/poll_responses.json | def index
@api_v1_poll_responses = Api::V1::PollResponse.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_api_v1_poll_response\n @api_v1_poll_response = Api::V1::PollResponse.find(params[:id])\n end",
"def api_v1_poll_response_params\n params.fetch(:api_v1_poll_response, {})\n end",
"def respond\n\t\t@poll = Poll.find(params[:id])\n\t\t@expert_user = @poll.expert_user\n\t\t@participants = @... | [
"0.6578214",
"0.6476995",
"0.6418129",
"0.6399645",
"0.6371288",
"0.6334123",
"0.62478423",
"0.623384",
"0.6232368",
"0.61980903",
"0.6183851",
"0.61230755",
"0.60523313",
"0.60523313",
"0.60523313",
"0.60523313",
"0.60523313",
"0.6037501",
"0.600481",
"0.5996631",
"0.5953638... | 0.7910411 | 0 |
POST /api/v1/poll_responses POST /api/v1/poll_responses.json | def create
@api_v1_poll_response = Api::V1::PollResponse.new(api_v1_poll_response_params)
respond_to do |format|
if @api_v1_poll_response.save
format.html { redirect_to @api_v1_poll_response, notice: 'Poll response was successfully created.' }
format.json { render :show, status: :created,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @api_v1_poll_responses = Api::V1::PollResponse.all\n end",
"def create_single_poll(polls__question__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :polls__question__,\n :polls__description__,\n \n ]\n\n # verify existence of ... | [
"0.65801",
"0.62844723",
"0.60589164",
"0.6054359",
"0.6022208",
"0.59708434",
"0.59641784",
"0.5954258",
"0.5930939",
"0.5907393",
"0.59044474",
"0.5894023",
"0.5887609",
"0.58723444",
"0.58723444",
"0.580967",
"0.5809335",
"0.5786081",
"0.5779321",
"0.57725215",
"0.5757535"... | 0.70459193 | 0 |
PATCH/PUT /api/v1/poll_responses/1 PATCH/PUT /api/v1/poll_responses/1.json | def update
respond_to do |format|
if @api_v1_poll_response.update(api_v1_poll_response_params)
format.html { redirect_to @api_v1_poll_response, notice: 'Poll response was successfully updated.' }
format.json { render :show, status: :ok, location: @api_v1_poll_response }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_single_poll(id,polls__question__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :polls__question__,\n :polls__description__,\n \n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n raise \"polls__que... | [
"0.7025279",
"0.6797401",
"0.6657104",
"0.66203606",
"0.6583832",
"0.65541863",
"0.65541863",
"0.65536416",
"0.65536416",
"0.65536416",
"0.65229535",
"0.651808",
"0.64875567",
"0.6375086",
"0.63611084",
"0.63481206",
"0.63475144",
"0.6321016",
"0.63069594",
"0.6281272",
"0.62... | 0.70790887 | 0 |
DELETE /api/v1/poll_responses/1 DELETE /api/v1/poll_responses/1.json | def destroy
@api_v1_poll_response.destroy
respond_to do |format|
format.html { redirect_to api_v1_poll_responses_url, notice: 'Poll response was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @poll.destroy\n respond_to do |format|\n format.html { redirect_to polls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @poll.destroy\n respond_to do |format|\n format.html { redirect_to polls_url }\n format.json { head :no_content }\n e... | [
"0.7354495",
"0.7354495",
"0.7306613",
"0.7278086",
"0.72066855",
"0.7093404",
"0.7093404",
"0.7093404",
"0.7093404",
"0.70714635",
"0.7058218",
"0.7054363",
"0.70266366",
"0.697133",
"0.69615406",
"0.69369197",
"0.69322777",
"0.68988866",
"0.6846993",
"0.6840946",
"0.6832440... | 0.78573734 | 0 |
the folder at the root of the task scheduler | def root_folder
scheduler_service.GetFolder("\\")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cron_dot_d_directory\n end",
"def work_dir; end",
"def tasks_directory\n @cached_paths[:tasks_directory] ||= look_up_configured_path(\n :tasks_directory,\n :defaults => ['tasks']\n )\n end",
"def job_folder\n File.join(Session.current.root, job_key)\n end",
"def fold... | [
"0.7591735",
"0.71050394",
"0.6866237",
"0.66214055",
"0.6530276",
"0.64892966",
"0.647909",
"0.6475342",
"0.6454152",
"0.6454152",
"0.64404106",
"0.64137673",
"0.640872",
"0.6389779",
"0.63563234",
"0.6304272",
"0.6293728",
"0.62719685",
"0.62634647",
"0.6256626",
"0.6245746... | 0.82323426 | 0 |
Load a local profile return the SharedCredentials object or nil | def loadProfile(profile=nil)
# CAUTION: We are returning if profile is nil because otherwise AWS will try to use "Default" profile
return nil if profile.nil?
begin #ruby syntax equivalant to try
# Read the credentials from the given profile
credentials = Aws::SharedCredentials.new(profile_name: profile)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(profile='default')\n raise 'Config File does not exist' unless File.exists?(@file)\n\n @credentials = parse if @credentials.nil?\n raise 'The profile is not specified in the config file' unless @credentials.has_key?(profile)\n\n @credentials[profile]\n end",
"def load_profile(cred_... | [
"0.6701693",
"0.66836864",
"0.6428481",
"0.62075835",
"0.61399734",
"0.61399734",
"0.6092536",
"0.6067304",
"0.5955669",
"0.5914697",
"0.58984035",
"0.5882444",
"0.58014727",
"0.5735554",
"0.573396",
"0.5713375",
"0.569041",
"0.5667331",
"0.565998",
"0.56544197",
"0.5646244",... | 0.69604754 | 0 |
helper function to return a new RDS client | def createRDSClient(region,credentials)
begin
return Aws::RDS::Client.new(region: region,credentials: credentials)
rescue Exception => e
puts "\e[31mCould not create new RDS client."
puts "#{e.message}\e[0m"
exit 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_dbconnection_instance(schezer)\n schezer.instance_eval do\n return @conn.dup\n end\n end",
"def new_connection(params)\n Pod4.logger.info(__FILE__){ \"Connecting to DB\" }\n client = TinyTds::Client.new(params)\n raise \"Bad Connection\" unless client.active?\n\n ... | [
"0.652982",
"0.64181215",
"0.63795197",
"0.63029474",
"0.6295826",
"0.6175796",
"0.61746156",
"0.6149308",
"0.61289483",
"0.6127377",
"0.6092965",
"0.603337",
"0.6030865",
"0.6028998",
"0.59967816",
"0.59921783",
"0.59913766",
"0.59859556",
"0.59725523",
"0.59002686",
"0.5895... | 0.73701465 | 0 |
helper function to return a new EC2 client | def createEC2Client(region,credentials)
begin
return Aws::EC2::Client.new(region: region,credentials: credentials)
rescue Exception => e
puts "\e[31mCould not create new EC2 client"
puts "#{e.message}\e[0m"
exit 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ec2_client(region)\n begin\n client = Aws::EC2::Client.new(region: region)\n rescue => e\n puts e\n exit\n end\nend",
"def ec2\n @ec2 ||= EC2::Base.new(:access_key_id => \"not a key\", :secret_access_key => \"not a key\")\n end",
"def ec2\n Fog::Compute::AWS.new(aws_access_key_id: @a... | [
"0.7484934",
"0.72039455",
"0.70676994",
"0.7025927",
"0.6948722",
"0.6874134",
"0.6756482",
"0.6730758",
"0.6627768",
"0.64340407",
"0.6351552",
"0.63447094",
"0.6336146",
"0.6331109",
"0.6328699",
"0.6328699",
"0.62763655",
"0.6245043",
"0.6204581",
"0.61604345",
"0.6118997... | 0.76579565 | 0 |
Helper function to create a snapshot of an EBS volume | def createEBSSnapshot(client=nil,description='',volume_id=nil)
return false if volume_id.nil? || client.nil?
# Fetch the Volume Name. This will be used in the description of the snapshot
resp = client.describe_volumes({dry_run: false, volume_ids: [volume_id] })
resp.volumes[0].tags.each do |t|
if t.key=='Na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_from_snap(last_snapshot, options = {})\n options[:device] = \"/dev/sdk\" unless options[:device]\n options[:vol_nickname] = last_snapshot[\"nickname\"] unless options[:vol_nickname]\n \n # 5 - Unmount and detach the current EBS volume (forcing to detach the device we're gonna need l... | [
"0.74545485",
"0.7209719",
"0.71685785",
"0.7164354",
"0.714413",
"0.712002",
"0.6957206",
"0.695592",
"0.69027597",
"0.6816179",
"0.6758193",
"0.6449254",
"0.6442236",
"0.64248896",
"0.6421977",
"0.6413579",
"0.6410388",
"0.6377427",
"0.63687897",
"0.6337966",
"0.62960404",
... | 0.7775452 | 0 |
helper function to create RDS Snapshots return the response on success, otherwise false. | def createRDSSnapshot(client=nil,db_instance=nil,snapshot_name=nil,tags=[])
return false if db_instance.nil? || client.nil?
if snapshot_name.nil?
snapshot_name="#{db_instance}-#{Time.now.to_i}"
end
unless tags.instance_of? Array
puts "\e[31mtags must be an Array\e[0m"
return false
end
begin
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_snapshot(rds_resource, db_instance_name)\n id = \"snapshot-#{rand(10**6)}\"\n db_instance = rds_resource.db_instance(db_instance_name)\n db_instance.create_snapshot({\n db_snapshot_identifier: id\n })\nrescue Aws::Errors::ServiceError => e\n... | [
"0.6959942",
"0.67721385",
"0.65424186",
"0.6512461",
"0.64462155",
"0.64253855",
"0.63869953",
"0.6346291",
"0.63259506",
"0.60574883",
"0.6020189",
"0.6013806",
"0.5990513",
"0.58852404",
"0.5823208",
"0.57886815",
"0.5770304",
"0.57429475",
"0.5702567",
"0.5682292",
"0.560... | 0.7413599 | 0 |
GET /discipline_sections GET /discipline_sections.json | def index
@discipline_sections = DisciplineSection.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def get_sections (subdomain,course_id)\n token = get_token\n courses = get_al... | [
"0.6833717",
"0.67551106",
"0.6714686",
"0.6649415",
"0.6637861",
"0.6535805",
"0.6535805",
"0.65237075",
"0.6502826",
"0.64867806",
"0.6430026",
"0.6425808",
"0.6383433",
"0.6356851",
"0.6354435",
"0.6317796",
"0.63121754",
"0.6298093",
"0.62769955",
"0.6209616",
"0.62046283... | 0.7759907 | 0 |
POST /discipline_sections POST /discipline_sections.json | def create
@discipline_section = DisciplineSection.new(discipline_section_params)
respond_to do |format|
if @discipline_section.save
#format.html { redirect_to @discipline_section, notice: 'Discipline section was successfully created.' }
#format.json { render :show, status: :created, locat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @discipline_sections = DisciplineSection.all\n end",
"def set_discipline_section\n @discipline_section = DisciplineSection.find(params[:id])\n end",
"def create\n @section = Section.new(params[:section])\n\n Course.find(params[:section][:add_section]).sections << @section if param... | [
"0.6858734",
"0.66750294",
"0.6632172",
"0.6621222",
"0.6584435",
"0.651913",
"0.6359858",
"0.62716115",
"0.62380826",
"0.62144756",
"0.620074",
"0.6187932",
"0.6124004",
"0.6103947",
"0.6091024",
"0.6054053",
"0.60031754",
"0.5955929",
"0.59447634",
"0.5942246",
"0.5941796",... | 0.70951676 | 0 |
PATCH/PUT /discipline_sections/1 PATCH/PUT /discipline_sections/1.json | def update
respond_to do |format|
if @discipline_section.update(discipline_section_params)
format.html { redirect_to @discipline_section, notice: 'Раздел дисциплины был успешно обновлен' }
format.json { render :show, status: :ok, location: @discipline_section }
else
format.html {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\nlogger.debug \"update discipline: \"+@discipline.inspect\n discipline_params.each_pair do |property,value|\n @discipline.send(property+'=',value)if @discipline.respond_to?(property+'=')\n end\n @discipline.updater_id = current_user\n if @discipline.save\n s... | [
"0.7019297",
"0.6986113",
"0.68933535",
"0.6844664",
"0.6844664",
"0.67145896",
"0.670726",
"0.65858907",
"0.65282524",
"0.63720644",
"0.63639146",
"0.6342503",
"0.63086236",
"0.6301386",
"0.6289386",
"0.62810093",
"0.6272424",
"0.626786",
"0.62410516",
"0.6239754",
"0.623741... | 0.711616 | 0 |
Delete bean from scope | def delete_bean(bean_metadata)
RequestStore.store[:_iocrb_beans].delete(bean_metadata.name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_bean(bean_metadata)\n @beans.delete(bean_metadata.name)\n end",
"def delete(connection)\n connection.delete_engine(@id, @scope)\n end",
"def destroy; delete end",
"def del\n delete\n end",
"def _destroy_delete\n delete\n end",
"def _destroy_delete\n delet... | [
"0.6948997",
"0.61377937",
"0.60326993",
"0.60160136",
"0.60052586",
"0.60052586",
"0.5998532",
"0.59936553",
"0.5950794",
"0.58859587",
"0.5831397",
"0.58312243",
"0.58312243",
"0.58285487",
"0.5824112",
"0.58174294",
"0.58138067",
"0.5801735",
"0.5779715",
"0.5778879",
"0.5... | 0.7090844 | 0 |
Fetch our current inheritable settings, which are inherited by nested scopes but not shared across siblings. | def inheritable_setting
@inheritable_setting ||= Grape::Util::InheritableSetting.new.tap { |new_settings| new_settings.inherit_from top_level_setting }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inheritable_settings\n return @inheritable_settings\n end",
"def settings\n @scope.settings\n end",
"def inheritable_settings=(value)\n @inheritable_settings = value\n end",
"def compute_effective_settings\n execution_context.inject({})... | [
"0.8205748",
"0.67785126",
"0.6500825",
"0.64961547",
"0.6437371",
"0.6434576",
"0.64129734",
"0.63033265",
"0.61839736",
"0.6166299",
"0.6158082",
"0.6036863",
"0.5952977",
"0.590812",
"0.58808297",
"0.58739185",
"0.58702785",
"0.58688277",
"0.5860874",
"0.58515215",
"0.5849... | 0.7279893 | 1 |
Fork our inheritable settings to a new instance, copied from our parent's, but separate so we won't modify it. Every call to this method should have an answering call to namespace_end. | def namespace_start
@inheritable_setting = Grape::Util::InheritableSetting.new.tap { |new_settings| new_settings.inherit_from inheritable_setting }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_copy( original )\n\t\t@settings = original.settings.dup\n\t\t@overridden_settings = {}\n\tend",
"def update_descendant_settings\n return if changed_setting_attributes.nil? && settings_inheritance == :none\n\n case settings_inheritance\n when :merge\n merge_descendant_settings\n wh... | [
"0.6501519",
"0.611109",
"0.60726625",
"0.5822752",
"0.5822752",
"0.57910305",
"0.57194155",
"0.5694648",
"0.563503",
"0.56314284",
"0.56116605",
"0.5607835",
"0.55847454",
"0.55847454",
"0.5568596",
"0.5560046",
"0.55238324",
"0.5497667",
"0.547759",
"0.5459084",
"0.5447626"... | 0.7305435 | 0 |
Builds the current class :inheritable_setting. If available, it inherits from the superclass's :inheritable_setting. | def build_top_level_setting
Grape::Util::InheritableSetting.new.tap do |setting|
# Doesn't try to inherit settings from +Grape::API::Instance+ which also responds to
# +inheritable_setting+, however, it doesn't contain any user-defined settings.
# Otherwise, it would lead to an ext... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inheritable_setting\n @inheritable_setting ||= Grape::Util::InheritableSetting.new.tap { |new_settings| new_settings.inherit_from top_level_setting }\n end",
"def inheritable_settings\n return @inheritable_settings\n end",
"def inheritable_settings=(value)\n ... | [
"0.7957203",
"0.7130535",
"0.6866926",
"0.62060326",
"0.60595685",
"0.5905518",
"0.57345766",
"0.56353176",
"0.562738",
"0.55533844",
"0.554984",
"0.5530771",
"0.5474511",
"0.5354502",
"0.5298053",
"0.519122",
"0.51908803",
"0.5186303",
"0.5158098",
"0.5152635",
"0.5135044",
... | 0.7307081 | 1 |
Generates the RBS lines for this method. | def generate_rbs(indent_level, options)
definition = "def #{class_method ? 'self.' : ''}#{name}: "
lines = generate_comments(indent_level, options)
# Handle each signature
signatures.each.with_index do |sig, i|
this_sig_lines = []
# Start off the first line of the s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ruling_lines\n get_ruling_lines!\n end",
"def get_ruling_lines!\n self.get_rulings\n end",
"def generate\n end",
"def generate; end",
"def generate; end",
"def generate()\n\t\t\t@out = []\n\t\t\t@context = []\n\n\t\t\ttrim_nil_lines\n\n\t\t\t@lines.each_with_index do |line, i|\n\t\t\t\... | [
"0.6484955",
"0.64685106",
"0.58297396",
"0.57131875",
"0.57131875",
"0.5706199",
"0.55833036",
"0.55117637",
"0.5476175",
"0.54385424",
"0.5436468",
"0.5436468",
"0.5375646",
"0.5360394",
"0.53524673",
"0.5348188",
"0.53149784",
"0.53030133",
"0.5284046",
"0.52635384",
"0.52... | 0.65714455 | 0 |
This object's stroke alpha value | def stroke_alpha
dsl&.stroke&.alpha
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stroke_alpha\n dsl.stroke.alpha if dsl.stroke\n end",
"def alpha\n (rgba & 0x7F000000) >> 24\n end",
"def alpha(val=1.0)\n CGContextSetAlpha(@ctx, val)\n end",
"def alpha(value=nil)\n if !value.nil?\n value = value.alpha if value.is_a?(Sketchup::Color)\n r, g,... | [
"0.84100735",
"0.69870126",
"0.69254094",
"0.6897213",
"0.6622687",
"0.661469",
"0.64578193",
"0.64360726",
"0.63820887",
"0.633589",
"0.6205916",
"0.62009454",
"0.6080869",
"0.6026569",
"0.60219085",
"0.6017503",
"0.5967396",
"0.59634334",
"0.59552765",
"0.59451765",
"0.5942... | 0.8266243 | 1 |
GET /question_option_selections GET /question_option_selections.json | def index
@question_option_selections = @question_answer.question_option_selections
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @selections = Selection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @selections }\n end\n end",
"def get_choices\n @choices = CONNECTION.execute(\"SELECT * FROM choices WHERE question_id = #{@id};\")\n end",
"def index\n @opt... | [
"0.66065097",
"0.6558567",
"0.65470684",
"0.64444864",
"0.6403623",
"0.63972723",
"0.6378797",
"0.63696617",
"0.634588",
"0.63029164",
"0.62848073",
"0.6263732",
"0.62483597",
"0.6207424",
"0.6025557",
"0.602436",
"0.60094285",
"0.5992142",
"0.5974422",
"0.59623593",
"0.59602... | 0.769497 | 0 |
POST /question_option_selections POST /question_option_selections.json | def create
@question_option_selection = @question_answer.question_option_selection.build(question_option_selection_params)
respond_to do |format|
if @question_option_selection.save
format.html { redirect_to @question_answer_question_option_selection_path(@question_answer), notice: 'Question optio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @question_option_selections = @question_answer.question_option_selections\n end",
"def question_option_selection_params\n params.require(:question_option_selection).permit(:question_answer_id, :question_option_id)\n end",
"def add_option\n render json: Option.create_default_optio... | [
"0.67875326",
"0.6616982",
"0.65738964",
"0.6385959",
"0.63539124",
"0.6280465",
"0.61634994",
"0.6126046",
"0.61236984",
"0.6051213",
"0.60421056",
"0.6003916",
"0.59900224",
"0.5978536",
"0.5971318",
"0.59675455",
"0.59316427",
"0.5918343",
"0.59085405",
"0.5874556",
"0.586... | 0.6865646 | 0 |
PATCH/PUT /question_option_selections/1 PATCH/PUT /question_option_selections/1.json | def update
respond_to do |format|
if @question_option_selection.update(question_option_selection_params)
format.html { redirect_to @question_answer_question_option_selection_path(@question_answer), notice: 'Question option selection was successfully updated.' }
format.json { render :show, stat... | {
"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 @questions_option = QuestionsOption.find(params[:id])\n\n respond_to do |format|\n if... | [
"0.72698116",
"0.70224434",
"0.6931022",
"0.6925986",
"0.67867243",
"0.6774947",
"0.67558545",
"0.6726432",
"0.67178553",
"0.65660477",
"0.6469441",
"0.6468809",
"0.64565307",
"0.6449378",
"0.6439106",
"0.6426784",
"0.6392963",
"0.6388309",
"0.6382278",
"0.63695186",
"0.63202... | 0.70291024 | 1 |
Encodes a list of traces in chunks. Before serializing, all traces are normalized. Trace nesting is not changed. | def encode_in_chunks(traces)
encoded_traces = if traces.respond_to?(:filter_map)
# DEV Supported since Ruby 2.7, saves an intermediate object creation
traces.filter_map { |t| encode_one(t) }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_traces(traces)\n to_send = []\n traces.each do |trace|\n to_send << trace.map(&:to_hash)\n end\n encode(to_send)\n end",
"def batch(requests)\n data = requests.map { |request| Request.new(*request).data }\n RPC.log \"CLIENT ENCODE BATCH #{dat... | [
"0.6498665",
"0.5217285",
"0.4876195",
"0.48170498",
"0.47569302",
"0.47521403",
"0.46824327",
"0.4678066",
"0.46687075",
"0.46402425",
"0.46326843",
"0.460194",
"0.4559601",
"0.4554241",
"0.45117408",
"0.44863996",
"0.44578606",
"0.44557407",
"0.44481462",
"0.44431496",
"0.4... | 0.7816375 | 0 |
The alphabet is a series of characters used to create the bijection E.g: "wrdcuyjpbiflaqzesgmhvtknxo" The booster is used to avoid generating sequences that are too short E.g: If booster is zero then encoding an id close to zero will produce only one character. If you want a minimum of three then you should set your bo... | def initialize(alphabet, booster = 0)
raise ArgumentError, "You must provide an alphabet" if alphabet.blank?
@alphabet = alphabet
@booster = booster
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode(number)\n i = number + @booster\n return @alphabet[0] if i == 0\n s = StringIO.new\n base = @alphabet.length\n while i > 0\n s << @alphabet[i.modulo(base)]\n i /= base\n end\n s.string.reverse\n end",
"def bijective_encode\n \t# from http://refactormycode.com/codes/124... | [
"0.6529132",
"0.6510735",
"0.6432002",
"0.6418563",
"0.6315762",
"0.63018644",
"0.6275429",
"0.6214931",
"0.6181105",
"0.6165188",
"0.608075",
"0.60632944",
"0.6007543",
"0.5968244",
"0.5968244",
"0.5946893",
"0.5932772",
"0.59119284",
"0.5905748",
"0.58660555",
"0.58632106",... | 0.6587932 | 0 |
Transform an integer into a unique string using the engine alphabet and booster | def encode(number)
i = number + @booster
return @alphabet[0] if i == 0
s = StringIO.new
base = @alphabet.length
while i > 0
s << @alphabet[i.modulo(base)]
i /= base
end
s.string.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def obfuscate_id_default_spin\n alphabet = Array(\"a\"..\"z\")\n number = name.split(\"\").collect do |char|\n alphabet.index(char)\n end\n\n number.shift(12).join.to_i\n end",
"def id_to_code(id)\n (id.to_i * factor + pad).to_s(26).tr('0-9a-p', 'a-z')\n end",
"def bijecti... | [
"0.6958512",
"0.6827479",
"0.67895436",
"0.6759214",
"0.6696846",
"0.6667088",
"0.66527086",
"0.66306525",
"0.6624921",
"0.66217595",
"0.6428974",
"0.6424408",
"0.6417241",
"0.6383967",
"0.6349206",
"0.6348904",
"0.6312951",
"0.630796",
"0.63047916",
"0.6278765",
"0.62694585"... | 0.7293493 | 0 |
load xml rules as a string | def load_xml_rules_as_string( str )
begin
doc = REXML::Document.new str
doc.elements.each( "rule-set") { |rs|
facts = rs.elements.each( "facts") { |f|
facts( f.attributes["name"] ) do f.text.strip end
}
rules = rs.elements.each( "rule"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_rb_rules_as_string( str )\r\n instance_eval(str) \r\n end",
"def load_xml( fileName )\r\n begin\r\n str = IO.read(fileName)\r\n load_xml_rules_as_string(str)\r\n rescue Exception => e\r\n raise RuleLoadingError, \"loading xml file\"\r\n end\r\n end",
"... | [
"0.6614879",
"0.6465752",
"0.62848926",
"0.5847496",
"0.58037853",
"0.57882994",
"0.5785168",
"0.5785168",
"0.57822543",
"0.5594589",
"0.55761635",
"0.553359",
"0.55334383",
"0.5523808",
"0.5498931",
"0.54329294",
"0.5421628",
"0.5413334",
"0.5360488",
"0.5326475",
"0.5317063... | 0.8187123 | 0 |
load ruby rules as a string | def load_rb_rules_as_string( str )
instance_eval(str)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_rules; end",
"def load_cop_rules(rules); end",
"def load_rb( file )\r\n begin\r\n str = IO.read(file)\r\n load_rb_rules_as_string(str)\r\n rescue Exception => e\r\n raise RuleLoadingError, \"loading ruby file\"\r\n end\r\n end",
"def load_rules(rules)\n se... | [
"0.71179456",
"0.6813576",
"0.67687064",
"0.6730322",
"0.64818746",
"0.64786035",
"0.6327589",
"0.6291419",
"0.62018955",
"0.6122252",
"0.60696495",
"0.60696495",
"0.5879198",
"0.57756126",
"0.5710738",
"0.56699216",
"0.5638297",
"0.5631757",
"0.56191456",
"0.56005305",
"0.55... | 0.7973769 | 0 |
returns an array of facts | def get_facts
@facts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facts\n @facts ||= {}\n end",
"def list\n load_all\n return @facts.keys\n end",
"def list\n load_all\n @facts.keys\n end",
"def all_facts\n @facts.values.collect { |property_facts| property_facts.values }.flatten\n end",
"def facts_for(entity, property)\n ... | [
"0.7494817",
"0.7268276",
"0.7104335",
"0.7043786",
"0.67014706",
"0.66596556",
"0.6551511",
"0.6504118",
"0.63914436",
"0.6369102",
"0.62914336",
"0.62493324",
"0.61840606",
"0.6106346",
"0.60129654",
"0.60018766",
"0.5938833",
"0.5759471",
"0.57307464",
"0.57307464",
"0.570... | 0.77920645 | 0 |
A single fact can be an single object of a particular class type or a collection of objects of a particular type | def fact( obj )
#begin
# check if facts already exist for that class
# if so, we need to add it to the existing list
cls = obj.class.to_s.downcase
cls.gsub!(/:/, '_')
if @facts.key? cls
logger.debug( "adding to facts: #{cls}") if logger
@facts[cl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fact_class\r\n owning_class\r\n end",
"def fact_class\n cube.class.fact_class\n end",
"def extract_feature_object_types(doc, feature)\n # Tie this feature to a FeatureObjectType and through it an ObjectType\n admin_thesaurus_term = doc.at(\"/feature/fheader/fclass\")['term']\n... | [
"0.61535436",
"0.6050221",
"0.57339996",
"0.5546405",
"0.5408621",
"0.53951824",
"0.53747165",
"0.5359557",
"0.53043044",
"0.5302296",
"0.5268773",
"0.52346116",
"0.51863056",
"0.51644444",
"0.5158612",
"0.5130518",
"0.51115173",
"0.510841",
"0.51074904",
"0.5098112",
"0.5089... | 0.6582 | 0 |
Delete all existing facts | def delete_facts
@facts = {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_all\n @configuration = nil\n end",
"def delete_all\n @configuration = nil\n end",
"def delete_all\n target.clear\n end",
"def destroy_all\n all.each(&:destroy)\n end",
"def delete_all\n self.store.delete_keys(find_keys)\n end",
... | [
"0.72164387",
"0.72164387",
"0.7179863",
"0.7125613",
"0.7121009",
"0.71049255",
"0.7014218",
"0.6972486",
"0.6937076",
"0.6912945",
"0.6873016",
"0.68672895",
"0.6845922",
"0.6832502",
"0.6822878",
"0.68077195",
"0.6805079",
"0.6805079",
"0.6787817",
"0.67664945",
"0.6731538... | 0.84084576 | 0 |
Stops the current assertion. Does not indicate failure. | def stop(message = nil)
@assert = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop\n msg = \"guard-self_test is stopped...\"\n UI.info msg\n Notifier.notify(msg)\n end",
"def stop_test(test)\n puts \"Test was stopped mid execution: #{test.uri}\"\n end",
"def stop_test_case\n return logger.error { \"Could not stop test case, no test case is running\" } unle... | [
"0.67832035",
"0.6547782",
"0.651686",
"0.63943756",
"0.63706154",
"0.6355129",
"0.6264343",
"0.6263689",
"0.6251894",
"0.6166021",
"0.6166021",
"0.6126806",
"0.61249775",
"0.61223114",
"0.61156374",
"0.6082949",
"0.60592645",
"0.60485375",
"0.6011075",
"0.600784",
"0.5971989... | 0.7875146 | 0 |
Stops the current assertion and change status to :fail | def fail(message = nil)
@status = FAIL
@assert = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(message = nil)\r\n @assert = false\r\n end",
"def fail_now\n fail\n raise TestFail\n end",
"def fail(message = nil)\n if @__assert_pending__ == 0\n if halt_on_fail?\n raise Result::TestFailure, message || \"\"\n else\n capture_result(Assert::Re... | [
"0.72820985",
"0.7252399",
"0.6899079",
"0.6854849",
"0.67692125",
"0.67598766",
"0.67290473",
"0.67276686",
"0.67276686",
"0.6621376",
"0.6612223",
"0.6586547",
"0.6563205",
"0.6563205",
"0.65092444",
"0.648474",
"0.6470521",
"0.64400804",
"0.641346",
"0.6382244",
"0.6360785... | 0.7579891 | 0 |
for a particular fact, we need to retrieve the relevant rules and add them to the relevant list | def add_relevant_rules_for_fact fact
@rules.values.select { |rule|
if !@relevant_rules.include?( rule)
if rule.parameters_match?(fact.value)
@relevant_rules << rule
logger.debug "#{rule} is relevant" if logger
else
logger.debug "#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_relevant_rules\r\n @relevant_rules = Array.new\r\n @facts.each { |k,f| \r\n add_relevant_rules_for_fact f\r\n }\r\n sort_relevant_rules\r\n end",
"def rules_by_name; end",
"def rules_from_step_content\n @rules_from_step_content ||= content_items.each_with_object({}) do ... | [
"0.7580315",
"0.6833116",
"0.677695",
"0.67665654",
"0.6523524",
"0.6523524",
"0.6523524",
"0.6523524",
"0.6523524",
"0.6523524",
"0.6523524",
"0.6519024",
"0.64688337",
"0.64688337",
"0.6444558",
"0.6444558",
"0.6444558",
"0.6357586",
"0.6325273",
"0.62844115",
"0.6251636",
... | 0.7809773 | 0 |
relevant rules need to be sorted in priority order | def sort_relevant_rules
# sort array in rule priority order
@relevant_rules = @relevant_rules.sort do |r1, r2|
r2.priority <=> r1.priority
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_if_needed\n @rules.sort! unless @sorted\n @sorted = true\n end",
"def optimize_order!(rules)\n first_can_in_group = -1\n rules.each_with_index do |rule, i|\n (first_can_in_group = -1) && next unless rule.base_behavior\n (first_can_in_group = i) && next ... | [
"0.77348995",
"0.7692838",
"0.71726584",
"0.70538974",
"0.6967807",
"0.6660927",
"0.66408473",
"0.66164094",
"0.66164094",
"0.66164094",
"0.66164094",
"0.66164094",
"0.66164094",
"0.66164094",
"0.6531411",
"0.64810646",
"0.6457969",
"0.6288312",
"0.6256381",
"0.62449473",
"0.... | 0.8185103 | 0 |
get all relevant rules for all specified facts | def get_relevant_rules
@relevant_rules = Array.new
@facts.each { |k,f|
add_relevant_rules_for_fact f
}
sort_relevant_rules
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all\n @rules\n end",
"def rules_by_name; end",
"def rules\n @rules.map{|r| [r.name, r.rule]}.to_h\n end",
"def add_relevant_rules_for_fact fact\r\n @rules.values.select { |rule| \r\n if !@relevant_rules.include?( rule)\r\n if rule.parameters_match?(fact.value) \r\n ... | [
"0.7097032",
"0.6890875",
"0.6853133",
"0.6829951",
"0.6672312",
"0.6652536",
"0.66160196",
"0.6602752",
"0.65246457",
"0.65246457",
"0.650818",
"0.6499943",
"0.6499943",
"0.6499943",
"0.6499943",
"0.6499943",
"0.6499943",
"0.6499943",
"0.6449105",
"0.6449105",
"0.6449105",
... | 0.8081455 | 0 |
evaluate all relevant rules for specified facts | def evaluate
@status = PASS
@assert = true
@num_executed = 0;
@num_evaluated = 0;
get_relevant_rules()
logger.debug("no relevant rules") if logger && @relevant_rules.size==0
#begin #rescue
# loop through the available_rules, evaluating ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_relevant_rules\r\n @relevant_rules = Array.new\r\n @facts.each { |k,f| \r\n add_relevant_rules_for_fact f\r\n }\r\n sort_relevant_rules\r\n end",
"def add_relevant_rules_for_fact fact\r\n @rules.values.select { |rule| \r\n if !@relevant_rules.include?( rule)\r\n ... | [
"0.6823999",
"0.67219603",
"0.6701946",
"0.6554284",
"0.650058",
"0.650058",
"0.632449",
"0.6275201",
"0.6275201",
"0.62481976",
"0.62459016",
"0.62459016",
"0.62459016",
"0.62459016",
"0.62459016",
"0.62459016",
"0.62459016",
"0.62030774",
"0.6162582",
"0.6126606",
"0.610612... | 0.7222914 | 0 |
lookup app name either in the file or if already cached look in the metadata variable | def lookup(app_name)
unless @metadata.key?(app_name)
data = YAML.load_file("./data/applications/#{app_name}.yaml")
@metadata[app_name] = data['cots::app_metadata']
end
@metadata[app_name]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_app_name(app_name)\n app_file = $pkg_dir+\"/\"+app_name.downcase.gsub(/ |-/,'_')+\".rb\"\n if File.exist?(app_file)\n app_name = eval(\"get_#{app_name.downcase.gsub(/ |-/,'_')}_app_name()\")\n else\n app_list = Dir.entries($pkg_dir)\n tmp_name = app_list.grep(/^#{app_name.downcase.gsub(/ |-/,'_... | [
"0.72688407",
"0.6998888",
"0.6632529",
"0.66260004",
"0.6625991",
"0.6451284",
"0.6280447",
"0.6277652",
"0.6266911",
"0.6266208",
"0.6180625",
"0.6162862",
"0.6134059",
"0.6134059",
"0.6116541",
"0.6106713",
"0.60854656",
"0.6083655",
"0.607067",
"0.6051834",
"0.6045461",
... | 0.81205225 | 0 |
s.request(link) do|success,body| body if success end | def request(link, &blk)
link = hook(link)
log "request: #{link} -> #{blk.inspect}"
@multi.add( Curl::Easy.new(link) do|c|
c.follow_location = true
c.headers["User-Agent"] = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Sa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_request(method, url, body, headers); end",
"def request(*args, &block); end",
"def get_response(uri, req)\n Net::HTTP.start(uri.hostname, uri.port){|http| http.request(req) }\nend",
"def request(endpoint, request, &block); end",
"def make_get_request(uri)\n response = Net::HTTP.get_response(ur... | [
"0.6746118",
"0.6691358",
"0.65664744",
"0.656512",
"0.6539215",
"0.6491686",
"0.63756734",
"0.63609964",
"0.63474333",
"0.63073367",
"0.6291987",
"0.62752783",
"0.62700534",
"0.62659705",
"0.626111",
"0.62349266",
"0.6214002",
"0.6188199",
"0.61848915",
"0.61757624",
"0.6171... | 0.7164632 | 0 |
End point: (PATCH) Usage: FundAmerica::Entity.update(entity_id, options) Output: Updates an entity person or company Uses test_mode update when used in sandbox mode | def update(entity_id, options)
API::request(:patch, "entities/#{entity_id}", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n entity_data = entity_params\n entity_data[:uid] = @entity.uid\n cmd = Commands::Entities::EditEntity.new(entity_data)\n execute(cmd)\n redirect_to entities_url, success: 'Entity was successfully updated.'\n rescue => error\n redirect_to edit_entity_url, warning: error_messages(error... | [
"0.6717854",
"0.66933495",
"0.6560759",
"0.6522267",
"0.6510602",
"0.6475136",
"0.6429616",
"0.64248943",
"0.6417863",
"0.63421935",
"0.62995476",
"0.62362045",
"0.620672",
"0.6189223",
"0.6152925",
"0.6125904",
"0.61234576",
"0.6115374",
"0.6100337",
"0.60869914",
"0.6070025... | 0.69770414 | 0 |
End point: (GET) Usage: FundAmerica::Entity.details(entity_id), request options &_expand[]=1 Output: Returns the details of an entity with matching id | def details(entity_id, request_options = "")
API::request(:get, "entities/#{entity_id}" + request_options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def details(entity)\n details_by_type_and_name(entity.properties[:type], entity.properties[:name])\n end",
"def _get_entity_detail(detail_name)\n @entity.get_detail(detail_name)\n end",
"def show\n @entity = Entity.find(params[:id])\n \n respond_to do |format|\n format.html # show.htm... | [
"0.72119665",
"0.6698045",
"0.66664255",
"0.6545143",
"0.63418263",
"0.6329604",
"0.63291484",
"0.6324539",
"0.623237",
"0.6170544",
"0.6044367",
"0.6018698",
"0.6010537",
"0.5982401",
"0.5978084",
"0.5972607",
"0.5950019",
"0.59452444",
"0.59263295",
"0.58793914",
"0.5872412... | 0.8206718 | 0 |
End point: (GET) Usage: FundAmerica::Entity.ach_authorizations(entity_id) Output: Returns ACH authorizations of an entity | def ach_authorizations(entity_id)
API::request(:get, "entities/#{entity_id}/ach_authorizations")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(*args)\n require_authentication\n arguments(args, required: [:authorization_id])\n\n get_request(\"/authorizations/#{authorization_id}\", arguments.params)\n end",
"def get(*args)\n raise_authentication_error unless authenticated?\n arguments(args, required: [:id])\n\n... | [
"0.62420696",
"0.61521333",
"0.6116939",
"0.60832816",
"0.6021224",
"0.58773667",
"0.58773667",
"0.58372104",
"0.58047384",
"0.5767842",
"0.5491542",
"0.5472516",
"0.54503995",
"0.5433435",
"0.54077476",
"0.54077476",
"0.5384407",
"0.5365944",
"0.5354341",
"0.53037167",
"0.53... | 0.8727051 | 0 |
End point: (GET) Usage: FundAmerica::Entity.cash_blotter(entity_id) | def cash_blotter(entity_id)
API::request(:get, "entities/#{entity_id}/cash_blotter")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bank_transfer_method(entity_id)\n API::request(:get, \"entities/#{entity_id}/bank_transfer_methods\")\n end",
"def get_marketplace_bank_account\n Balanced::BankAccount.find(\"/v1/bank_accounts/BAj6sNNBdMp5WmY6PJ7sAu3\")\n end",
"def balance\n rest.get(:getbalance)['data']\n end",
... | [
"0.59842044",
"0.5824421",
"0.5668388",
"0.56333244",
"0.55924106",
"0.5484383",
"0.5412799",
"0.54103756",
"0.53989995",
"0.53522265",
"0.53488004",
"0.5310438",
"0.52722174",
"0.5244552",
"0.5244552",
"0.5240701",
"0.5240025",
"0.52253515",
"0.5205345",
"0.5200413",
"0.5194... | 0.8980167 | 0 |
End point: (GET) Usage: FundAmerica::Entity.investor_suitability_details(entity_id) | def investor_suitability_details(entity_id)
API::request(:get, "entities/#{entity_id}/investor_suitability")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def investor_suitability_update(entity_id, options)\n API::request(:patch, \"entities/#{entity_id}/investor_suitability\", options)\n end",
"def platform_investor(entity_id )\n API::request(:get, \"entities/#{entity_id}/platform_investor\")\n end",
"def investor_accreditation(entity_id)... | [
"0.6998489",
"0.6399165",
"0.6215873",
"0.6044461",
"0.585896",
"0.5697527",
"0.5684516",
"0.56791675",
"0.5670156",
"0.5600503",
"0.5551321",
"0.5544604",
"0.54723734",
"0.5462545",
"0.5383733",
"0.5380635",
"0.5367114",
"0.5365481",
"0.53644514",
"0.5361769",
"0.53519493",
... | 0.91116935 | 0 |
End point: (PATCH) Usage: FundAmerica::Entity.investor_suitability_update(entity_id, options) | def investor_suitability_update(entity_id, options)
API::request(:patch, "entities/#{entity_id}/investor_suitability", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @investable.update(investable_params)\n format.html { redirect_to @investable, notice: 'Investable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render ... | [
"0.61958325",
"0.6139761",
"0.6139761",
"0.61195874",
"0.6080244",
"0.6074975",
"0.60582757",
"0.6056857",
"0.60435456",
"0.6018325",
"0.5944545",
"0.5940642",
"0.59330267",
"0.5920518",
"0.5919287",
"0.5899449",
"0.58973444",
"0.58935493",
"0.58935493",
"0.5892438",
"0.58921... | 0.91313285 | 0 |
End point: (GET) Usage: FundAmerica::Entity.investor_payments(entity_id) | def investor_payments(entity_id)
API::request(:get, "entities/#{entity_id}/investor_payments")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def investor_payments(distribution_id, options = {})\n \tAPI::request(:get, \"distributions/#{distribution_id}/investor_payments\", options)\n end",
"def details(investor_payment_id)\n API::request(:get, \"investor_payments/#{investor_payment_id}\")\n end",
"def platform_investor(entity_i... | [
"0.7399831",
"0.71451336",
"0.6653049",
"0.6325131",
"0.61442256",
"0.6138229",
"0.61257666",
"0.608291",
"0.6082504",
"0.6043077",
"0.5973801",
"0.5928625",
"0.5903708",
"0.58889884",
"0.58496696",
"0.58375543",
"0.58262527",
"0.5823262",
"0.5806376",
"0.57893664",
"0.578936... | 0.9108992 | 0 |
(GET) Usage: FundAmerica::Entity.bank_transfer_methods Output: Returns Bank Transfer Method informations of an entity | def bank_transfer_method(entity_id)
API::request(:get, "entities/#{entity_id}/bank_transfer_methods")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_list_payments_methods\n PaymentMethod.get_list_payment_methods\n end",
"def payment_methods\n request = payment_methods_request\n response = PaybywayConnector.payment_methods(request).parsed_response\n response['payment_methods'].map { |method|\n PaymentGateway::PaymentMethod.ne... | [
"0.5956884",
"0.5890792",
"0.56654423",
"0.56563747",
"0.5655339",
"0.5598423",
"0.54417044",
"0.5439406",
"0.54236805",
"0.5367508",
"0.53532326",
"0.53519887",
"0.53212625",
"0.5315025",
"0.5314124",
"0.52899677",
"0.52863175",
"0.5276744",
"0.52473",
"0.5228038",
"0.522061... | 0.7770543 | 0 |
(GET) Usage: FundAmerica::Entity.child_entities Output: Returns child entities of an entity | def child_entities(entity_id)
API::request(:get, "entities/#{entity_id}/child_entities")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children\n \n TapirLogger.instance.log \"Finding children for #{self}\"\n children = []\n EntityMapping.all.each do |mapping| \n\n # Go through each associated entity mapping, and find mappings where the parent_id is us\n # which means that the child_id is some other entity, a... | [
"0.765579",
"0.7173872",
"0.6570733",
"0.6468988",
"0.6445736",
"0.64158887",
"0.6405631",
"0.63433325",
"0.63402075",
"0.63110346",
"0.62899095",
"0.6242696",
"0.6242367",
"0.62389827",
"0.6235504",
"0.6229664",
"0.62037414",
"0.61976635",
"0.6181472",
"0.6181472",
"0.617183... | 0.83970994 | 0 |
(GET) Usage: FundAmerica::Entity.parent_entities Output: Returns parent entities of an entity | def parent_entities(entity_id)
API::request(:get, "entities/#{entity_id}/parent_entities")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parents\n\n TapirLogger.instance.log \"Finding parents for #{self}\"\n parents = []\n self.entity_mappings.each do |mapping|\n\n # Go through each associated entity mapping, and find mappings where the child_id is us \n # which means that the parent_id is some other entity, and it'... | [
"0.75979745",
"0.69744354",
"0.67214084",
"0.67011464",
"0.66702175",
"0.6664577",
"0.66317075",
"0.6625622",
"0.6621742",
"0.6619721",
"0.66195494",
"0.65879583",
"0.6553942",
"0.65360856",
"0.6527843",
"0.65220916",
"0.65112406",
"0.65030134",
"0.6486122",
"0.6484184",
"0.6... | 0.8341452 | 0 |
(GET) Usage: FundAmerica::Entity.relationships_as_child Output: Returns relationships_as_child details for entity | def relationships_as_child(entity_id)
API::request(:get, "entities/#{entity_id}/relationships_as_child")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def child_rels(*args)\n options = args.extract_options!\n rels = relationships.flat_map(&:children).uniq\n Relationship.filter_by_resource_type(rels, options)\n end",
"def child_ontology_relationships(options = {}) # :yields: Array of OntologyRelationships\n opt = {\n :relationship_type => 'all... | [
"0.68723017",
"0.67878765",
"0.67123616",
"0.66907215",
"0.6463459",
"0.64422923",
"0.6315922",
"0.6296345",
"0.6279918",
"0.62655675",
"0.62571764",
"0.6204106",
"0.61376524",
"0.6126914",
"0.6126365",
"0.6091054",
"0.6062718",
"0.6042653",
"0.6013718",
"0.60027623",
"0.6001... | 0.82127106 | 0 |
(GET) Usage: FundAmerica::Entity.relationships_as_parent Output: Returns relationships_as_parent details for entity | def relationships_as_parent(entity_id)
API::request(:get, "entities/#{entity_id}/relationships_as_parent")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relationships_as_child(entity_id)\n API::request(:get, \"entities/#{entity_id}/relationships_as_child\")\n end",
"def relation_to_parent\n _response_word.fetch(\"relationToParent\", nil)\n end",
"def parent_association\n @parent_object=parent_object # ResourceController normally sets... | [
"0.6867059",
"0.68645024",
"0.68537843",
"0.68079203",
"0.66850704",
"0.66231835",
"0.653668",
"0.63679206",
"0.63075554",
"0.6287161",
"0.6252998",
"0.62123406",
"0.62040347",
"0.61899227",
"0.6185197",
"0.6164521",
"0.61608934",
"0.60555655",
"0.60405403",
"0.60341173",
"0.... | 0.8172773 | 0 |
(GET) Usage: FundAmerica::Entity.investor_accreditation Output: Returns entity specific investor accreditation information | def investor_accreditation(entity_id)
API::request(:get, "entities/#{entity_id}/investor_accreditation")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @accreditations = Accreditation.all\n end",
"def course_accreditations(institution, course, kismode, options={})\n self.class.get(\"/Institution/#{institution}/Course/#{course}/#{kismode}/Accreditation.json\", options).parsed_response\n end",
"def set_accreditation\n @accreditation = A... | [
"0.6375594",
"0.631185",
"0.6070619",
"0.6020426",
"0.58813727",
"0.5757024",
"0.5688349",
"0.5610942",
"0.55743665",
"0.55384356",
"0.5400432",
"0.5380218",
"0.53247374",
"0.5320955",
"0.5313606",
"0.52836007",
"0.5274664",
"0.5230283",
"0.5230283",
"0.5218429",
"0.5217475",... | 0.8595916 | 0 |
(GET) Usage: FundAmerica::Entity.platform_investor Output: Returns entity specific platform_investor information Note: FA platform investor information will also be included with investor information | def platform_investor(entity_id )
API::request(:get, "entities/#{entity_id}/platform_investor")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platform_details\n data[:platform_details]\n end",
"def platform\n data.platform\n end",
"def platform\n data[:platform]\n end",
"def platform\n @platform ||= data.platform\n end",
"def details(investor_payment_id)\n API::request(:get, \"investor_payments/#{investor_payme... | [
"0.57086205",
"0.5593016",
"0.5556217",
"0.5524725",
"0.55160904",
"0.5444372",
"0.5386671",
"0.53793293",
"0.5313509",
"0.5310424",
"0.52907485",
"0.5262005",
"0.5236569",
"0.5176087",
"0.5169001",
"0.5163113",
"0.51555544",
"0.5147681",
"0.5143245",
"0.5126595",
"0.5118084"... | 0.82584137 | 0 |
Logs an incoming GET WEBrick request. | def do_GET(request, _response)
log_request(request)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_request\n logger.info \"HTTP request received => #{request.fullpath} , params => #{params} \"\n end",
"def request_log(request); end",
"def global_request_logging \n http_request_header_keys = request.headers.keys.select{|header_name| header_name.match(\"^HTTP.*\")}\n http_request_headers = r... | [
"0.7249485",
"0.66672456",
"0.6576395",
"0.6541875",
"0.650456",
"0.6396007",
"0.63442284",
"0.6265159",
"0.6238006",
"0.6198399",
"0.61395216",
"0.6074319",
"0.6055724",
"0.6044398",
"0.60287374",
"0.6004636",
"0.59969664",
"0.58921576",
"0.58873487",
"0.5884792",
"0.5882792... | 0.76082915 | 0 |
Logs and parses an incoming POST request. Parses `multipart/formdata` and `application/json` contenttypes. Parsed requests are added to the requests list. | def do_POST(request, response)
@aspecto_repeater.repeat request
@bugsnag_repeater.repeat request
# Turn the WEBrick HttpRequest into our internal HttpRequest delegate
request = Maze::HttpRequest.new(request)
content_type = request['Content-Type']
if %r{^multipart/form-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_request\n p request.body.string\n case request.content_type\n when JSON_TYPE then parse_json_request\n else parse_http_request\n end\n end",
"def do_POST(request, response)\n\n content_type = request['Content-Type']\n\n # For JSON, pull the instructions from the body. Oth... | [
"0.6545395",
"0.5963483",
"0.55991495",
"0.5574359",
"0.55533445",
"0.5462949",
"0.5462149",
"0.54360974",
"0.5372931",
"0.53600377",
"0.5332685",
"0.53058684",
"0.5238747",
"0.5226314",
"0.52043146",
"0.51962805",
"0.51959217",
"0.5192757",
"0.5180439",
"0.51752496",
"0.5164... | 0.6051569 | 1 |
Checks the BugsnagIntegrity header, if present, against the request and based on configuration. If the header is present, if the digest must be correct. However, the header need only be present if configuration says so. | def check_digest(request)
header = request['Bugsnag-Integrity']
if header.nil? && Maze.config.enforce_bugsnag_integrity && %i[sessions errors traces].include?(@request_type)
raise "Bugsnag-Integrity header must be present for #{@request_type} according to Maze.config.enforce_bugsnag_integrity... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_bugsnag_integrity_header(request)\n header = request[:request]['Bugsnag-Integrity']\n return !Maze.config.enforce_bugsnag_integrity if header.nil?\n\n digests = request[:digests]\n if header.start_with?('sha1')\n computed_digest = \"sha1 #{digests[:sha1]}\"\n e... | [
"0.84788775",
"0.6341355",
"0.5908636",
"0.5726542",
"0.56392556",
"0.5546962",
"0.5540966",
"0.54677624",
"0.54632944",
"0.54522043",
"0.5434323",
"0.5423803",
"0.5255678",
"0.5238328",
"0.52139276",
"0.5202434",
"0.5173209",
"0.5131942",
"0.51319253",
"0.51316965",
"0.51316... | 0.7928696 | 1 |
add planet to array | def planet_add(planet)
@planets.push(planet)
return @planets
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_planet(planet)\n @planet << planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet_to_add)\n @planets << planet_to_add\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add... | [
"0.7932559",
"0.78777885",
"0.7816552",
"0.7790386",
"0.7790386",
"0.7790386",
"0.7790386",
"0.7790386",
"0.7786768",
"0.77813804",
"0.77813804",
"0.77813804",
"0.77813804",
"0.7590277",
"0.7590277",
"0.7590277",
"0.7590277",
"0.75370526",
"0.74905616",
"0.7486492",
"0.742266... | 0.80549 | 1 |
pp get_mystates_from_highstate('module','chocolatey','bootstrap') pp get_mystates_from_highstate('module','user','current') pp get_mystates_from_highstate('state','system','hostname') | def get_highstate_from_minion
if defined?(@cache_highstate_from_minion)
Inspec::Log.debug('Returning cached @cache_highstate_from_minion.')
return @cache_highstate_from_minion
end
# ingest_from_minion('yaml', 'C:\salt\salt-call.bat --config-dir=C:\Users\vagrant\AppData\Local\Temp\kitchen\etc\salt state.sh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def states; @_hegemon_states.keys; end",
"def print_state(machine)\n puts \"[#{machine[:stack]}, #{machine[:register]}]\"\nend",
"def known_states; end",
"def known_states; end",
"def known_states; end",
"def get_state\n@state.keys\nend",
"def get_state\n get_yarn_application_apptem... | [
"0.61121684",
"0.6091551",
"0.5943058",
"0.5943058",
"0.5943058",
"0.5818758",
"0.56549346",
"0.56186575",
"0.55920625",
"0.55516225",
"0.5538549",
"0.5525389",
"0.5467259",
"0.5465247",
"0.54560184",
"0.5447231",
"0.5428945",
"0.54145753",
"0.53945524",
"0.5363011",
"0.53596... | 0.71150595 | 0 |
example: get_saltstack_package_full_name('7zip') = '7Zip' | def get_saltstack_package_full_name(package)
# pillar = YAML.safe_load(File.read('test/salt/pillar/windows.sls'))
url = 'https://raw.githubusercontent.com/saltstack/salt-winrepo-ng/master/'
files = [package + '.sls', package + '/init.sls']
# example: package = "7zip"=>{"version"=>"18.06.00.0", "refresh_minion_e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package_name\n name = package_drop_last(slug_parts)\n name.empty? ? '_root_' : name\n end",
"def package_name\n # TODO: verify renamed packages\n resource['title']\n end",
"def full_name\n \"#{@package}.#{parameterized_name}\"\n end",
"def package_name\n @ve... | [
"0.758345",
"0.7460569",
"0.72973734",
"0.7297259",
"0.727296",
"0.7171976",
"0.68556035",
"0.682097",
"0.6756436",
"0.67478067",
"0.6664091",
"0.6590872",
"0.6589945",
"0.6572884",
"0.6560001",
"0.6554045",
"0.6530854",
"0.65306455",
"0.643837",
"0.6425542",
"0.6397732",
"... | 0.8239686 | 0 |
Instance methods collection/key/graph Gets the graph for the specified kind of relation. | def orchio_get_graph(kind)
# add_relation_kind kind
if cache.enabled? and response = cache_request.get_graph(id, kind)
if response.header.status == :cache
docs = response.body.documents
count = docs.length
end
else
response = client.send_request :get, inst_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def graph(kind)\n res = orchio_get_graph(kind)\n (res.success?) ? res.results.map { |odoc| odoc.to_rails } : false\n end",
"def graph_class\n RDF::Graph\n end",
"def relation\n relation = nodes.reduce(root) do |a, e|\n a.associations[e.name.key].join(:join, a, e)\n e... | [
"0.657574",
"0.6241088",
"0.6199209",
"0.5996835",
"0.597931",
"0.59746987",
"0.59539104",
"0.5948078",
"0.5869207",
"0.58680755",
"0.58326524",
"0.5809189",
"0.57714933",
"0.57552767",
"0.57509476",
"0.57392704",
"0.5719115",
"0.5715314",
"0.5705366",
"0.5705366",
"0.5705366... | 0.7672522 | 0 |
Add a graph/relation to the collection. Store the to_key's 'ref' value if caching is enabled. | def orchio_put_graph(kind, to_collection, to_key)
# add_relation_kind kind
if cache.enabled?
ref = simple_cache.get_ref to_collection, to_key
simple_cache.get_cc(ocollection).save_graph Metadata.new(
{ from_key: @id, kind: kind, ref: ref }
)
end
response = cli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_reference key, target, opts = {}, &blk\n\t\tadd_reference_set(key,target,opts) if target.is_a? Array\n\t\tadd_to_db(target, nil, :if_in_use => opts[:add_then_reference]) if opts[:add_then_reference]\n\t\tadd_to_db Database::Reference.new(self, target, :proc => blk), key, :if_in_use => opts[:if_in_use]\n\te... | [
"0.6182365",
"0.6182044",
"0.6178859",
"0.6128831",
"0.603533",
"0.5910233",
"0.5817467",
"0.57893527",
"0.57568485",
"0.57426685",
"0.573746",
"0.5715629",
"0.5675938",
"0.56750786",
"0.56678474",
"0.5661373",
"0.5653564",
"0.5631272",
"0.5629847",
"0.5629258",
"0.5624438",
... | 0.6775267 | 0 |
Returns the ref value for the current instance. The ref value is an immutable value assigned to each version of primary_key data in an orchestrate.io collection. | def orchestrate_ref_value
__ref_value__
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reference\n value_for('reference')\n end",
"def ref\n @id\n end",
"def ref\n @ref ||= self.node.attributes.to_h[\"ref\"]\n end",
"def reference\n @data['reference']\n end",
"def ref\n reference(@id, @revision)\n end",
"def ref\n @ref ||= ... | [
"0.69407225",
"0.6844483",
"0.6630032",
"0.66170686",
"0.6571058",
"0.6551984",
"0.6502058",
"0.6470157",
"0.6365831",
"0.62379277",
"0.62237215",
"0.61483204",
"0.61453617",
"0.6140024",
"0.60695076",
"0.6066563",
"0.60533196",
"0.60533196",
"0.60437137",
"0.60432917",
"0.60... | 0.73137236 | 1 |
After a successful PUT request, updates the current instance's ref value (also referred to as the etag) and calls orchio_update_ref_table. | def set_ref_value(response)
unless response.header.code != 201 || response.header.etag.blank?
@__ref_value__ = response.header.etag
orchio_update_ref_table response.header.timestamp
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orchio_update_ref_table(timestamp)\n return if ocollection == RefTable.get_collection_name\n\n if RefTable.enabled?\n primary_key = __ref_value__.gsub(/\"/, '')\n doc = {\n xcollection: ocollection,\n xkey: id,\n xref: primary_key,\... | [
"0.60518837",
"0.5905862",
"0.57425874",
"0.53495914",
"0.5342749",
"0.52888364",
"0.5202367",
"0.5183367",
"0.5146458",
"0.5125581",
"0.50779533",
"0.50746596",
"0.50360227",
"0.5031999",
"0.5016165",
"0.5004753",
"0.49825615",
"0.49766934",
"0.4958231",
"0.49519026",
"0.495... | 0.62973815 | 0 |
Updates the ref table collection with key/value data consisting of the current instance's collection, key, timestamp and ref values , using the ref value as the primary key. When the ref table feature is enabled, the ref table is updated after each sucessful put_key request. | def orchio_update_ref_table(timestamp)
return if ocollection == RefTable.get_collection_name
if RefTable.enabled?
primary_key = __ref_value__.gsub(/"/, '')
doc = {
xcollection: ocollection,
xkey: id,
xref: primary_key,
ti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](ref_id)\n response = @key_value.perform(:get, ref_id)\n Ref.new(@key_value.collection, @key_value.key, response)\n end",
"def []=(key, value)\n ObjectSpace.define_finalizer(value, @reference_cleanup)\n key = key.dup if key.is_a?(String)\n @lock.synchronize do\n @referenc... | [
"0.5803649",
"0.5662252",
"0.5499384",
"0.54875493",
"0.5399688",
"0.5387158",
"0.53680176",
"0.5276618",
"0.5271424",
"0.5255198",
"0.52550596",
"0.5187772",
"0.5175624",
"0.5142534",
"0.5048935",
"0.503664",
"0.503664",
"0.5031836",
"0.5026367",
"0.5008508",
"0.49969405",
... | 0.7107745 | 0 |
Returns handle to the SimpleCacheStore singleton instance. | def simple_cache
@@cache_store
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_store\n Cache.new\n end",
"def cache_store\n return nil if context.environment.cache.nil?\n\n CacheStore.new context.environment\n end",
"def cache; shrine_class.new(cache_key); end",
"def store\n @store ||= storage.new self\n end",
"def singleton_cache; end",
"def ... | [
"0.6644324",
"0.65349",
"0.6361972",
"0.63534564",
"0.6315308",
"0.6243158",
"0.61991364",
"0.61588085",
"0.6147739",
"0.61404",
"0.61287725",
"0.61287725",
"0.61124194",
"0.61002916",
"0.60885304",
"0.60814565",
"0.6072397",
"0.60501343",
"0.60280156",
"0.6013275",
"0.599786... | 0.7578753 | 0 |
puts num_of_ones puts num_of_twos puts num_of_ones num_of_twos PART TWO example = '0222112222120000' layers = split_into_layers(example, width: 2, height: 2) print_layers layers | def flatten_layers(layers)
layers = layers.reverse
display = layers[0]
layers.slice(1..-1).each do |layer|
layer.each_with_index do |row, y|
row.each_with_index do |digit, x|
display[y][x] = digit unless digit == 2
end
end
end
return display
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_into_parts(*sizes); end",
"def num_layers\n num_layers = 0\n # binding.pry\n while !nodes.where(net_id: id, layer: num_layers).empty?\n num_layers += 1\n end\n num_layers\n end",
"def pyramid(layers)\r\n upper_layer = \"1\"\r\n tower = [\"1\"]\r\n layers.times do\r\n tower ... | [
"0.5808757",
"0.5765374",
"0.5567595",
"0.5537976",
"0.55103034",
"0.531557",
"0.52791226",
"0.52499366",
"0.5210015",
"0.5145776",
"0.50884956",
"0.507714",
"0.5074053",
"0.504909",
"0.50011134",
"0.4993981",
"0.49810904",
"0.49730843",
"0.49655437",
"0.49503893",
"0.4917535... | 0.5965251 | 0 |
GET /package_items GET /package_items.json | def index
@package_items = @package.package_items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getItems()\n return mergeWithAPI(@item_json)['data']\n end",
"def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend",
"def index\n @user_packages = UserPackage.all\n\n render json: @user_packages\n end",
"def index\n... | [
"0.69879204",
"0.6740856",
"0.67260444",
"0.6663409",
"0.66460216",
"0.66193235",
"0.65737015",
"0.6476479",
"0.6285331",
"0.62748927",
"0.62740433",
"0.6260324",
"0.62476176",
"0.62414014",
"0.62349945",
"0.62125385",
"0.6211312",
"0.6210025",
"0.6205166",
"0.6201211",
"0.61... | 0.75783783 | 0 |
POST /package_items POST /package_items.json | def create
@package_item = PackageItem.new(package_item_params)
@package_item.package = @package
respond_to do |format|
if @package_item.save
format.html { redirect_to package_items_path(@package), notice: 'Package item was successfully created.' }
format.json { render :show, status: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @package = Package.new(package_params)\n add_items\n \n respond_to do |format|\n if @package.save\n \n format.html { redirect_to @package, notice: 'Package was successfully created.' }\n format.json { render action: 'show', status: :created, location: @package }\n... | [
"0.74587506",
"0.67272186",
"0.6511574",
"0.64313406",
"0.6417907",
"0.64163995",
"0.63965976",
"0.63420194",
"0.62634957",
"0.6171616",
"0.6145754",
"0.61152625",
"0.60932004",
"0.60147357",
"0.6002886",
"0.5999663",
"0.5994116",
"0.59864134",
"0.5969918",
"0.5960131",
"0.59... | 0.7325522 | 1 |
PATCH/PUT /package_items/1 PATCH/PUT /package_items/1.json | def update
respond_to do |format|
@package_item.package = @package
if @package_item.update(package_item_params)
format.html { redirect_to package_items_path(@package), notice: 'Package item was successfully updated.' }
format.json { render :show, status: :ok, location: @package_item }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n add_items\n if @package.update(package_params)\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { re... | [
"0.763633",
"0.71005774",
"0.69696784",
"0.69677657",
"0.68880594",
"0.68880594",
"0.6871805",
"0.68466717",
"0.68453074",
"0.6810982",
"0.6737805",
"0.6709259",
"0.6669252",
"0.6657448",
"0.66215914",
"0.6610505",
"0.65669423",
"0.6542501",
"0.65394735",
"0.65220934",
"0.651... | 0.75248927 | 1 |
DELETE /package_items/1 DELETE /package_items/1.json | def destroy
@package_item.destroy
respond_to do |format|
format.html { redirect_to package_items_url, notice: 'Package item was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @package.status = nil\n @package.save!\n respond_to do |format|\n format.html { redirect_to packages_url }\n format.json { head :no_content }\n end\n end",
"def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n ... | [
"0.702064",
"0.7003068",
"0.6868799",
"0.68579763",
"0.68499976",
"0.6816435",
"0.6815266",
"0.6762219",
"0.67428964",
"0.6724987",
"0.671537",
"0.6713069",
"0.6700218",
"0.6673716",
"0.6673716",
"0.66717136",
"0.66713274",
"0.66446",
"0.6625679",
"0.6603149",
"0.6585948",
... | 0.73143905 | 0 |
def active_audits self.audits.where("end_date <= ?", Date.today) end | def active_audits_with_skipped
self.audits.where("end_date >= ?", Date.today) - SkippedAuditReminder.audits
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upcoming_events\n attended_events.where('date >= :current_date AND accepted',\n current_date: DateTime.now)\n end",
"def active_events_count\n self.events.where(\"end_day >= ?\", Date.today).where(:deleted => false).count\nend",
"def active_exchanges\n self.participations.w... | [
"0.6638116",
"0.66005826",
"0.6570501",
"0.6461285",
"0.639732",
"0.6375717",
"0.6302779",
"0.6245756",
"0.62004757",
"0.6200022",
"0.61931014",
"0.6178317",
"0.61648226",
"0.6160636",
"0.6137084",
"0.6135155",
"0.6131997",
"0.6118627",
"0.60974604",
"0.60694695",
"0.6038177"... | 0.7780947 | 0 |
SHA1 hash in salted form | def sha1_hex
Digest::SHA1.hexdigest(salted_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_sha1(salt = \"\")\n hashsum(:sha1, salt)\n end",
"def hex_sha1(s)\n binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end",
"def hex_sha1(s)\n return binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end",
"def sha1_base64\n str = Base64.encode64(Digest::SHA1.digest(sa... | [
"0.88181895",
"0.77297646",
"0.7697292",
"0.7617789",
"0.7549458",
"0.7549458",
"0.72615856",
"0.72528857",
"0.72353816",
"0.7209765",
"0.72053164",
"0.72021896",
"0.7101376",
"0.7075738",
"0.7062704",
"0.7062704",
"0.7052518",
"0.70035803",
"0.6998116",
"0.6998116",
"0.69981... | 0.8545342 | 1 |
generates a random salt based upon the characters returned by salt() | def rand_salt
result = ''
salt().length.times {result << salt()[rand(salt().length),1]}
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_salt\n salt = \"\"\n 64.times { \n salt << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }\n salt\n end",
"def gen_salt\n chars = []\n 8.times { chars << SALT_CHARS[rand(SALT_CHARS.size)] }\n chars.join('') \n ... | [
"0.8881849",
"0.8676958",
"0.86555225",
"0.8479994",
"0.8450091",
"0.83791935",
"0.83188355",
"0.83142114",
"0.81385106",
"0.80923337",
"0.8025615",
"0.80214626",
"0.7986649",
"0.7986649",
"0.79608107",
"0.78630453",
"0.77831805",
"0.7756087",
"0.7756087",
"0.77432925",
"0.77... | 0.88802 | 1 |
Sets the voltage in mV. The possible range is 0V to 5V (05000). Calling this function will set the mode to 0 (see BrickletAnalogOutset_mode). The default value is 0 (with mode 1). | def set_voltage(voltage)
send_request(FUNCTION_SET_VOLTAGE, [voltage], 'S', 0, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def voltage\n lfac_device = '/sys/bus/iio/devices/iio:device0/'\n raw_voltage = File.read(File.join(lfac_device, 'in_voltage0_raw')).strip.to_f\n scale = File.read(File.join(lfac_device, 'in_voltage_scale')).strip.to_f\n @voltage = raw_voltage * scale\n end",
"def voltage\n raw_voltage = File.rea... | [
"0.5903527",
"0.58412147",
"0.5671903",
"0.5671903",
"0.5534078",
"0.55023926",
"0.5416621",
"0.53050137",
"0.53007793",
"0.5261536",
"0.5217041",
"0.51907027",
"0.5173838",
"0.51657933",
"0.5079575",
"0.50737715",
"0.50315464",
"0.50315464",
"0.50253576",
"0.50165725",
"0.50... | 0.66746545 | 0 |
Scans keys between `start` and `stop`. | def keys(start, stop, opts = {})
limit = opts[:limit] || -1
mon_synchronize do
perform ["keys", start, stop, limit], :multi => true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], multi: true\n end\n end",
"def zscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zscan\", key, BLANK, start, stop,... | [
"0.69658834",
"0.6588213",
"0.65460145",
"0.6499795",
"0.6480413",
"0.63850176",
"0.63421845",
"0.6323305",
"0.62536657",
"0.6246083",
"0.6220278",
"0.6220278",
"0.59406996",
"0.58991563",
"0.58034974",
"0.58034974",
"0.5774559",
"0.56819415",
"0.566365",
"0.55868757",
"0.556... | 0.6968575 | 0 |
Sets the `score` of `member` at `key`. | def zset(key, member, score)
mon_synchronize do
perform ["zset", key, member, score], :proc => T_BOOL
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zset(key, member, score)\n mon_synchronize do\n perform [\"zset\", key, member, score], proc: T_BOOL\n end\n end",
"def []=(key, score)\n update_condition = ->(redis) do\n current_score = redis.zscore(@redis_key, key)\n !current_score || current_score < score\n end\n update_act... | [
"0.7154557",
"0.67875224",
"0.6729386",
"0.6463389",
"0.6213083",
"0.6131967",
"0.6084888",
"0.60824776",
"0.6057043",
"0.6057043",
"0.59115064",
"0.58831245",
"0.5716548",
"0.57134265",
"0.5702379",
"0.5685153",
"0.5678638",
"0.56314796",
"0.5629938",
"0.5628831",
"0.5615831... | 0.7005211 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.