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 |
|---|---|---|---|---|---|---|
This validation checks if a users tries to replace a book's reedition with an nonexisting title. The form then already cleared the reedition_id field but the submit contains a (nonexisting) title. | def reedition_should_be_known
if @reedition_title.present? && !reedition_id
errors.add(:reedition_title, :invalid)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_title\n errors.add(:title, :must_be_null_in_this_slide) if !self.allows_title? && !self.title.nil?\n end",
"def not_a_duplicate\n book = Book.find_by(title: title, author: author)\n if !!book && book != self\n errors.add(:book, 'is already in the book index.')\n end\n end",
"def... | [
"0.5815999",
"0.5807642",
"0.5806872",
"0.5608003",
"0.55836034",
"0.55281657",
"0.5496867",
"0.54398125",
"0.5389889",
"0.53524816",
"0.5320052",
"0.5260827",
"0.52214074",
"0.52118576",
"0.5179069",
"0.5148613",
"0.51343226",
"0.5129328",
"0.5124586",
"0.51188564",
"0.51112... | 0.75012064 | 0 |
When the start time is changed, make the end time the start time for parent work duration (if parent work set). Do not execute however if the end date is turned off | def set_end_time_from_start_time
@expression = load_expression_instance_from_session
@execute_update = false
if !@expression.expression_finish.blank?
@execute_update = true
@start_date = params[:start_date]
@start_hms = params[:start_hms]
#Only update the time if the sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start=(time); end",
"def set_start_end_dates\n # If the task is a schedule/appointment type then we need to set the start\n #+ and end time for it. We save them in the same fields start_date,\n #+ end_date. The start_time and end_time fields are deprecated and they \n #+ are used as place holders... | [
"0.6691228",
"0.6630481",
"0.6376204",
"0.6334857",
"0.61937016",
"0.61764",
"0.6162608",
"0.608798",
"0.6083878",
"0.6071048",
"0.6013427",
"0.5997158",
"0.5994593",
"0.5983006",
"0.59464633",
"0.5938604",
"0.58972853",
"0.5895809",
"0.5895774",
"0.5888103",
"0.5881237",
"... | 0.6798447 | 0 |
When date minutes are zeroed, set the supress_times flag | def disable_date_minutes
@expression = load_expression_instance_from_session
logger.debug "Setting supress times when disabling date minutes"
@expression.supress_times = true
save_expression_instance_in_session
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_timeless_option\n self.class.timestamping = true\n end",
"def restore_times; end",
"def restore_times; end",
"def zero_hour?\n # if the times differ more than 1 minute we probably have more important issues\n needs_view && (ends_at.to_i - updated_at.to_i) < 60\n end",
"def rest... | [
"0.6631056",
"0.6302851",
"0.6302851",
"0.60188323",
"0.5987277",
"0.5985336",
"0.5913184",
"0.5893775",
"0.58724564",
"0.587211",
"0.5847061",
"0.5797087",
"0.57533",
"0.5720519",
"0.5710806",
"0.5710806",
"0.56752264",
"0.5659695",
"0.5658426",
"0.559019",
"0.559019",
"0.... | 0.6948454 | 0 |
Session storage of expressions In order for the ajax to repopulate correctly the dates when a mode is changed, the expression being edited needs to be stored in the session | def save_expression_instance_in_session
session[:expression_being_edited] = @expression
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable_dates\n @expression = load_expression_instance_from_session\n @expression.expression_start = Time.now\n @expression.expression_finish = Time.now\n save_expression_instance_in_session\n end",
"def mode_changed\n @new_mode = Mode.find(params[:expression_mode_id])\n #FIXME : does not ap... | [
"0.65938324",
"0.61843187",
"0.61736983",
"0.60175544",
"0.5586321",
"0.5528364",
"0.5449134",
"0.53445745",
"0.53361964",
"0.524058",
"0.5183165",
"0.5108835",
"0.50578916",
"0.50357985",
"0.5034824",
"0.50108916",
"0.5010148",
"0.49946803",
"0.4989734",
"0.49855217",
"0.497... | 0.72892666 | 0 |
Dynamically remove expression language | def remove_language
expression_language = ExpressionLanguage.find(params[:expression_language_id]) unless params[:expression_language_id].blank?
@expression = expression_language.expression
if !expression_language.blank?
if expression_language.destroy
# update related work for solr indexi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_expression(expression)\n \n end",
"def exp_remove_tokens(exp)\n if exp.kind_of?(Array) # Is this and AND or OR\n exp.each do |e| # yes, check each array item\n exp_remove_tokens(e) # Remove tokens from children\n end\n else\n exp.delete(:token) ... | [
"0.724851",
"0.59109986",
"0.5819459",
"0.5819459",
"0.5819459",
"0.5818633",
"0.5712305",
"0.56827813",
"0.56827813",
"0.5675937",
"0.56343466",
"0.56343466",
"0.56343466",
"0.5585866",
"0.5585866",
"0.5585866",
"0.5555877",
"0.5488354",
"0.5473086",
"0.54723316",
"0.5451101... | 0.65425897 | 1 |
In the previous exercise, you developed a method that converts simple numeric strings to Integers. In this exercise, you're going to extend that method to work with signed numbers. Write a method that takes a String of digits, and returns the appropriate number as an integer. The String may have a leading + or sign; if... | def string_to_signed_integer(string)
convert = %w(0 1 2 3 4 5 6 7 8 9)
number = 0
sign = 1
sign = -1 if string[0] == '-'
string[0] = '' if string[0] == '+' || string[0] == '-'
digits = string.chars.map { |char| convert.index(char) }
digits.length.times { |i| number += digits.reverse[i] * (10**i) }
nu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string_to_signed_integer(string)\n case string[0]\n when '-' then -string_to_integer(string[1..-1])\n when '+' then string_to_integer(string[1..-1])\n else string_to_integer(string)\n end\nend",
"def string_to_signed_integer(string)\n case string[0]\n when '-' then -string_to_integer(string[1... | [
"0.83039975",
"0.8303367",
"0.8303367",
"0.8303367",
"0.8283325",
"0.8262626",
"0.8256874",
"0.8203563",
"0.81275296",
"0.8056998",
"0.8040004",
"0.8015702",
"0.80073994",
"0.7990955",
"0.7985374",
"0.7972308",
"0.7877772",
"0.78207874",
"0.7809237",
"0.7767566",
"0.7762862",... | 0.832114 | 0 |
Map requested collections from relation | def resolve_collections
@resolved_collections = resolved_associations_map.inject({}) do |hash, (k,v)|
collection_records = []
collection_associations = Array.wrap(v[:associations])
collection_associations.each do |association|
add_records_from_collection_association(rel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_relations\n self.resource_relations = {}\n model.alchemy_resource_relations.each do |name, options|\n relation_name = name.to_s.gsub(/_id$/, \"\") # ensure that we don't have an id\n association = association_from_relation_name(relation_name)\n foreign_key = association.optio... | [
"0.659158",
"0.6451023",
"0.63770825",
"0.6236531",
"0.6137236",
"0.6030272",
"0.60207206",
"0.5979044",
"0.59339166",
"0.5829472",
"0.58108276",
"0.5807657",
"0.578936",
"0.578936",
"0.5783579",
"0.57808256",
"0.57680327",
"0.57491916",
"0.57327807",
"0.5670576",
"0.56269026... | 0.7103261 | 0 |
Set notes content from specified array | def note_contents=(array)
array.each do |i|
if !i.empty?
note = Note.find_or_create_by(content: i)
self.notes << note
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def note_contents=(notes)\n notes.each do |content|\n if content.strip != ''\n self.notes.build(content: content)\n end\n end\n end",
"def note_contents=(notes)\n \tnotes.each do |content|\n \t\tself.notes << Note.find_or_create_by(content: content) unless content == \"\"\n \tend\n en... | [
"0.7427701",
"0.7389042",
"0.7355997",
"0.7313167",
"0.7313167",
"0.7232787",
"0.7186886",
"0.71308774",
"0.68918526",
"0.6704197",
"0.6704197",
"0.6704197",
"0.6704197",
"0.6577952",
"0.6576483",
"0.63726807",
"0.63726807",
"0.6360848",
"0.63081884",
"0.62167436",
"0.6085958... | 0.8208271 | 0 |
retrieve the quote data (an OpenStruct per quote) the options param can be used to specify the following attributes: :raw if true, each column will be converted (to numbers, dates, etc) | def quotes(symbols_array, columns_array = [:symbol, :last_trade_price, :last_trade_date, :change, :previous_close], options = {})
# remove invalid keys
columns_array.reject! { |c| !COLUMNS.key?(c) }
columns_array << :symbol if columns_array.index(:symbol).nil?
# "N/A" is never present if { raw ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quotes(symbols_array, columns_array = [\n :symbol, :last_trade_price, :last_trade_date,\n :change, :previous_close], options = {})\n\n options[:raw] ||= true\n ret = []\n symbols_array.each_slice(SYMBOLS_PER_REQUEST) do |symbols|\n read_quotes(symbols.join(\"+\"), columns_array)... | [
"0.626961",
"0.6015608",
"0.6012021",
"0.59799457",
"0.5858027",
"0.5858027",
"0.58576053",
"0.5754858",
"0.57429415",
"0.57237434",
"0.57222724",
"0.5658466",
"0.55752856",
"0.5549351",
"0.5542553",
"0.5497742",
"0.54897434",
"0.5450223",
"0.5449841",
"0.5433103",
"0.5430273... | 0.6061321 | 1 |
fetch 0.2 attachment from post | def fetch_attachment(post, attachment_name, attachment_type)
server_urls = perform_legacy_discovery(post[:entity])
return unless server_urls.any?
res = server_urls.inject(nil) do |memo, server_url|
url = "#{server_url}/posts/#{URI.encode_www_form_component(post[:entity])}/#{post[:public_id]}/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attachment(name)\n assert_attachments_property\n\n attachment = self.attachments[name] if self.attachments\n\n unless self.id && attachment\n nil\n else\n adapter = repository.adapter\n http = Net::HTTP.new(adapter.uri.host,... | [
"0.71810544",
"0.7139811",
"0.7076455",
"0.6930871",
"0.68689656",
"0.68510306",
"0.6821538",
"0.68098664",
"0.6808154",
"0.6789064",
"0.6773658",
"0.67281306",
"0.67281306",
"0.671449",
"0.66866547",
"0.666118",
"0.6601584",
"0.65956724",
"0.65859103",
"0.6572786",
"0.657266... | 0.8099974 | 0 |
To show a list of discussion of particular student | def showmine
@title = "Discussion"
@subtitle = "show mine"
student_id = get_user_student.id
# @discussions = get_user_student.discussions It is not order by
@discussions = Discussion.find(:all, :conditions => ["student_id = ?", student_id], :order => 'created_at desc')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @student = @topic.student\n end",
"def show\n @courses = @student.courses\n @groups = @student.groups\n end",
"def index\n @discussions = Discussion.where(course: @course)\n end",
"def show\n @discussions = @forum.all_discussions\n end",
"def list_subjects\r\n #TODO on... | [
"0.6761917",
"0.6754606",
"0.6683924",
"0.65130943",
"0.64268214",
"0.63731855",
"0.63731855",
"0.63484186",
"0.6304182",
"0.63040686",
"0.6293524",
"0.6285895",
"0.6225407",
"0.6193721",
"0.61863375",
"0.61807",
"0.6179783",
"0.61532116",
"0.6145843",
"0.6143446",
"0.6136669... | 0.7223224 | 0 |
For AJAX request to get previous version | def get_previous_version
content_version = ContentVersion.find(params[:id])
render :text => content_version.title+"||"+content_version.body+"||"+params[:id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_version\n self[:previous_version]\n end",
"def get_version\n request('getVersion')\n end",
"def previous_version\n @previous_version ||= previous_versions[0]\n end",
"def load_previous_version\n Version.all(:limit => 1, :order => [ :processed.desc ]).first\n end",
"... | [
"0.6724138",
"0.66291887",
"0.65729547",
"0.6559381",
"0.6553339",
"0.64885956",
"0.6360906",
"0.6333761",
"0.6288369",
"0.62779856",
"0.62739253",
"0.62739253",
"0.6271415",
"0.62340707",
"0.6205192",
"0.6201832",
"0.6197258",
"0.6187482",
"0.6178216",
"0.6162251",
"0.613894... | 0.68988574 | 0 |
returns array of ride instances that specific passenger has been on | def rides
Ride.all.select { |ride| ride.passenger == self }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rides\n Ride.all.select {|ride| ride.passenger == self}\n end",
"def rides_as_passenger\n ride_ids = self.relationships.select(:ride_id).where(is_driving: false).joins(:ride).where(\"rides.user_id <> ?\", self.id)\n if ride_ids.count > 0\n Ride.where(\"id in (?)\", ride_ids)\n else\n ... | [
"0.7886998",
"0.7770843",
"0.7767762",
"0.76546025",
"0.7569559",
"0.7142918",
"0.70862603",
"0.70261306",
"0.7017991",
"0.70031416",
"0.69955224",
"0.683008",
"0.6829578",
"0.68276805",
"0.6806253",
"0.6772113",
"0.676121",
"0.6739329",
"0.67361987",
"0.6703989",
"0.66931283... | 0.79241335 | 0 |
return total distance that specific passenger has travelled | def total_distance
distances = self.rides.map { |ride| ride.distance }
distances.inject(:+).to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_distance\n approved_flights.sum(:distance)\n end",
"def total_distance\n rides.reduce(0) {|total, ride| total + ride.distance}\n end",
"def total_distance\n rides.reduce(0) {|total, ride| total + ride.distance}\n end",
"def total_distance()\n self.rides().map() { | ri... | [
"0.7664171",
"0.7598213",
"0.7598213",
"0.7482341",
"0.7357276",
"0.7349594",
"0.7333526",
"0.7199609",
"0.7183973",
"0.71464425",
"0.7124248",
"0.70396775",
"0.7028966",
"0.70083857",
"0.70083857",
"0.70036423",
"0.69896525",
"0.6982387",
"0.686444",
"0.6784868",
"0.6747179"... | 0.76038307 | 1 |
Make UnWhitelist API call Author: Pankaj Date: 07/05/2018 Reviewed By: | def send_unwhitelist_request
Rails.logger.info("user_kyc_detail id:: #{@user_kyc_detail_id} - making private ops api call")
r = Request::OpsApi::Whitelist.new.whitelist({
whitelister_address: api_data[:client_whitelist_detail_obj].whitelister_address,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def whitelist\n if cannot_access_api?\n render json: [], status: :unauthorized\n end\n end",
"def ignore_request(_team, _user)\n # stub\n end",
"def search_apility_by_ip entity_name, headers\n\n # Get the Api response\n response_body = http_get_body(\"https://api.apility.net/b... | [
"0.59566873",
"0.5916403",
"0.57944816",
"0.5736486",
"0.5698603",
"0.5622511",
"0.56015193",
"0.5593097",
"0.55921346",
"0.55364084",
"0.55286926",
"0.5528395",
"0.54975086",
"0.5480346",
"0.5471141",
"0.5450059",
"0.54426014",
"0.54313797",
"0.5400734",
"0.5394449",
"0.5388... | 0.75838375 | 0 |
Validate All whitelisting checks before putting unwhitelisting request Author: Pankaj Date: 07/05/2018 Reviewed By: | def validate_whitelisting_process
return error_with_data(
'uaj_2',
"Client Whitelisting information is inactivated. Please contact Ost team.",
"Client Whitelisting information is inactivated. Please contact Ost team.",
GlobalConstant::ErrorAction.default,
{}
) if get_clie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def whitelist; end",
"def check_white_list(context,input,original = nil)\n original = input.dup if original.nil?\n @white_list.each do |p|\n match = p.match(input)\n if match.nil? or not match[0].eql?(input)\n # format user msg\n user = \"#{contex... | [
"0.62542313",
"0.624386",
"0.62354505",
"0.6164055",
"0.6115565",
"0.6027786",
"0.6022212",
"0.6012974",
"0.6008016",
"0.59368604",
"0.59098953",
"0.5873433",
"0.58604485",
"0.57797706",
"0.5745375",
"0.56888753",
"0.5673816",
"0.5673816",
"0.56453747",
"0.5636145",
"0.561937... | 0.7625238 | 0 |
Get client_whitelist_detail obj Author: Pankaj Date: 07/05/2018 Reviewed By: | def get_client_whitelist_detail_obj
@cwd_obj ||= ClientWhitelistDetail.where(client_id: @client_id,
status: GlobalConstant::ClientWhitelistDetail.active_status).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_whitelist\n self.class.get_whitelist\n end",
"def get_whitelist_contract_addresses\n r = success_with_data({contract_addresses: ClientWhitelistDetail.get_active_contract_addressess})\n render_api_response(r)\n end",
"def get_whitelist\n @whitelist ||= []\n end",
... | [
"0.6657267",
"0.6393458",
"0.62964725",
"0.62580043",
"0.6246224",
"0.5874569",
"0.5734722",
"0.5724637",
"0.5649707",
"0.55962306",
"0.55603784",
"0.55383384",
"0.55261356",
"0.55261356",
"0.54984254",
"0.5495215",
"0.54942155",
"0.5481682",
"0.5437061",
"0.54351115",
"0.542... | 0.7617759 | 0 |
Update Edit Kyc requests entry with passed status Author: Pankaj Date: 07/05/2018 Reviewed By: | def update_edit_kyc_request(status, debug_data = nil)
EditKycRequest.using_client_shard(client: @client).
where(id: @edit_kyc_id).update_all(status: status, debug_data: debug_data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_edit_kyc_row(status)\n @edit_kyc_request.status = status\n @edit_kyc_request.save!\n end",
"def update\n @request = Request.find(params[:id])\n\n if params['approved']\n @request.status = Request.statuses[:approved]\n elsif params['denied']\n @request.status = Request.s... | [
"0.7010259",
"0.67595875",
"0.66595924",
"0.63992834",
"0.636766",
"0.6338516",
"0.63107824",
"0.63010544",
"0.6234383",
"0.6222314",
"0.62104464",
"0.62104464",
"0.6210403",
"0.6188547",
"0.6188244",
"0.6166448",
"0.61308074",
"0.61293185",
"0.6128128",
"0.61221784",
"0.6115... | 0.69122684 | 1 |
Check if move shape completely covers any existing word on the board | def covering_moves?(board)
(board.word_positions).any? do |word_posns|
positions >= word_posns
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fits? (shape)\n ->(delta) {\n shape.each do |point|\n if !@board.empty_at(plus(point, delta))\n then\n return false\n end\n end\n return true\n }\n end",
"def won?\n if @board.all? { |i| i == \"\" || i == \" \"} == true\n return false\n end\n ... | [
"0.664461",
"0.6634939",
"0.6610041",
"0.64922833",
"0.6462077",
"0.645345",
"0.64467186",
"0.6436152",
"0.6432624",
"0.6428991",
"0.64255345",
"0.64255345",
"0.64255345",
"0.64255345",
"0.64255345",
"0.64255345",
"0.64255345",
"0.64255345",
"0.64255345",
"0.64255345",
"0.642... | 0.75663334 | 0 |
Check if at least one position within the move shape is adjacent to or overlapping any tile on the board | def touching?(board)
@positions.any? do |row, col|
[[0, 0], [1, 0], [-1, 0], [0, 1], [0, -1]].any? do |dr, dc|
board.nonempty_space?(row + dr, col + dc)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_board?(pos)\n pos.all? {|coord| coord.between?(0, SIZE - 1)}\n end",
"def can_move_to?(position, color)\n @grid.each do |row|\n row.each do |square|\n if (square != nil && square.color == color &&\n square.moves.include?(position))\n return true\n end\n end... | [
"0.7582493",
"0.74987704",
"0.73999375",
"0.7337076",
"0.7312038",
"0.73072255",
"0.73",
"0.72954047",
"0.7285941",
"0.7282977",
"0.72523636",
"0.72507745",
"0.7232841",
"0.7231541",
"0.72312254",
"0.7213711",
"0.72127426",
"0.72053444",
"0.7200381",
"0.718879",
"0.71839094",... | 0.75944525 | 0 |
Check if at least one position within the move shape is within the middle 2x2 square on the board This check is only performed at the beginning of the game | def in_middle_square?(board)
board.middle_square.any? do |posn|
@positions.include?(posn)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_square?(pos)\n y, x = pos\n y.between?(0, @Y_DIM-1) && x.between?(0, @X_DIM-1)\n end",
"def valid_board_coordinates?(x, y)\n x >= 0 && y >= 0 && x < 3 && y < 3\n end",
"def move_valid?(x, y)\n (0...@width).cover?(x) && (0...@height).cover?(y) && !@visited[x][y]\n end",
"def val... | [
"0.7689835",
"0.74217165",
"0.7373325",
"0.7343493",
"0.7336939",
"0.7331897",
"0.73159856",
"0.730534",
"0.72980607",
"0.72698253",
"0.72606754",
"0.72587675",
"0.7253678",
"0.72519237",
"0.7238948",
"0.7228954",
"0.7224614",
"0.72136045",
"0.72002727",
"0.7200104",
"0.71670... | 0.75340044 | 1 |
Method to select user | def select_user(workspace)
print "Enter user id or name: "
choice = gets.chomp
begin
workspace.select_user(choice)
rescue => exception
puts "Error: #{exception.message}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_user(id)\n\n user_array = @users.find do |user|\n user.slack_id == id || user.name == id\n end\n # @selected is an instance of the chosen user\n @selected = user_array\n\n puts \"user #{id} not found\" if @selected.nil?\n\n return @selected\n\n end",
"def select_user(user, role... | [
"0.7015214",
"0.6840701",
"0.6704065",
"0.66335016",
"0.66066587",
"0.6599831",
"0.6589697",
"0.65801895",
"0.65790296",
"0.65765435",
"0.65327007",
"0.65313846",
"0.6464519",
"0.6461022",
"0.6438008",
"0.6425176",
"0.6424944",
"0.64052624",
"0.63702506",
"0.6360831",
"0.6358... | 0.7175798 | 0 |
Method to select channel | def select_channel(workspace)
print "Enter channel id or name: "
choice = gets.chomp
begin
workspace.select_channel(choice)
rescue => exception
puts "Error: #{exception.message}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_selected_channel\n\t\t@selected_channel = current_user.profile.selected_channel.blank? ? current_user.channels.first : current_user.profile.selected_channel\n\tend",
"def set_channel\n @channel = ::Channel.find(params[:id])\n end",
"def channel\n return @channel\n end",
"def radio_set... | [
"0.74613774",
"0.6525564",
"0.65076977",
"0.6477009",
"0.6467551",
"0.64158624",
"0.64124656",
"0.6401561",
"0.6401561",
"0.6401561",
"0.6401561",
"0.6401561",
"0.6401561",
"0.6401561",
"0.6401561",
"0.6401561",
"0.6401561",
"0.64008147",
"0.6337347",
"0.6308315",
"0.6292954"... | 0.6739339 | 1 |
Helper method to provide an easy and terse way to require a block is provided to a method. | def require_block(block_given)
raise ArgumentError, "Must provide a block" unless block_given
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_block; end",
"def block_checker(param) \n [ param , block_given? ]\nend",
"def block_given?() end",
"def get_block(*params); raise('Stub or mock required.') end",
"def block_checker\n block_given?\nend",
"def meth5(&block)\n p block_given?\nend",
"def were_we_given_a_block?\n\tif block_g... | [
"0.74490124",
"0.72320586",
"0.69522595",
"0.69023967",
"0.68883157",
"0.6871347",
"0.6800436",
"0.67641056",
"0.6739181",
"0.6735661",
"0.67109525",
"0.6691524",
"0.66693306",
"0.6662195",
"0.6658708",
"0.66511375",
"0.6611488",
"0.6603694",
"0.6603694",
"0.65722436",
"0.656... | 0.82054174 | 0 |
GET /subsidies/1 GET /subsidies/1.json | def show
@subsidy = Subsidy.find(params[:id])
@order = @subsidy.order
@user = @order.user
@type = @subsidy.subsidy_type
@basis = @subsidy.basis
respond_to do |format|
format.html # show.html.erb
format.json { render json: @subsidy }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @subcriterion = Subcriterion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subcriterion }\n end\n end",
"def index\n @subsidiaries = Subsidiary.all\n end",
"def show\n @subsede = Subsede.find(params[:id])\n\n re... | [
"0.68414354",
"0.67859554",
"0.67126405",
"0.66693056",
"0.6576957",
"0.65373194",
"0.64900327",
"0.64697003",
"0.6417131",
"0.6408977",
"0.64045507",
"0.62973475",
"0.6283805",
"0.6240385",
"0.62354517",
"0.6228287",
"0.6167231",
"0.6134978",
"0.61339545",
"0.609603",
"0.608... | 0.6841278 | 1 |
POST /subsidies POST /subsidies.json | def create
@subsidy = Subsidy.new params[:subsidy]
if @subsidy.save
@order = @subsidy.create_order(user_id: current_user.id, current_academy_group: current_user.academy_group, current_student_name: current_user.name )
end
respond_to do |format|
if @subsidy.save
format.html { redire... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @subsidiary = Subsidiary.new(subsidiary_params)\n\n respond_to do |format|\n if @subsidiary.save\n format.html { redirect_to @subsidiary, notice: \"Subsidiary was successfully created.\" }\n format.json { render :show, status: :created, location: @subsidiary }\n else\n ... | [
"0.6040425",
"0.5947733",
"0.571632",
"0.5694898",
"0.56755614",
"0.5664639",
"0.56543934",
"0.5641265",
"0.5596174",
"0.55873775",
"0.5474956",
"0.5474956",
"0.5437462",
"0.5406324",
"0.53952503",
"0.53757167",
"0.53746116",
"0.53478724",
"0.53437304",
"0.5330107",
"0.532994... | 0.60549223 | 0 |
PUT /subsidies/1 PUT /subsidies/1.json | def update
@subsidy = Subsidy.find(params[:id])
respond_to do |format|
if @subsidy.update_attributes(params[:subsidy])
format.html { redirect_to @subsidy, notice: 'Заявка на материальную выплату успешно обновлена.' }
format.json { head :no_content }
else
format.html { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @subsidiary.update(subsidiary_params)\n format.html { redirect_to @subsidiary, notice: \"Subsidiary was successfully updated.\" }\n format.json { render :show, status: :ok, location: @subsidiary }\n else\n format.html { render :edit, status... | [
"0.62950265",
"0.62445766",
"0.6167451",
"0.59982556",
"0.59961635",
"0.5978087",
"0.59485006",
"0.5943814",
"0.5942379",
"0.5916682",
"0.58695424",
"0.5802181",
"0.5797117",
"0.5786139",
"0.57044566",
"0.56844676",
"0.56788",
"0.56783944",
"0.5645544",
"0.5637354",
"0.562106... | 0.68851966 | 0 |
DELETE /subsidies/1 DELETE /subsidies/1.json | def destroy
@subsidy = Subsidy.find(params[:id])
@subsidy.destroy
respond_to do |format|
format.html { redirect_to subsidies_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\",... | [
"0.7277833",
"0.703216",
"0.6987863",
"0.6964273",
"0.6825698",
"0.67918104",
"0.6771507",
"0.67635065",
"0.6704592",
"0.6693928",
"0.6692089",
"0.66842055",
"0.6672767",
"0.66637796",
"0.66381097",
"0.6619391",
"0.6585345",
"0.6575623",
"0.65717417",
"0.65565",
"0.65384465",... | 0.76272374 | 0 |
helper for invoked tasks | def invoked_tasks
@invoked_tasks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jeweler_tasks=(_arg0); end",
"def task\n end",
"def prepare_task\n end",
"def invoke(task)\n invoked_tasks << task\n end",
"def rake_tasks(&block); end",
"def rake_tasks(&block); end",
"def registeredTasks _args\n \"registeredTasks _args;\" \n end",
"def taskCompleted _args\... | [
"0.7214405",
"0.711594",
"0.6983592",
"0.6925679",
"0.6923014",
"0.6923014",
"0.6845941",
"0.6838095",
"0.68350387",
"0.6775006",
"0.67503244",
"0.67503244",
"0.664845",
"0.6633487",
"0.6617814",
"0.6598796",
"0.6594308",
"0.65457064",
"0.65457064",
"0.65457064",
"0.6504759",... | 0.7369177 | 0 |
fake mina_cleanup! command for testing | def mina_cleanup!
super
@cleanup_called = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mina_cleanup!\n run! if commands.any?\n end",
"def do_cleanup; \"\" end",
"def on_cleanup(unit); end",
"def cleanup!; end",
"def cleanup!; end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end"... | [
"0.8335282",
"0.7236814",
"0.72078454",
"0.69814074",
"0.69814074",
"0.67754626",
"0.67754626",
"0.67754626",
"0.67754626",
"0.6754029",
"0.6754029",
"0.6754029",
"0.6665946",
"0.6665946",
"0.6665946",
"0.6665946",
"0.66262686",
"0.6618052",
"0.65899634",
"0.6541992",
"0.6497... | 0.7577819 | 1 |
Create a new Game and a new Log | def create
# Get date (for table game)
date = params[:start_date]['year']+'-'+params[:start_date]['month']+'-'+params[:start_date]['day'] if params[:start_date]
# Get Opponent id (for the table log)
opponent_id = params[:opponent_id] if params[:opponent_id]
# Get Score (user_logged, for the table lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_new_pg_game\n @log.debug \"bot create_new_pg_game on state #{@state_pg_create}, supported games num: #{@supported_games.size}\"\n if @state_pg_create != :submitted\n #p @supported_games\n @supported_games.each do |item|\n if item[:name] == nil\n @log.warn \"Ignore to send... | [
"0.68688875",
"0.6837059",
"0.6770853",
"0.6709188",
"0.6702237",
"0.6701312",
"0.669249",
"0.6642261",
"0.6634532",
"0.6620242",
"0.6564807",
"0.6556856",
"0.65530175",
"0.65528184",
"0.65511584",
"0.6540198",
"0.6539932",
"0.6517038",
"0.6516041",
"0.6504723",
"0.6500426",
... | 0.7236687 | 0 |
Send 'POST a build status for a commit' request | def post(revision, key, options)
post_path(
path_to_post(revision),
options.merge(key: key),
get_parser(:object, Tinybucket::Model::BuildStatus)
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status_hook\n # We're not interested in PR statuses or branches other than deploy\n unless params[:branches].index { |b| b[:name] == 'deploy' }\n render(plain: 'Not a commit on deploy. Uninterested.') && return\n end\n\n # Create a new CommitStatus\n\n if CommitStatus.find_by(commit_sha: pa... | [
"0.69141454",
"0.6637849",
"0.65086865",
"0.6476035",
"0.642499",
"0.63829637",
"0.62046164",
"0.6189718",
"0.6181083",
"0.6176556",
"0.6092414",
"0.6024845",
"0.59903634",
"0.5974825",
"0.5965569",
"0.5961672",
"0.59075934",
"0.5886202",
"0.58576",
"0.58507144",
"0.57786894"... | 0.6701226 | 1 |
GET /player_records/1 GET /player_records/1.json | def show
@player_record = PlayerRecord.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @player_record }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @player_records = PlayerRecord.all\n end",
"def index\n player = Player.all\n render json: players, status: 200\n end",
"def index\n @players = Player.all\n render json: @players, status: 200\n end",
"def index\n @players = Player.all\n render json: @players\n end",
"de... | [
"0.73404235",
"0.68330175",
"0.6685091",
"0.66720957",
"0.6609679",
"0.6585414",
"0.6568182",
"0.6556044",
"0.65318257",
"0.65101916",
"0.6505791",
"0.6488233",
"0.64132804",
"0.6406293",
"0.6405025",
"0.6389698",
"0.6389698",
"0.6389698",
"0.6389698",
"0.6389698",
"0.6376508... | 0.7360942 | 0 |
GET /player_records/new GET /player_records/new.json | def new
@player_record = PlayerRecord.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @player_record }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @player = Player.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @player.to_json(only: public_attrs) }\n end\n end",
"def new\n @player = Player.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { rend... | [
"0.72038776",
"0.7185605",
"0.7185605",
"0.7185605",
"0.7185605",
"0.7185605",
"0.7185605",
"0.7185605",
"0.7185605",
"0.7185605",
"0.7185605",
"0.7173498",
"0.71299076",
"0.7122013",
"0.7085297",
"0.70849514",
"0.701225",
"0.6994342",
"0.6991879",
"0.6974998",
"0.6928119",
... | 0.7904444 | 0 |
POST /player_records POST /player_records.json | def create
@player_record = PlayerRecord.new(params[:player_record])
respond_to do |format|
if @player_record.save
format.html { redirect_to @player_record, notice: 'Player record was successfully created.' }
format.json { render json: @player_record, status: :created, location: @player_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @player_record = PlayerRecord.new(player_record_params)\n\n respond_to do |format|\n if @player_record.save\n format.html { redirect_to @player_record, notice: 'Player record was successfully created.' }\n format.json { render action: 'show', status: :created, location: @playe... | [
"0.6934933",
"0.64646536",
"0.6285148",
"0.6264383",
"0.6259804",
"0.620973",
"0.62057614",
"0.61647415",
"0.6160445",
"0.6081183",
"0.6040583",
"0.6027328",
"0.60061365",
"0.59875727",
"0.5934743",
"0.588418",
"0.58795685",
"0.5869742",
"0.5845506",
"0.5824015",
"0.5813092",... | 0.69970703 | 0 |
DELETE /player_records/1 DELETE /player_records/1.json | def destroy
@player_record = PlayerRecord.find(params[:id])
@player_record.destroy
respond_to do |format|
format.html { redirect_to player_records_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @player_record.destroy\n respond_to do |format|\n format.html { redirect_to player_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @player.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destro... | [
"0.7711905",
"0.7138487",
"0.70331526",
"0.70285773",
"0.7003259",
"0.6981213",
"0.69798994",
"0.69570076",
"0.6932152",
"0.6932152",
"0.6932152",
"0.6902283",
"0.69019747",
"0.69019747",
"0.69019747",
"0.69019747",
"0.69019747",
"0.69019747",
"0.69019747",
"0.69019747",
"0.6... | 0.7721786 | 0 |
GET /rating_plans GET /rating_plans.xml | def index
@rating_plans = RatingPlan.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @rating_plans }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plans(params = {})\n scope 'default'\n get('plans/', params)\n end",
"def new\n @rating_plan = RatingPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rating_plan }\n end\n end",
"def url\n resource.url + '/application_p... | [
"0.65876144",
"0.653744",
"0.64929944",
"0.64787143",
"0.62854356",
"0.6236378",
"0.6236336",
"0.61919117",
"0.60983694",
"0.6064772",
"0.6064772",
"0.6064772",
"0.60580766",
"0.60436743",
"0.60399675",
"0.601816",
"0.6018146",
"0.5983888",
"0.5982221",
"0.5982221",
"0.594677... | 0.7585327 | 0 |
GET /rating_plans/new GET /rating_plans/new.xml | def new
@rating_plan = RatingPlan.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @rating_plan }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @plan = Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @plan }\n end\n end",
"def create\n @rating_plan = RatingPlan.new(params[:rating_plan])\n\n respond_to do |format|\n if @rating_plan.save\n flash[:notice] = 'Lon... | [
"0.7107507",
"0.7058844",
"0.69923824",
"0.6984491",
"0.6837697",
"0.6831996",
"0.6826793",
"0.6806362",
"0.6800132",
"0.67031586",
"0.6688233",
"0.6676712",
"0.6659254",
"0.66311353",
"0.66309714",
"0.6622992",
"0.66128635",
"0.65733564",
"0.6526152",
"0.6526152",
"0.6513284... | 0.7893959 | 0 |
POST /rating_plans POST /rating_plans.xml | def create
@rating_plan = RatingPlan.new(params[:rating_plan])
respond_to do |format|
if @rating_plan.save
flash[:notice] = 'Long distance plan was successfully created.'
format.html { redirect_to(rating_plans_url) }
format.xml { render :xml => @rating_plan, :status => :created, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @rating_plan = RatingPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rating_plan }\n end\n end",
"def index\n @rating_plans = RatingPlan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { ren... | [
"0.62499833",
"0.60849607",
"0.6008511",
"0.5908543",
"0.57798344",
"0.5764623",
"0.5735305",
"0.5663835",
"0.55986744",
"0.555349",
"0.5537724",
"0.55376047",
"0.54918766",
"0.5463839",
"0.5462192",
"0.543163",
"0.543163",
"0.54212004",
"0.54167897",
"0.53964454",
"0.5380326... | 0.69016844 | 0 |
PUT /rating_plans/1 PUT /rating_plans/1.xml | def update
@rating_plan = RatingPlan.find(params[:id])
respond_to do |format|
if @rating_plan.update_attributes(params[:rating_plan])
flash[:notice] = 'Long distance plan was successfully updated.'
format.html { redirect_to(rating_plans_url) }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n if @plan.update_attributes(params[:plan])\n flash[:notice] = 'Plan was successfully updated.'\n format.html { redirect_to(@plan) }\n format.xml { head :ok }\n else\n format.html { render :action =>... | [
"0.61993",
"0.6193326",
"0.619318",
"0.6168486",
"0.61232173",
"0.6027421",
"0.6002753",
"0.6001152",
"0.6001152",
"0.59902835",
"0.5989204",
"0.5976377",
"0.59234136",
"0.59221417",
"0.5874372",
"0.5861111",
"0.585847",
"0.58545893",
"0.58199435",
"0.5804807",
"0.5804139",
... | 0.68665075 | 0 |
DELETE /rating_plans/1 DELETE /rating_plans/1.xml | def destroy
@rating_plan = RatingPlan.find(params[:id])
if @rating_plan.destroy then
respond_to do |format|
format.html { redirect_to(rating_plans_url) }
format.xml { head :ok }
end
else
render :action => :edit
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @test_plan = TestPlan.find(params[:id])\n @test_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_plans_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @socialize_plan = SocializePlan.find(params[:id])\n @socialize_plan.destroy\n\n ... | [
"0.66742855",
"0.66412205",
"0.66309875",
"0.66267705",
"0.65878797",
"0.6558436",
"0.6456276",
"0.6445479",
"0.6411808",
"0.64114475",
"0.6396348",
"0.6385949",
"0.6385107",
"0.6377032",
"0.6376092",
"0.6303812",
"0.62945193",
"0.6291049",
"0.6273036",
"0.6253792",
"0.623855... | 0.70526993 | 0 |
You must check within string (s) to find all of the mating pairs, and return a string containing only them. Line them up for inspection. Rules: Bears are either 'B' (male) or '8' (female), Bears must be together in male/female pairs 'B8' or '8B', Mating pairs must involve two distinct bears each ('B8B' may look fun, bu... | def bears(x,s)
#scan for occurrences of 8B or B8
bear_array = s.scan(/(8B)|(B8)/) || []
#if the number of bear pairs is greater or the same as x - true, else false
bear_number = bear_array.length >= x
#join occurences of bear pairs
all_bear = bear_array.join
#put into correct format
[all_bear, bear_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pairs_of_bears(x,s)\n pairs = s.scan(/(B8|8B)/)\n [pairs.join, pairs.size >= x]\nend",
"def bears(x, s)\n mating_bears = s.scan(/8B|B8/) \n p [mating_bears.join, mating_bears.size >= x]\nend",
"def bears(num, str)\n i = 0\n answer = []\n arr = str.split('')\n while i < arr.length - 1\n if (arr[i... | [
"0.7131605",
"0.7026021",
"0.6779435",
"0.61081254",
"0.60334545",
"0.580523",
"0.5778564",
"0.57199764",
"0.57171935",
"0.568065",
"0.56760865",
"0.56738704",
"0.564754",
"0.5627239",
"0.55935025",
"0.5593054",
"0.5592817",
"0.55912673",
"0.55816287",
"0.5579921",
"0.5576142... | 0.7132431 | 0 |
expected_command name of command exepcted to have been run options: global_options => hash of expected options command_options => hash of expected command options args => array of expected args | def assert_command_ran_with(expected_command,options)
lambda {
global_options = options[:global_options] || { :help => false }
@run_results.each do |command,results|
if command == expected_command
assert_equal(indifferent_hash(global_options),results[0])
assert_equal(indiffer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auxiliary_commands\n { \"aux_extra_command\" => \"Run this auxiliary test commmand\" }\n end",
"def given_options\n @given_options ||= command_options.select do |option|\n @arguments[option.name] || option.include?\n end\n end",
"def test_options\n c = cli\n as... | [
"0.62115204",
"0.61855406",
"0.6135736",
"0.6129637",
"0.6037837",
"0.59967905",
"0.5976291",
"0.59631586",
"0.59371173",
"0.59231365",
"0.5904173",
"0.5885019",
"0.5832698",
"0.58268726",
"0.5822624",
"0.57960886",
"0.57688636",
"0.57612675",
"0.57295376",
"0.5708947",
"0.56... | 0.8007145 | 0 |
Initializes a new Tree. The input tree should be a Grit::Tree or nil. | def initialize(tree=nil)
@index = nil
@tree = tree
if tree
self.mode = tree.mode
self.sha = tree.id
else
@mode = nil
@sha = nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize()\n @root = Node.new(nil)\n end",
"def initialize(tree, options={})\n @tree = tree\n @options = options\n end",
"def initialize(tree=nil)\n @visited = [] \n @tree = tree\n end",
"def initialize (tree, parent = nil, id = \"\") # id - DEBUG\n @tree = tree\n ... | [
"0.7603164",
"0.7600311",
"0.7509413",
"0.7484647",
"0.7271977",
"0.7260233",
"0.7180666",
"0.71705073",
"0.71573734",
"0.7041733",
"0.69742095",
"0.6956994",
"0.69543445",
"0.6940484",
"0.69221115",
"0.69201505",
"0.6917971",
"0.69156694",
"0.69150084",
"0.6888173",
"0.68203... | 0.7670269 | 0 |
Sets mode, symbolizing if necessary. Mode may be set to nil in which case the git.default_tree_mode is adopted when the tree is written. | def mode=(mode)
@mode = mode ? mode.to_sym : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_tree_mode=(mode)\n @default_tree_mode = mode.to_sym\n end",
"def set_mode(new)\n @mode = new\n end",
"def set_mode(m)\n @mode = m\n end",
"def mode=(new_mode)\n @mode , @previous_mode = new_mode, @mode\n build_chains() if @mode != @previous_mode && @previous_mode != ni... | [
"0.78304595",
"0.6350568",
"0.6345226",
"0.6299833",
"0.62631255",
"0.62540215",
"0.61907864",
"0.60984665",
"0.6040486",
"0.59800565",
"0.596614",
"0.58015573",
"0.58015573",
"0.5768204",
"0.5724571",
"0.564111",
"0.56403923",
"0.56334925",
"0.56322634",
"0.56166774",
"0.561... | 0.64811647 | 1 |
Sets the sha for self. Sha may be set to nil, in which case it will be calculated when a repo is committed. | def sha=(sha)
@sha = sha ? string(sha) : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sha=(sha)\n if sha.nil?\n fail ArgumentError, 'invalid value for \"sha\", sha cannot be nil.'\n end\n pattern = Regexp.new(\"^[a-fA-F0-9]{40}$\")\n if sha !~ pattern\n fail ArgumentError, \"invalid value for \\\"sha\\\", must conform to the pattern #{pattern}.\"\n end\n ... | [
"0.72731614",
"0.69865334",
"0.66089493",
"0.66061354",
"0.6301872",
"0.6270857",
"0.6263051",
"0.6255764",
"0.6162804",
"0.6087008",
"0.6038805",
"0.59734964",
"0.59583074",
"0.59396875",
"0.5910008",
"0.5837153",
"0.5835875",
"0.57145476",
"0.57110894",
"0.5645465",
"0.5644... | 0.7965656 | 0 |
Returns the sha representing the contents for self. If check is true, sha will check that neither self nor any subtree is modified before returning the sha. If modified, the sha is set to nil to flag a repo to recalculate the sha on commit. Note that check does not validate the sha correctly represents the contents of ... | def sha(check=true)
if @sha && check
index.each_value do |value|
if value.kind_of?(Tree) && value.sha.nil?
@sha = nil
break
end
end
end
@sha
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sha\n @commit.sha\n end",
"def checksum\n @checksum ||= begin\n if empty?\n EMPTY_CHECKSUM\n else\n ::Digest::MD5.hexdigest(children.map(&:checksum).join)\n end\n end.to_s\n end",
"def sha\n @sha ||= ENV['HEROKU_SLUG_COMMIT'] || ENV['GIT_SH... | [
"0.60745543",
"0.5999243",
"0.59560484",
"0.5666215",
"0.55715674",
"0.5568302",
"0.5567877",
"0.5548553",
"0.5536223",
"0.5381886",
"0.5299429",
"0.5290372",
"0.5265109",
"0.52553207",
"0.5217262",
"0.5206896",
"0.51951426",
"0.5189302",
"0.5175264",
"0.5094466",
"0.508662",... | 0.7771129 | 0 |
Sets the entry for the specified path. The entry should be a [:mode,sha] array, or a Tree. A nil entry indicates removal. | def []=(path, entry)
# ensure an unexpanded tree is removed
index.delete(path.to_sym)
path = string(path)
case entry
when Array
mode, sha = entry
index[path] = [mode.to_sym, string(sha)]
when Tree
index[path] = entry
when nil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def []=(path, entry)\n raise ArgumentError unless entry && (Reference === entry || GitObject === entry)\n path = normalize_path(path)\n if path.empty?\n raise 'Empty path'\n elsif path.size == 1\n raise 'No blob or tree' if entry.type != :tree && entry.type != :blob\n entry... | [
"0.7805141",
"0.6272198",
"0.6255079",
"0.6150573",
"0.6107303",
"0.5951925",
"0.58503956",
"0.5837144",
"0.5776647",
"0.57765865",
"0.5704717",
"0.57025194",
"0.56865734",
"0.56621194",
"0.56598246",
"0.55974686",
"0.5556738",
"0.5556738",
"0.5551822",
"0.5538243",
"0.553569... | 0.84797424 | 0 |
Yields each (path, entry) pair to the block, ordered by path. Entries can be [:mode,sha] arrays or Trees. If expand is true then subtrees will be expanded, but strongly consider whether or not expansion is necessary because it is computationally expensive. | def each_pair(expand=false)
# sorting the keys is important when writing the tree;
# unsorted keys cause warnings in git fsck
keys = index.keys.sort_by {|key| key.to_s }
store = expand ? self : index
keys.each {|key| yield(key, store[key]) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_tree(expand=false)\n each_pair(expand) do |key, value|\n next unless value.kind_of?(Tree)\n yield(key, value)\n end\n end",
"def each_entry( &block ) # :yield: p\n Dir.foreach( expand_tilde ) { |f| yield self.class.new( f ) }\n end",
"def expand!\n @childr... | [
"0.6730499",
"0.57560694",
"0.5573845",
"0.5487613",
"0.54083276",
"0.536109",
"0.53430575",
"0.52939165",
"0.529356",
"0.5257853",
"0.52299404",
"0.5221142",
"0.5167941",
"0.5163192",
"0.5099014",
"0.50867206",
"0.5054177",
"0.5047344",
"0.50428987",
"0.50428694",
"0.5001117... | 0.63229215 | 1 |
Yields the (path, [:mode, sha]) pairs for each blob to the block. | def each_blob
each_pair do |key, value|
next unless value.kind_of?(Array)
yield(key, value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each\n git.tree.each_pair(true) do |ab, xyz_tree|\n next unless ab.length == 2\n \n xyz_tree.each_pair(true) do |xyz, target_tree|\n source = \"#{ab}#{xyz}\"\n \n target_tree.keys.each do |target|\n doc_sha = assoc_sha(source, target)\n ... | [
"0.65518755",
"0.5950941",
"0.58395934",
"0.5735768",
"0.5733372",
"0.5693342",
"0.5656007",
"0.5515011",
"0.5514569",
"0.5460652",
"0.5440558",
"0.5431845",
"0.5361166",
"0.5333479",
"0.5318991",
"0.5294162",
"0.5272707",
"0.52592605",
"0.52592605",
"0.5237732",
"0.522227",
... | 0.6012491 | 1 |
Yields the (path, entry) pairs for each tree to the block. Subtrees are expanded if specified, in which case all entries will be Trees. Without expansion, entries may be [:mode,sha] arrays or Trees. | def each_tree(expand=false)
each_pair(expand) do |key, value|
next unless value.kind_of?(Tree)
yield(key, value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_leaf#:yields: leaf\n leafs.compact!\n \n leafs.each do |leaf|\n yield leaf\n end\n end",
"def visit_tree(files, &block)\n case files\n when Array\n files.each { | f| visit_tree(f,&block)}\n when String\n yield(:file, files) if block_given?\n when Hash\... | [
"0.6413841",
"0.63746023",
"0.6294162",
"0.6193463",
"0.610622",
"0.61000586",
"0.6096548",
"0.60129863",
"0.59107935",
"0.5897115",
"0.58352745",
"0.5832547",
"0.5821113",
"0.57917076",
"0.5743171",
"0.57265925",
"0.56765664",
"0.5660373",
"0.5660373",
"0.5606384",
"0.559616... | 0.6982761 | 0 |
Returns the subtree indicated by the specified segments (an array of paths), or nil if no such subtree exists. If force is true then missing subtrees will be created. | def subtree(segments, force=false)
return self if segments.empty?
key = segments.shift
tree = self[key]
if !tree.kind_of?(Tree)
return nil unless force
self[key] = tree = Tree.new(nil)
end
tree.subtree(segments, force)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subtree(nodes)\n nodes = nodes.find_all do |x|\n @pathway.graph[x]\n end\n return self.class.new if nodes.empty?\n # creates subtree\n new_tree = self.class.new\n nodes.each do |x|\n new_tree.add_node(x)\n end\n self.each_edge do |node1, node2, edge|\n ... | [
"0.45992774",
"0.44474715",
"0.44462693",
"0.43346572",
"0.43158892",
"0.42002097",
"0.41826096",
"0.41681543",
"0.41275838",
"0.41095957",
"0.40864483",
"0.40858105",
"0.4079667",
"0.40679294",
"0.40442598",
"0.40191653",
"0.40040874",
"0.40011096",
"0.39895895",
"0.39809293",... | 0.7546555 | 0 |
Returns true if the to_hash results of self and another are equal. | def eql?(another)
self.to_hash == another.to_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n self.hash == other.hash\n end",
"def eql?(other)\n @hash == other.hash\n end",
"def ==(other)\n self.to_hash == other.to_hash\n end",
"def eql?(other)\n hash == other.hash\n end",
"def ==(another)\n self.to_hash == another.to_hash\n end",
"def =... | [
"0.8171131",
"0.81432235",
"0.8117461",
"0.80844975",
"0.8077489",
"0.8040899",
"0.80232143",
"0.7997133",
"0.7959498",
"0.78603953",
"0.78603953",
"0.78510064",
"0.7810805",
"0.7774336",
"0.77694684",
"0.77283955",
"0.7709391",
"0.76637954",
"0.7663006",
"0.7573572",
"0.7501... | 0.82347786 | 0 |
Writes self to the git instance. All subtrees will likewise be written. Returns a [mode, sha] entry. Tree format: mode name\0[packedsha]mode name\0[packedsha]... Note there are no newlines separating tree entries. | def write_to(git)
self.mode ||= git.default_tree_mode
self.sha ||= begin
lines = []
each_pair(false) do |key, entry|
mode, sha = case entry
when Tree then entry.write_to(git)
when Array then entry
else [entry.mode, entry.id]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_tree\n invoke(:write_tree)\n end",
"def writeTree(file)\n file.write @tree.toString\n end",
"def writeTree(file)\n file.write toString\n end",
"def git_commit\n init_structure\n sha = add_all_changes_to_git\n \n if self.attributes.has_key?(\"version\"... | [
"0.61335045",
"0.5495169",
"0.5441157",
"0.5373092",
"0.5322939",
"0.5270029",
"0.52197844",
"0.5063793",
"0.49222907",
"0.49000007",
"0.4866056",
"0.4851852",
"0.48490462",
"0.48488697",
"0.48481247",
"0.48481247",
"0.48267195",
"0.48267195",
"0.48230752",
"0.47873995",
"0.4... | 0.82213897 | 0 |
returns or initializes the internal working tree (index) | def index # :nodoc:
@index ||= begin
index = {}
@tree.contents.each do |obj|
key = obj.name
if obj.respond_to?(:contents)
index[key.to_sym] = obj
else
index[string(key)] = to_entry(obj)
end
end i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_index!\n balanced_trees = Hash[\n @index_trees.map { |type, tree| [type, tree.balanced_copy] }\n ]\n return ZDSearch::BinaryTreeSearchIndex.new(\n sorted_index_trees: balanced_trees,\n tokeniser: @tokeni... | [
"0.6748782",
"0.66803396",
"0.65653557",
"0.6512077",
"0.6486935",
"0.6448609",
"0.6392807",
"0.63819784",
"0.62901676",
"0.6146212",
"0.61416715",
"0.60972023",
"0.6045826",
"0.60239",
"0.59983766",
"0.5990907",
"0.5949187",
"0.591631",
"0.59153414",
"0.5912172",
"0.5911582"... | 0.688053 | 0 |
helper to lookup the string table entry for key | def string(key) # :nodoc:
Tree.string_table[key.to_s]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(key)\n key = normalize(key) or return\n table[key]\n end",
"def table_lookup(key, arg, table = nil)\n lookup_key = key[1..-1].to_sym\n\n lookup_table = table || @tables[lookup_key]\n\n if lookup_table.kind_of? Hash\n lookup_table[arg.to_sym] \n elsif lo... | [
"0.7178625",
"0.70469314",
"0.6788",
"0.66929173",
"0.668109",
"0.6559091",
"0.6559091",
"0.6527112",
"0.64535165",
"0.64333427",
"0.6332818",
"0.62831956",
"0.62831956",
"0.62831956",
"0.62831956",
"0.62680703",
"0.6249338",
"0.61978006",
"0.61936915",
"0.6184185",
"0.617398... | 0.7079127 | 1 |
converts obj into a [:mode, sha] entry | def to_entry(obj) # :nodoc:
[obj.mode.to_sym, string(obj.id)]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hexdigest(obj)\n digest = Digest::SHA1.new\n queue = [obj]\n\n while queue.length > 0\n obj = queue.shift\n klass = obj.class\n\n if klass == String\n digest << 'String'\n digest << obj\n elsif klass == Symbol\n digest << 'Symbol'\n ... | [
"0.6100308",
"0.6100308",
"0.60617816",
"0.60462457",
"0.60282034",
"0.5782735",
"0.568956",
"0.56650895",
"0.56451905",
"0.56451374",
"0.56200594",
"0.554841",
"0.554518",
"0.54657614",
"0.5419555",
"0.5406426",
"0.53950363",
"0.5388493",
"0.53863984",
"0.5374302",
"0.536072... | 0.68427765 | 0 |
Many fields of the XML the EPO provides have a field `change_gazette_num`. It is a commercial date (year + week) that describes in which week the element has been changed. This method parses them and returns the most recent date found. | def latest_update
gazette_nums = EpoOps::Util.parse_hash_flat(@raw_data, 'change_gazette_num')
nums = gazette_nums.map { |num| EpoOps::Util.parse_change_gazette_num(num) }.keep_if { |match| !match.nil? }
nums.max
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date\n node = @meta.at_xpath('./a:identification/a:FRBRWork/a:FRBRdate[@name=\"Generation\"]', a: NS)\n node && node['date']\n end",
"def get_revdate(doc_path)\n doc = Nokogiri::HTML(File.open(doc_path)) { |config| config.strict.nonet}\n revdate = doc.search('//span[@id=\"revdate\"]').text.str... | [
"0.57421196",
"0.5583268",
"0.5532354",
"0.5524651",
"0.5515925",
"0.54961735",
"0.51887906",
"0.5155236",
"0.51410586",
"0.51131296",
"0.49904636",
"0.4961537",
"0.49391726",
"0.49261656",
"0.4913725",
"0.49080116",
"0.49037653",
"0.48729324",
"0.4777428",
"0.47758508",
"0.4... | 0.63135695 | 0 |
Get the public key that shall be used for authentication. Furthermore, the method assures that the agent, which was registered in the GIT_SSH variable, is available. | def public_key
return @public_key if File.exist?(@agent_file) && File.exist?(@key_file)
# create the agent and key if at least one file does not exist (anymore)
create_agent_key_combo
@public_key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_key\n @key ||= File.read(\"#{ENV['HOME']}/.ssh/id_rsa.pub\")\nend",
"def get_public_key\n return @public_key\n end",
"def public_key\n @priv.public_key\n end",
"def public_key\n return self.authentication.public_key\n end",
"def public_key\n return self.authenticati... | [
"0.7471132",
"0.7267451",
"0.7211165",
"0.71842206",
"0.71842206",
"0.71329683",
"0.6992695",
"0.6868023",
"0.6823882",
"0.6776364",
"0.6776364",
"0.67561305",
"0.6713748",
"0.6686825",
"0.6650589",
"0.6650589",
"0.66451293",
"0.66257596",
"0.66085815",
"0.65861386",
"0.65801... | 0.74481666 | 1 |
Merges the given facet with this one. | def merge(other)
BaseFacet.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_facet_field(*) super end",
"def merge_facets(a, b)\n na = normalize_facet(a)\n nb = normalize_facet(b)\n nb.inject(na.dup) do |result, (facet, nested_facets)|\n result[facet] = merge_facets(na[facet], nested_facets)\n result\n end\n end",
"def merge(with); end",
"... | [
"0.58081686",
"0.5633429",
"0.5528031",
"0.5411946",
"0.53832805",
"0.5345427",
"0.52774006",
"0.52756286",
"0.52355826",
"0.522998",
"0.51562166",
"0.51443785",
"0.51130384",
"0.5057922",
"0.5052791",
"0.49873954",
"0.4986037",
"0.49518445",
"0.49456",
"0.49297082",
"0.49021... | 0.7012886 | 0 |
If 'options[:id]' has any values, this method returns SQL query text to find all Products with ID values in the array returned by the 'ids' method. | def ids_in
"p.id IN :ids" if options[:id].present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def products\n if params[:ids]\n arraycheck = JSON.parse(params[:ids])\n if arraycheck.length > 0\n @products = SupplierRecord.where(contractnumber: arraycheck).joins(:product).select([\"products.id\" , \"products.name AS description\"]).uniq\n end\n else\n \n end\n end",
"def g... | [
"0.5909829",
"0.57364225",
"0.57047606",
"0.56207263",
"0.55637485",
"0.55355585",
"0.55232877",
"0.5409488",
"0.5364558",
"0.53453755",
"0.5344119",
"0.5327526",
"0.5326745",
"0.53156",
"0.53126544",
"0.53020906",
"0.52300346",
"0.52298",
"0.51967824",
"0.51730406",
"0.51265... | 0.64157814 | 0 |
'options[:id]' returns a String. This function removes the array brackets, then splits the String on the comma, inserts them into an actual array, then remaps the values as integers. | def ids
options[:id][1..-2].split(",").map(&:to_i)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getIdFromString(option)\n str = option.split(\" \")\n str[1].to_i\nend",
"def get_ids(array)\n ids = \"(\"\n array.each do |me|\n ids << me.id.to_s + \",\"\n end\n ids = ids.chomp(\",\")\n ids = ids + \")\"\n return ids\n\n end",
"def normalize_id(a)\n case a\n w... | [
"0.61838675",
"0.6180591",
"0.6036685",
"0.60323846",
"0.5908255",
"0.5889216",
"0.5629043",
"0.56185174",
"0.5607379",
"0.5600257",
"0.55998456",
"0.5555312",
"0.5454183",
"0.5420082",
"0.54195863",
"0.5384121",
"0.53575844",
"0.53462946",
"0.5322785",
"0.5322785",
"0.532278... | 0.7574078 | 0 |
returns markets that will be turned inplay the next 24hour need a subscription API account to test this | def getInPlayMarkets(options = {})
packet = load_defaults(options, {:locale => @@dlocale})
ans = execute_remote(:exchange_uk) do |driver|
header = get_api_req_header
$logger.info "Calling getInPlayMarkets with #{packet.inspect.to_s}"
packet = packet.merge(header)
response = driver.getInP... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ticker(*markets); end",
"def markets\n get('/markets')['markets']\n end",
"def market_data\n endpoint = \"#{HOST}/v1/cryptocurrency/listings/latest\"\n get(endpoint)\n end",
"def tick\n exchange_market_codes = self.exchange_markets.pluck(:code)\n\n api.marketdata['return']['markets']... | [
"0.598423",
"0.5947817",
"0.5893863",
"0.58049345",
"0.5647974",
"0.5596054",
"0.5466402",
"0.5450129",
"0.5414993",
"0.5413973",
"0.54042375",
"0.53827375",
"0.5368223",
"0.53305686",
"0.5306445",
"0.52996093",
"0.52926356",
"0.52887374",
"0.5282082",
"0.5281039",
"0.5256584... | 0.6270031 | 0 |
Add resource to the treasury | def add(resource)
get_resource(resource.type).add(resource.value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def <<(resource)\n relate_resource(resource)\n super\n end",
"def publishResourceAdd(app_id, run_id, resource)\n # Cache\n cache = RoomPlacesCachePublish.get_cache(app_id, run_id)\n\n cache.resources_add([resource])\n\t#nutella.net.publish('location/resources/added', {:resources => [resource]})\n... | [
"0.6449215",
"0.6266466",
"0.6123963",
"0.6089813",
"0.60842824",
"0.60076106",
"0.58663714",
"0.58067375",
"0.5798303",
"0.57845515",
"0.5771317",
"0.5763795",
"0.5612485",
"0.5608216",
"0.5602991",
"0.56026316",
"0.55959004",
"0.55667347",
"0.55577517",
"0.5536657",
"0.5523... | 0.6542698 | 0 |
Get resource from the treasury | def get(resource_type, resource_value)
# Check if resource if available from treasury
if available?(resource_type, resource_value)
# Resource is taken from treasury
get_resource(resource_type).consume(resource_value)
# Return asked resource
Resource.new(resource_type, resource_value)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource\n execute(resource_path, method: :get)\n end",
"def read_resource(resource)\n resource\n end",
"def read_resource(resource)\n resource\n end",
"def resource\n @resource ||= resource_set.createResource(uri)\n end",
"def get_resource_to_use\n return @resources.firs... | [
"0.6775814",
"0.6490394",
"0.6490394",
"0.6490225",
"0.6349503",
"0.6344029",
"0.63139623",
"0.62108034",
"0.6188188",
"0.61562157",
"0.6150155",
"0.61357945",
"0.61307186",
"0.6111708",
"0.61017716",
"0.6098565",
"0.6098565",
"0.6086122",
"0.6072987",
"0.6049112",
"0.6048558... | 0.69477564 | 0 |
Set default treasury resources | def create_default_resources
resources = [:timber, :iron, :gold, :copper, :diamond, :clay, :marble,
:coal, :oil, :gas, :water, :uranium]
@resources = []
resources.each do |r|
@resources << Resource.new(r, 1000)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(resources) ; end",
"def deferred_defaults\n set_default_path\n set_default_properties\n end",
"def setup\n # Create a standard project (30 days)\n @Project1 = Project.new(Date.new(2000, 1, 1), Date.new(2000, 1, 10))\n # Create a standard calendar (30 days, 1 hour per... | [
"0.55334216",
"0.5519498",
"0.5463585",
"0.5421544",
"0.5395214",
"0.5395214",
"0.53453493",
"0.53453493",
"0.53453493",
"0.53453493",
"0.53453493",
"0.53453493",
"0.53349316",
"0.52687275",
"0.524793",
"0.5229245",
"0.52273005",
"0.52255946",
"0.5217082",
"0.5209391",
"0.518... | 0.6195068 | 0 |
Returns true or false if the logged in user has a role level greater than or equal to that which is given | def rights?(level)
logged_in? and @user.role_id >= level
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_at_least_level?(level)\n return false if !ADMIN_RANKING[level] or !ADMIN_RANKING[self.role]\n return ADMIN_RANKING[self.role] >= ADMIN_RANKING[level]\n end",
"def has_access?(level)\n if (level || 0) > (current_user.try(:admin_level) || 0) then return false else return true end\n end",
"def m... | [
"0.7791759",
"0.7492157",
"0.74833447",
"0.7370687",
"0.73142105",
"0.71700126",
"0.7104489",
"0.7010086",
"0.6995696",
"0.6979167",
"0.6962104",
"0.68771195",
"0.68771195",
"0.685872",
"0.68559986",
"0.6854205",
"0.6842655",
"0.6819226",
"0.6805091",
"0.6785846",
"0.6782537"... | 0.8300953 | 0 |
Shows a text preview limited to the length given | def preview(text, length=400)
text.split(/\s/).inject("") do |out, chunk|
if (out.size + 1 + chunk.size) <= length
out + " " + chunk
else
return out + " ..."
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview_text(maxlength = 30)\n return \"\" if description.blank?\n my_contents = description[\"contents\"]\n return \"\" if my_contents.blank?\n content_flagged_as_preview = my_contents.select { |a| a[\"take_me_for_preview\"] }.first\n if content_flagged_as_preview.blank?\n cont... | [
"0.7996327",
"0.793258",
"0.7864441",
"0.77253526",
"0.7620585",
"0.74823815",
"0.6911499",
"0.68886155",
"0.68311155",
"0.6815894",
"0.67738473",
"0.67738473",
"0.66989386",
"0.66521055",
"0.66383344",
"0.6560616",
"0.6551576",
"0.6508182",
"0.6442363",
"0.63716465",
"0.6346... | 0.8373597 | 0 |
Builds a button for updating a user role | def role_button(user, name, value)
selected = (user.role_id == value ? true : false)
content_tag(:label, class: "btn btn-primary #{selected ? 'active' : ''}", onclick: "update_role(this, #{user.id}, 'update_alert_#{user.id}'); return false;") do
radio_button_tag("user_role_#{user.id}", value, selected) + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @user = User.find(params[:user_id])\n @roles = Role.all\n \n if current_user.is_admin?\n @user.roles.clear\n @roles.each do |role|\n if (params[:role][:role][role.rolename][:hasrole].to_s == 1.to_s)\n @user.roles << role\n ... | [
"0.63022476",
"0.62362534",
"0.6203734",
"0.62010837",
"0.61839336",
"0.6117705",
"0.60900456",
"0.6083034",
"0.6050751",
"0.6041754",
"0.6024603",
"0.60211796",
"0.6014158",
"0.6009762",
"0.5996954",
"0.5991843",
"0.5980335",
"0.59508246",
"0.59442014",
"0.5940903",
"0.59358... | 0.73133063 | 0 |
Button for adding to cart if it's not already it it | def cart_add_button(cart,exam)
if cart.include?(exam.id)
button_to("View Cart (#{cart.size})", {controller: :exams, action: :show_cart}, class: "btn btn-primary view-cart")
else
button_to("Add to Cart", "#", id: "add_link_#{exam.id}", data: exam.id, class: "btn btn-primary add-to-cart", onclick: "re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_cart_button_item_page\n find(ADD_TO_CART_ID)\n end",
"def add_to_cart_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.a.id(\"/AddToCart/\"), format_method(__method__), @spec)\n end",
"def add_to_cart\n if current_user.cart\n update\n else\n ... | [
"0.7767163",
"0.75553113",
"0.7452238",
"0.742573",
"0.7329858",
"0.72976494",
"0.7271867",
"0.7041292",
"0.7017283",
"0.69665885",
"0.6956165",
"0.6956147",
"0.6915087",
"0.6888976",
"0.6853663",
"0.68510437",
"0.6834393",
"0.68276477",
"0.6813375",
"0.67628235",
"0.6760481"... | 0.7874875 | 0 |
Returns the report status of the given exam | def status_for(exam)
if exam.last_report
exam.last_report.status
else
"Ordered"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exam_details(ex)\n exams_data = ex.exams.all\n flag = false\n exams_data.each do |exam|\n exam.exam_scores.each do |es|\n flag = true if es.is_failed?\n end\n exams << exam if flag == true\n end\n exams\n end",
"def send_status_for(exam)\n if exam.job_transaction\n ... | [
"0.6648434",
"0.6339334",
"0.63184685",
"0.6295131",
"0.62848586",
"0.6177433",
"0.6091445",
"0.6043307",
"0.6012719",
"0.59497035",
"0.5939101",
"0.5936013",
"0.59182525",
"0.5861439",
"0.5844497",
"0.5815646",
"0.58151996",
"0.57886076",
"0.57453436",
"0.571789",
"0.5671871... | 0.8170418 | 0 |
Returns the send status of the given exam | def send_status_for(exam)
if exam.job_transaction
exam.job_transaction.comments
else
"not sent"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status_for(exam)\n if exam.last_report\n exam.last_report.status\n else\n \"Ordered\"\n end\n end",
"def sent?\n status == \"sent\"\n end",
"def sent?\n self.status == 'sent'\n end",
"def status\n { 'status' => success ? 'sent' : 'failed' }\n end",
"def get_status\n ... | [
"0.6780147",
"0.6576165",
"0.6441037",
"0.61467195",
"0.61262566",
"0.6107082",
"0.6077223",
"0.6038259",
"0.6006298",
"0.58984506",
"0.5896235",
"0.58871144",
"0.58528554",
"0.5851949",
"0.58205867",
"0.5818956",
"0.5793077",
"0.5785651",
"0.5710081",
"0.5707029",
"0.5704936... | 0.7582652 | 0 |
Checks if consent has already been given and returns the appropriate action button | def obtain_consent_button(patient)
if patient.consented?
button_to("Select", {controller: :exams, action: :index, patient_id: patient.id}, {class: "btn btn-primary"})
else
button_to("Select", "#", onclick: "obtain_consent(#{patient.id},$.parseJSON(#{patient.attributes.to_json.to_json}));return false... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_consenting?; end",
"def reconsent?\n @activity_name == \"Reconsent\"\n end",
"def consent_activity?\n @activity_type.to_s.include? \"Consent\"\n end",
"def authorize_consent_edit(id)\n unless current_user.consents.exists?(id.to_i)\n redirect_back fallback_location: root_path\n end... | [
"0.654251",
"0.6394656",
"0.62726563",
"0.62317365",
"0.6203566",
"0.5999481",
"0.5835205",
"0.5818293",
"0.580189",
"0.56419533",
"0.56373024",
"0.5595789",
"0.5587965",
"0.55801624",
"0.5565332",
"0.5554824",
"0.55399007",
"0.5533995",
"0.5519923",
"0.5495303",
"0.54922444"... | 0.649362 | 1 |
GET /aljnabeen_tanks GET /aljnabeen_tanks.json | def index
@aljnabeen_tanks = AljnabeenTank.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tanks = Tank.all\n end",
"def index\n @tranks = Trank.all\n respond_to do |format|\n format.html\n format.json { render :json => @tranks, :include => :groups, :except => [:created_at, :updated_at]}\n end\n end",
"def index\n @tohamhalshamel_tanks = TohamhalshamelTank.all... | [
"0.7392212",
"0.686226",
"0.64823616",
"0.6399315",
"0.6399176",
"0.6189056",
"0.6145434",
"0.6128529",
"0.6064985",
"0.5768533",
"0.5759517",
"0.57499975",
"0.57380205",
"0.57026327",
"0.5662112",
"0.56600034",
"0.5658669",
"0.5644632",
"0.561451",
"0.5596048",
"0.5589805",
... | 0.69721335 | 1 |
POST /aljnabeen_tanks POST /aljnabeen_tanks.json | def create
@aljnabeen_tank = current_user.aljnabeen_tanks.build(aljnabeen_tank_params)
respond_to do |format|
if @aljnabeen_tank.save
format.html { redirect_to @aljnabeen_tank, notice: 'Aljnabeen tank was successfully created.' }
format.json { render :show, status: :created, location: @al... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tanks = Tank.all\n end",
"def create\n @tohamhalshamel_tank = current_user.tohamhalshamel_tanks.build(tohamhalshamel_tank_params)\n\n respond_to do |format|\n if @tohamhalshamel_tank.save\n format.html { redirect_to @tohamhalshamel_tank, notice: 'Tohamhalshamel tank was success... | [
"0.6333995",
"0.62118393",
"0.62087977",
"0.59587723",
"0.59205896",
"0.59044147",
"0.5877878",
"0.5873378",
"0.57935816",
"0.576163",
"0.5739497",
"0.5695088",
"0.56813526",
"0.5613953",
"0.55813193",
"0.5548768",
"0.55390584",
"0.5505021",
"0.549138",
"0.54708904",
"0.53569... | 0.65417963 | 0 |
PATCH/PUT /aljnabeen_tanks/1 PATCH/PUT /aljnabeen_tanks/1.json | def update
respond_to do |format|
if @aljnabeen_tank.update(aljnabeen_tank_params)
format.html { redirect_to @aljnabeen_tank, notice: 'Aljnabeen tank was successfully updated.' }
format.json { render :show, status: :ok, location: @aljnabeen_tank }
else
format.html { render :edit ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @trank.update(trank_params)\n %x( sudo service Autodial restart )\n format.html { redirect_to @trank, notice: 'Рабочий канал успешно обновлен.' }\n format.json { render :show, status: :ok, location: @trank }\n else\n format.html { r... | [
"0.65542525",
"0.6297903",
"0.62701195",
"0.6189641",
"0.6176917",
"0.61523753",
"0.60867393",
"0.60065854",
"0.59989834",
"0.5998279",
"0.5987216",
"0.59717953",
"0.5965757",
"0.5957064",
"0.5943506",
"0.59374905",
"0.591127",
"0.5901474",
"0.58970886",
"0.58946776",
"0.5882... | 0.6426204 | 1 |
GET /gonzos GET /gonzos.json | def index
@gonzos = Gonzo.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @estacionamientos = Estacionamiento.all\n\n @json = Estacionamiento.all.to_gmaps4rails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estacionamientos }\n end\n end",
"def index\n @geopoints = Geopoint.all\n @jsons = @geopoints.to_... | [
"0.6149422",
"0.60933125",
"0.6092642",
"0.60389495",
"0.60281587",
"0.60239726",
"0.6002157",
"0.58969575",
"0.5831147",
"0.58215773",
"0.5786373",
"0.5775105",
"0.57709026",
"0.5743782",
"0.5742675",
"0.5725577",
"0.5696973",
"0.5696499",
"0.5676565",
"0.5650831",
"0.564652... | 0.71373796 | 0 |
POST /gonzos POST /gonzos.json | def create
# Instantiate a new object using form parameters
@gonzo = Gonzo.new(gonzo_params)
respond_to do |format|
# Save the object
if @gonzo.save
# If save succeeds, redirect to show action
format.html { redirect_to @gonzo, notice: 'Gonzo was successfully created.' }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def create\n @gasto = Gasto.new(params[:gasto])\n\n respond_to do |format|\n ... | [
"0.57747996",
"0.57280636",
"0.56511927",
"0.5609602",
"0.56007296",
"0.5564898",
"0.5545293",
"0.5515567",
"0.5503641",
"0.54845977",
"0.54273",
"0.5426805",
"0.5405878",
"0.5394561",
"0.53928214",
"0.53741866",
"0.5352585",
"0.535184",
"0.5342114",
"0.53375727",
"0.5327858"... | 0.63245785 | 0 |
DELETE /gonzos/1 DELETE /gonzos/1.json | def destroy
@gonzo.destroy
respond_to do |format|
format.html { redirect_to gonzos_url, notice: 'Gonzo was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @gasto = Gasto.find(params[:id])\n @gasto.destroy\n\n respond_to do |format|\n format.html { redirect_to gastos_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"de... | [
"0.68644047",
"0.68372166",
"0.6805857",
"0.6741284",
"0.661281",
"0.6587311",
"0.6568839",
"0.656634",
"0.6565994",
"0.6544515",
"0.6510927",
"0.6510927",
"0.6510927",
"0.6510927",
"0.65108144",
"0.6502666",
"0.64636743",
"0.6449879",
"0.6446548",
"0.6441311",
"0.6440419",
... | 0.7024806 | 0 |
Returns `true` if the release is a security release. | def security_release?
matches = @version.match(Qa::Ref::AUTO_DEPLOY_TAG_REGEX)
if matches && matches[:omnibus_commit]
# Omnibus commit SHAs are not available in the canonical repository.
begin
GitlabClient
.commit(Project::OmnibusGitlab, ref: matches[:omnib... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_security?\n response = api_get_request(\"\", \"tree=useSecurity\")\n response[\"useSecurity\"]\n end",
"def release_build?\n false # we currently have nothing that qualifies. previously LTS was a type of this\n end",
"def licensing?\n @config[:licensing].present? and licensing.p... | [
"0.6850654",
"0.65970016",
"0.6434387",
"0.64157856",
"0.6304326",
"0.6232002",
"0.62214583",
"0.61907136",
"0.6167193",
"0.6163839",
"0.61325127",
"0.6123982",
"0.6115247",
"0.6109657",
"0.6073691",
"0.60617554",
"0.60607135",
"0.6008587",
"0.59961665",
"0.59663194",
"0.5946... | 0.6782793 | 1 |
GET /comment_qs/new GET /comment_qs/new.json | def new
@comment_q = CommentQ.new
authorize! :create, @comment_q
respond_to do |format|
format.html # new.html.erb
format.json { render json: @comment_q }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @comment = @commentable.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @comment = @posting.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { rend... | [
"0.72139704",
"0.7067771",
"0.70182955",
"0.70182955",
"0.70182955",
"0.70182955",
"0.70182955",
"0.70182955",
"0.70182955",
"0.70182955",
"0.70182955",
"0.70182955",
"0.70182955",
"0.70182955",
"0.70029354",
"0.7000636",
"0.6990975",
"0.6962939",
"0.69331944",
"0.69313765",
... | 0.7226934 | 0 |
PUT /comment_qs/1 PUT /comment_qs/1.json | def update
@comment_q = CommentQ.find(params[:id])
respond_to do |format|
if @comment_q.update_attributes(params[:comment_q])
format.html { redirect_to @comment_q, notice: 'Comentario actualizado correctamente.' }
format.json { head :no_content }
else
format.html { render ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n json_update_and_sanitize(comment, comment_params, Comment)\n end",
"def update\n user = User.find_by({token: env['HTTP_TOKEN']})\n comment = user.comments.find(params[:id])\n comment.update(comment_params)\n render json: comment\n end",
"def update\n question = Question... | [
"0.6320853",
"0.62685186",
"0.6205049",
"0.61980295",
"0.61221",
"0.60757405",
"0.6033341",
"0.60064393",
"0.598025",
"0.5967994",
"0.5955411",
"0.5904912",
"0.5886944",
"0.5876001",
"0.58524495",
"0.580997",
"0.58029115",
"0.58029115",
"0.57968813",
"0.5787348",
"0.5774685",... | 0.69444555 | 0 |
def sell_pet_to_customer(shop,pet,customer) if pet == nil || customer_can_afford_pet(customer,pet) == false customer_pet_count(customer) pets_sold(shop) customer_cash(customer) total_cash(shop) else for animal in shop[:pets] if animal[:name] == pet[:name] amount = pet[:price] add_pet_to_customer(customer,pet) customer_... | def sell_pet_to_customer(shop,pet,customer)
if pet != nil && customer_can_afford_pet(customer,pet) == true
for animal in shop[:pets]
if animal[:name] == pet[:name]
amount = pet[:price]
add_pet_to_customer(customer,pet)
customer_pet_count(customer)
increase_pets_sold(shop,1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sell_pet_to_customer(pet_shop, pet, customer)\n\n\n if pet != nil && customer_can_afford_pet(customer, pet)\n\n add_pet_to_customer(customer, pet)\n customer_pet_count(customer)\n\n\n increase_pets_sold(pet_shop, customer_pet_count(customer))\n pets_sold(pet_shop)\n\n\n remove_custo... | [
"0.9498856",
"0.9451853",
"0.93977684",
"0.93325067",
"0.93072414",
"0.92779124",
"0.9234964",
"0.9226421",
"0.92160875",
"0.92078936",
"0.92058146",
"0.9120834",
"0.910481",
"0.8981258",
"0.8923741",
"0.8857505",
"0.8850062",
"0.87426513",
"0.87082064",
"0.87061477",
"0.8692... | 0.9641701 | 0 |
GET /quote_request_item_servers GET /quote_request_item_servers.json | def index
@quote_request_item_servers = QuoteRequestItemServer.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_quote_request_item_server\n @quote_request_item_server = QuoteRequestItemServer.find(params[:id])\n end",
"def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end",
"def servers\n response = get \"server\"\n data = JSON.par... | [
"0.6836327",
"0.6595518",
"0.6595518",
"0.62768346",
"0.61254495",
"0.6103087",
"0.6036803",
"0.6029697",
"0.6025096",
"0.59172237",
"0.58220315",
"0.5740031",
"0.57373327",
"0.57358515",
"0.5721844",
"0.57191753",
"0.5700626",
"0.5697332",
"0.56397057",
"0.5610092",
"0.55584... | 0.794785 | 0 |
POST /quote_request_item_servers POST /quote_request_item_servers.json | def create
@quote_request_item_server = QuoteRequestItemServer.new(quote_request_item_server_params)
respond_to do |format|
if @quote_request_item_server.save
format.html { redirect_to @quote_request_item_server, notice: 'Quote request item server was successfully created.' }
format.json ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @quote_request_item_servers = QuoteRequestItemServer.all\n end",
"def set_quote_request_item_server\n @quote_request_item_server = QuoteRequestItemServer.find(params[:id])\n end",
"def quote_request_item_server_params\n params.require(:quote_request_item_server).permit(:required_cp... | [
"0.71120864",
"0.6931104",
"0.6316385",
"0.6017857",
"0.5555794",
"0.5453077",
"0.53869784",
"0.53518456",
"0.5346074",
"0.5345495",
"0.5345495",
"0.53057855",
"0.53003883",
"0.52681935",
"0.5245553",
"0.52434736",
"0.52387416",
"0.51819694",
"0.5180654",
"0.517325",
"0.51434... | 0.7242853 | 0 |
PATCH/PUT /quote_request_item_servers/1 PATCH/PUT /quote_request_item_servers/1.json | def update
respond_to do |format|
if @quote_request_item_server.update(quote_request_item_server_params)
format.html { redirect_to @quote_request_item_server, notice: 'Quote request item server was successfully updated.' }
format.json { render :show, status: :ok, location: @quote_request_item_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_quote_request_item_server\n @quote_request_item_server = QuoteRequestItemServer.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @quote_request_item.update(quote_request_item_params)\n format.html { redirect_to @quote_request_item, notice: 'Quote request item was... | [
"0.6721578",
"0.61055785",
"0.5937203",
"0.5813207",
"0.5804567",
"0.5790512",
"0.57684326",
"0.5765336",
"0.57414055",
"0.5676669",
"0.5676669",
"0.56515104",
"0.5610077",
"0.55784196",
"0.5547695",
"0.5448574",
"0.54258156",
"0.54054815",
"0.5393669",
"0.5393669",
"0.539366... | 0.7345078 | 0 |
DELETE /quote_request_item_servers/1 DELETE /quote_request_item_servers/1.json | def destroy
@quote_request_item_server.destroy
respond_to do |format|
format.html { redirect_to quote_request_item_servers_url, notice: 'Quote request item server was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @quote_request_item.destroy\n respond_to do |format|\n format.html { redirect_to quote_request_items_url, notice: 'Quote request item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_item(item_id)\n response = Unirest.delete CONNECT_HO... | [
"0.6607338",
"0.65184104",
"0.64753455",
"0.6445235",
"0.63801414",
"0.6235087",
"0.6185698",
"0.6184798",
"0.6163362",
"0.6153729",
"0.6135143",
"0.6130432",
"0.6106396",
"0.60809845",
"0.6077841",
"0.60537195",
"0.6051819",
"0.6048773",
"0.60399014",
"0.6037643",
"0.6036953... | 0.7724905 | 0 |
POST /printers POST /printers.json | def create
@printer = Printer.new(printer_params)
respond_to do |format|
if @printer.save
format.html { redirect_to root_path }
format.json { render :show, status: :created, location: @printer }
else
format.html { render :new }
format.json { render json: @printer.err... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:printer_type].present?\n @printers = Printer.where(printer_type: params[:printer_type])\n else\n @printers = Printer.all\n end\n\n render json: @printers\n end",
"def printers()\n return MicrosoftGraph::Print::Printers::PrintersRequestBuilder.new(@path... | [
"0.6839211",
"0.6363138",
"0.6335519",
"0.6311781",
"0.6079787",
"0.6012293",
"0.58431673",
"0.5778883",
"0.5677472",
"0.55552",
"0.5538329",
"0.55317456",
"0.552771",
"0.55172056",
"0.55139506",
"0.5478279",
"0.5449218",
"0.54420507",
"0.54350924",
"0.54257023",
"0.53642255"... | 0.64616567 | 1 |
DELETE /printers/1 DELETE /printers/1.json | def destroy
@printer.destroy
respond_to do |format|
format.html { redirect_to printers_url}
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @printer.destroy\n respond_to do |format|\n format.html { redirect_to printers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @printer.destroy\n respond_to do |format|\n format.html { redirect_to printers_url, notice: 'Printer was successfully d... | [
"0.76339334",
"0.7312078",
"0.7003519",
"0.695422",
"0.69420177",
"0.69325256",
"0.6882103",
"0.6799622",
"0.67576456",
"0.67576456",
"0.6683175",
"0.66691417",
"0.66316783",
"0.6625756",
"0.6572918",
"0.65019274",
"0.64256394",
"0.6425631",
"0.6423998",
"0.64194137",
"0.6405... | 0.76029116 | 1 |
Tries to "resurrect" all eligible dead connections. | def resurrect_dead_connections!
connections.dead.each { |c| c.resurrect! }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reap\n stale_connections = synchronize do\n @connections.select do |conn|\n conn.in_use? && !conn.owner.alive?\n end\n end\n\n stale_connections.each do |conn|\n synchronize do\n if conn.active?\n conn.reset!\n chec... | [
"0.69708884",
"0.69641936",
"0.6745973",
"0.6680217",
"0.66484934",
"0.65706336",
"0.6525186",
"0.6509931",
"0.6502667",
"0.64771825",
"0.6402906",
"0.62995124",
"0.6276904",
"0.625387",
"0.6241419",
"0.6208702",
"0.6139469",
"0.6128169",
"0.61142224",
"0.60974705",
"0.608082... | 0.87432945 | 0 |
Trace the request in the `curl` format. | def __trace(method, path, params, body, url, response, json, took, duration)
trace_url = "http://localhost:9200/#{path}?pretty" +
( params.empty? ? '' : "&#{::Faraday::Utils::ParamsHash[params].to_query}" )
trace_body = body ? " -d '#{__convert_to_json(body, :pretty => true)}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trace!\n request! :trace\n end",
"def verbose_with_curl(index)\n be_verbose(index)\n puts(\"\\n simulate this call with: \\\"curl TODO\\\"\")\n end",
"def log_request(url, headers, body)\n logger = @api.logger\n logger.debug(\"Report request to: '%s'\" % url)\n logger.debug('HTTP... | [
"0.72567767",
"0.6338358",
"0.62693536",
"0.6068743",
"0.5980917",
"0.5919693",
"0.58037865",
"0.5765968",
"0.57382053",
"0.5703088",
"0.57014364",
"0.56615466",
"0.56615466",
"0.56587493",
"0.5624142",
"0.56201047",
"0.5619628",
"0.5609285",
"0.5608744",
"0.5606336",
"0.5603... | 0.70674074 | 1 |
Raise error specific for the HTTP response status or a generic server error | def __raise_transport_error(response)
error = ERRORS[response.status] || ServerError
raise error.new "[#{response.status}] #{response.body}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(x, status:200, type:\"request\", title:\"An error occurred\", message:\"\", args: [])\n x.res.status = status\n if App[:app_error][type.to_sym]\n App[:app_error][type.to_sym][:get][x, title, message, *args]\n else\n x << \"ERROR: #{title} - #{message}\"\n end\n end",
"def server_... | [
"0.7596843",
"0.7521406",
"0.74900544",
"0.7418863",
"0.7396764",
"0.73333156",
"0.7306113",
"0.7295984",
"0.7273865",
"0.72691756",
"0.7215157",
"0.7188334",
"0.7176373",
"0.717206",
"0.71705914",
"0.716373",
"0.71611995",
"0.7159875",
"0.71376604",
"0.7113222",
"0.71059734"... | 0.7539591 | 1 |
Converts any nonString object to JSON | def __convert_to_json(o=nil, options={})
o = o.is_a?(String) ? o : serializer.dump(o, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_to_json(obj)\n JSON(obj)\nend",
"def to_json(obj)\n json_classes = [String, Symbol, Fixnum, Float, Array, Hash, TrueClass, FalseClass, NilClass]\n # Remove non-JSON objects.\n sanitize = nil\n sanitize = Proc.new{ |v|\n if v.is_a?(Array)\n new_v = []\n v.each{ |a| new_v << sanitize.c... | [
"0.7789038",
"0.7504832",
"0.7494404",
"0.7457393",
"0.73856467",
"0.70885587",
"0.69078076",
"0.68793255",
"0.6808857",
"0.68068457",
"0.680597",
"0.6788633",
"0.6778316",
"0.67722684",
"0.6748149",
"0.6738945",
"0.67336404",
"0.6729655",
"0.6712368",
"0.6712115",
"0.6712115... | 0.75884646 | 1 |
Delete IPFIX Switch Collection Instance API deletes IPFIX Switch Collection Instance.Flow forwarding to selected collector will be stopped. This API is deprecated. Please use the following API: | def delete_ipfix_switch_collection_instance(tier_1_id, ipfix_switch_collection_instance_id, opts = {})
delete_ipfix_switch_collection_instance_with_http_info(tier_1_id, ipfix_switch_collection_instance_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_ipfix_switch_collection_instance_0(tier_1_id, ipfix_switch_collection_instance_id, opts = {})\n delete_ipfix_switch_collection_instance_0_with_http_info(tier_1_id, ipfix_switch_collection_instance_id, opts)\n nil\n end",
"def delete_ipfix_switch_collection_instance_with_http_info(tier_1_i... | [
"0.69914865",
"0.62267965",
"0.60395443",
"0.5808786",
"0.54111946",
"0.540814",
"0.54057676",
"0.5318837",
"0.52967805",
"0.5251339",
"0.5244572",
"0.51857173",
"0.51685923",
"0.51482755",
"0.5137279",
"0.51260847",
"0.51241195",
"0.511825",
"0.5117473",
"0.51053935",
"0.507... | 0.68977875 | 1 |
Delete IPFIX Switch Collection Instance API deletes IPFIX Switch Collection Instance.Flow forwarding to selected collector will be stopped. This API is deprecated. Please use the following API: | def delete_ipfix_switch_collection_instance_0(tier_1_id, ipfix_switch_collection_instance_id, opts = {})
delete_ipfix_switch_collection_instance_0_with_http_info(tier_1_id, ipfix_switch_collection_instance_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_ipfix_switch_collection_instance(tier_1_id, ipfix_switch_collection_instance_id, opts = {})\n delete_ipfix_switch_collection_instance_with_http_info(tier_1_id, ipfix_switch_collection_instance_id, opts)\n nil\n end",
"def delete_ipfix_switch_collection_instance_with_http_info(tier_1_id, i... | [
"0.68996",
"0.6226007",
"0.60384977",
"0.58085525",
"0.5416177",
"0.5410088",
"0.54069203",
"0.53188205",
"0.5300852",
"0.52556926",
"0.52456284",
"0.5190167",
"0.51734334",
"0.5151586",
"0.5139293",
"0.5126038",
"0.5125577",
"0.51225823",
"0.5114411",
"0.5101673",
"0.5081629... | 0.6992013 | 0 |
List IPFIX Switch Collection Instances API provides list IPFIX Switch collection instances available on selected logical switch. This API is deprecated. Please use the following API: | def list_ipfix_switch_collection_instances(tier_1_id, opts = {})
data, _status_code, _headers = list_ipfix_switch_collection_instances_with_http_info(tier_1_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_ipfix_switch_collection_instances_0(tier_1_id, opts = {})\n data, _status_code, _headers = list_ipfix_switch_collection_instances_0_with_http_info(tier_1_id, opts)\n data\n end",
"def list_instances()\n response = dbreq(\"GET\",lbmgmthost,\"#{lbmgmtpath}/instances\",lbmgmtport,lbmgmtsc... | [
"0.6664304",
"0.5994783",
"0.591977",
"0.5869218",
"0.58356243",
"0.58325255",
"0.5777013",
"0.57737714",
"0.57446486",
"0.5739758",
"0.57300246",
"0.5709727",
"0.5620018",
"0.5445284",
"0.5421647",
"0.54099095",
"0.5346198",
"0.53308433",
"0.52886564",
"0.5251592",
"0.523816... | 0.7027326 | 0 |
List IPFIX Switch Collection Instances API provides list IPFIX Switch collection instances available on selected logical switch. This API is deprecated. Please use the following API: | def list_ipfix_switch_collection_instances_0(tier_1_id, opts = {})
data, _status_code, _headers = list_ipfix_switch_collection_instances_0_with_http_info(tier_1_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_ipfix_switch_collection_instances(tier_1_id, opts = {})\n data, _status_code, _headers = list_ipfix_switch_collection_instances_with_http_info(tier_1_id, opts)\n data\n end",
"def list_instances()\n response = dbreq(\"GET\",lbmgmthost,\"#{lbmgmtpath}/instances\",lbmgmtport,lbmgmtscheme... | [
"0.7027113",
"0.59958327",
"0.5920352",
"0.5871473",
"0.58362514",
"0.58334404",
"0.5778606",
"0.5775472",
"0.5745115",
"0.5741097",
"0.57312757",
"0.57104486",
"0.56219196",
"0.54441893",
"0.54224294",
"0.54098606",
"0.534708",
"0.5331925",
"0.52894706",
"0.5253659",
"0.5239... | 0.6663921 | 1 |
List IPFIX Collector profiles. API will provide list of all IPFIX collector profiles and their details. | def list_ipfixl2_collector_profiles(opts = {})
data, _status_code, _headers = list_ipfixl2_collector_profiles_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_ipfix_collector_profiles(opts = {})\n data, _status_code, _headers = list_ipfix_collector_profiles_with_http_info(opts)\n data\n end",
"def list_ipfix_collector_profiles_0(opts = {})\n data, _status_code, _headers = list_ipfix_collector_profiles_0_with_http_info(opts)\n data\n ... | [
"0.7982283",
"0.7003614",
"0.682464",
"0.676848",
"0.655448",
"0.6453668",
"0.6399202",
"0.63345784",
"0.62621635",
"0.6120529",
"0.59947807",
"0.5978116",
"0.5978116",
"0.59545857",
"0.5906669",
"0.59053",
"0.5786596",
"0.57383156",
"0.5729222",
"0.5693379",
"0.56885266",
... | 0.7293181 | 1 |
Patch IPFIX switch collection instance Create a new IPFIX switch collection instance if the IPFIX switch collection instance with given id does not already exist. If the IPFIX switch collection instance with the given id already exists, patch with the existing IPFIX switch collection instance. This API is deprecated. P... | def patch_ipfix_switch_collection_instance(tier_1_id, ipfix_switch_collection_instance_id, ipfix_switch_collection_instance, opts = {})
patch_ipfix_switch_collection_instance_with_http_info(tier_1_id, ipfix_switch_collection_instance_id, ipfix_switch_collection_instance, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_ipfix_switch_collection_instance_0(tier_1_id, ipfix_switch_collection_instance_id, ipfix_switch_collection_instance, opts = {})\n patch_ipfix_switch_collection_instance_0_with_http_info(tier_1_id, ipfix_switch_collection_instance_id, ipfix_switch_collection_instance, opts)\n nil\n end",
"d... | [
"0.64942217",
"0.6119139",
"0.60684353",
"0.569798",
"0.54733664",
"0.52990186",
"0.52402043",
"0.52227557",
"0.5110562",
"0.5084549",
"0.50755495",
"0.49772465",
"0.497714",
"0.4962721",
"0.4944958",
"0.479619",
"0.4647284",
"0.46430406",
"0.46430406",
"0.46430406",
"0.46430... | 0.66989756 | 0 |
Patch IPFIX switch collection instance Create a new IPFIX switch collection instance if the IPFIX switch collection instance with given id does not already exist. If the IPFIX switch collection instance with the given id already exists, patch with the existing IPFIX switch collection instance. This API is deprecated. P... | def patch_ipfix_switch_collection_instance_0(tier_1_id, ipfix_switch_collection_instance_id, ipfix_switch_collection_instance, opts = {})
patch_ipfix_switch_collection_instance_0_with_http_info(tier_1_id, ipfix_switch_collection_instance_id, ipfix_switch_collection_instance, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_ipfix_switch_collection_instance(tier_1_id, ipfix_switch_collection_instance_id, ipfix_switch_collection_instance, opts = {})\n patch_ipfix_switch_collection_instance_with_http_info(tier_1_id, ipfix_switch_collection_instance_id, ipfix_switch_collection_instance, opts)\n nil\n end",
"def c... | [
"0.66993654",
"0.612059",
"0.60698944",
"0.56991076",
"0.5474466",
"0.52996945",
"0.5240931",
"0.5224153",
"0.51111186",
"0.50856566",
"0.5077114",
"0.49785987",
"0.49780887",
"0.49633938",
"0.49460948",
"0.47972143",
"0.4647609",
"0.46438655",
"0.46438655",
"0.46438655",
"0.... | 0.6494805 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.