query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
connect to message broker | def connect(*args, &block)
self.connection = RStomp::Connection.open(configuration.to_hash)
# If the connection has swapped hosts, then swap out primary and secondary
if connection.current_host != configuration.host
configuration.secondary_host = configuration.host
configuration.host = connection.current_host
end
# If the connection has swapped ports, then swap out primary and secondary
if connection.current_port != configuration.port
configuration.secondary_port = configuration.port
configuration.port = connection.current_port
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect!\n EventMachine.run do\n EventMachine::MQTT::ClientConnection.connect(@server) do |c|\n c.subscribe(@topic)\n c.receive_callback do |message|\n handle_incoming_message(message)\n end\n end\n end\n end",
"def connect!\n start_em\n @client.ensure... | [
"0.74156755",
"0.70797694",
"0.6959796",
"0.6797792",
"0.67917204",
"0.678587",
"0.6738887",
"0.6713903",
"0.66733265",
"0.66208017",
"0.66208017",
"0.66204727",
"0.65994143",
"0.65585345",
"0.6554331",
"0.6553337",
"0.65460104",
"0.6526625",
"0.6523553",
"0.65055853",
"0.646... | 0.0 | -1 |
normalize hash keys (top level only) normalizes keys to strings by default optionally pass in name of method to use (e.g. :to_sym) to normalize keys | def normalize_keys(hash, method = :to_s)
hash = hash.dup
hash.keys.each do |k|
normalized_key = k.respond_to?(method) ? k.send(method) : k
hash[normalized_key] = hash.delete(k)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recursively_normalize_keys\n recursively_transform_keys { |key| key.downcase.to_sym rescue key }\n end",
"def normalize_keys\n transform_keys { |key| key.downcase.to_sym rescue key }\n end",
"def deep_symbolize_keys\n deep_transform_keys{ |key| key.to_sym rescue key }\n end",
"def deep_sy... | [
"0.7697405",
"0.7610003",
"0.72869927",
"0.7273109",
"0.72640395",
"0.72030616",
"0.71837676",
"0.7183215",
"0.7183215",
"0.7178343",
"0.7178343",
"0.7178343",
"0.71496856",
"0.7145906",
"0.7067322",
"0.7067322",
"0.7066998",
"0.70400834",
"0.70400834",
"0.7038092",
"0.703809... | 0.7264615 | 4 |
true if the message with this message_id has already been seen | def message_seen?(message_id)
self.seen_messages.include?(message_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_duplicate_message_id\n old_mail_log = nil\n user_thread.schedule do\n old_mail_log = user.mail_logs.find_by_message_id(message_id)\n end\n\n if old_mail_log\n Log.librato(:count, \"system.process_uid.duplicate_message_id\", 1)\n return false\n else\n return true\n ... | [
"0.74475425",
"0.71343803",
"0.67167675",
"0.6710433",
"0.65891194",
"0.6497441",
"0.6490817",
"0.6423188",
"0.6337952",
"0.62972265",
"0.62096894",
"0.6209079",
"0.60864866",
"0.6074277",
"0.6048109",
"0.59912544",
"0.5973836",
"0.59602016",
"0.5937324",
"0.59320825",
"0.590... | 0.81583023 | 0 |
store the remembered message ids in a yaml file | def store_remembered_messages
if configuration.single_delivery
File.open(seen_messages_file, 'w') do |file|
file.write seen_messages.to_yaml
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_ids\n File.write('id_store.yml', @ids.to_yaml)\n end",
"def restore_remembered_messages\n if configuration.single_delivery\n yaml = default_yaml = \"--- []\"\n begin\n File.open(seen_messages_file, 'r') do |file|\n yaml = file.read\n end\n rescu... | [
"0.69648445",
"0.62123877",
"0.6093182",
"0.5935149",
"0.5897799",
"0.5793896",
"0.57560015",
"0.55887014",
"0.55494744",
"0.5519192",
"0.55181724",
"0.54580945",
"0.5446532",
"0.5443786",
"0.54124045",
"0.5408175",
"0.53848606",
"0.53788054",
"0.5378623",
"0.53710407",
"0.53... | 0.78094614 | 0 |
reload remembered message ids from a yaml file | def restore_remembered_messages
if configuration.single_delivery
yaml = default_yaml = "--- []"
begin
File.open(seen_messages_file, 'r') do |file|
yaml = file.read
end
rescue Object
yaml = default_yaml
end
buffer = []
begin
buffer = YAML.load(yaml)
if !buffer.kind_of?(Array) or !buffer.all?{ |x| x.kind_of?(String)}
raise Exception, "Invalid seen_messages.yml file"
end
rescue Object
buffer = []
end
self.seen_messages = buffer
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_remembered_messages\n if configuration.single_delivery\n File.open(seen_messages_file, 'w') do |file|\n file.write seen_messages.to_yaml\n end\n end\n end",
"def refresh_ids\n\t\t# Find all puzzle IDs retrieved\n\t\tpuzzle_files = Dir[\"./puzzles/*.pdf\"]\n\t\tids = ... | [
"0.6067601",
"0.55923957",
"0.552981",
"0.53130126",
"0.5267287",
"0.5262154",
"0.5253328",
"0.5194698",
"0.5186023",
"0.5156309",
"0.5147844",
"0.5147844",
"0.5126403",
"0.5110791",
"0.5106194",
"0.5104633",
"0.5100757",
"0.50864136",
"0.50720274",
"0.50593495",
"0.5049124",... | 0.66215736 | 0 |
acknowledge message (if headers["ack"] == "client") | def ack(subscription_headers, message)
#p [:ack, message.headers["message-id"]]
if message.headers["message-id"].to_s.strip != "" && subscription_headers["ack"].to_s == "client"
SMQueue.dbg { [:smqueue, :ack, :message, message].inspect }
connection.ack message.headers["message-id"], { }
else
SMQueue.dbg { [:smqueue, :ack, :not_acknowledging, message].inspect }
end
if ENV['PAUSE_SMQUEUE']
$stderr.print "press enter to continue> "
$stderr.flush
$stdin.gets
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ack\n @mq.callback do\n @mq.send Protocol::Basic::Ack.new({ :delivery_tag => @header_obj.properties[:delivery_tag] })\n end\n end",
"def acknowledge(authcode = nil)\n true\n end",
"def ack(msg_info)\n end",
"def send_ack\n sock.put('+')\n vprint_status('Sendin... | [
"0.731329",
"0.72715193",
"0.7054563",
"0.7003026",
"0.6985769",
"0.6956",
"0.68579894",
"0.6819857",
"0.6819005",
"0.6783214",
"0.67802364",
"0.6771343",
"0.6744129",
"0.67260116",
"0.6704331",
"0.6699316",
"0.667671",
"0.6612508",
"0.66004956",
"0.6594611",
"0.65939575",
... | 0.79772866 | 0 |
get message from queue if block supplied, loop forever and yield(message) for each message received default headers are: :ack => "client" :client_id => configuration.client_id :subscription_name => configuration.subscription_name | def get(headers = {}, &block)
self.connect
SMQueue.dbg { [:smqueue, :get, headers].inspect }
subscription_headers = {"ack" => "client", "activemq.prefetchSize" => 1 }
if client_id = configuration.client_id
subscription_headers["client_id"] = client_id
end
if sub_name = configuration.subscription_name
subscription_headers["subscription_name"] = sub_name
end
# if a client_id is supplied, then user wants a durable subscription
# N.B. client_id must be unique for broker
subscription_headers.update(headers)
#p [:subscription_headers_before, subscription_headers]
subscription_headers = normalize_keys(subscription_headers)
if configuration.durable and client_id = configuration.client_id || subscription_headers["client_id"]
subscription_name = configuration.subscription_name || subscription_headers["subscription_name"] || client_id
# activemq only
subscription_headers["activemq.subscriptionName"] = subscription_name
# JMS
subscription_headers["durable-subscriber-name"] = subscription_name
end
#p [:subscription_headers_after, subscription_headers]
destination = configuration.name
SMQueue.dbg { [:smqueue, :get, :subscribing, destination, :subscription_headers, subscription_headers].inspect }
connection.subscribe destination, subscription_headers
message = nil
SMQueue.dbg { [:smqueue, :get, :subscription_headers, subscription_headers].inspect }
begin
# TODO: refactor this
if block_given?
SMQueue.dbg { [:smqueue, :get, :block_given].inspect }
# todo: change to @running - (and set to false from exception handler)
# also should check to see if anything left to receive on connection before bailing out
while true
SMQueue.dbg { [:smqueue, :get, :receive].inspect }
# block until message ready
message = connection.receive
SMQueue.dbg { [:smqueue, :get, :received, message].inspect }
case message.command
when "ERROR"
SMQueue.dbg { [:smqueue, :get, :ERROR, message].inspect }
when "RECEIPT"
SMQueue.dbg { [:smqueue, :get, :RECEIPT, message].inspect }
else
SMQueue.dbg { [:smqueue, :get, :yielding].inspect }
if !message_seen?(message.headers["message-id"])
yield(message)
end
SMQueue.dbg { [:smqueue, :get, :message_seen, message.headers["message-id"]].inspect }
message_seen message.headers["message-id"]
SMQueue.dbg { [:smqueue, :get, :returned_from_yield_now_calling_ack].inspect }
ack(subscription_headers, message)
SMQueue.dbg { [:smqueue, :get, :returned_from_ack].inspect }
end
end
else
SMQueue.dbg { [:smqueue, :get, :single_shot].inspect }
message = connection.receive
SMQueue.dbg { [:smqueue, :get, :received, message].inspect }
if !(message.command == "ERROR" or message.command == "RECEIPT")
SMQueue.dbg { [:smqueue, :get, :message_seen, message.headers["message-id"]].inspect }
message_seen message.headers["message-id"]
SMQueue.dbg { [:smqueue, :get, :ack, message].inspect }
ack(subscription_headers, message)
SMQueue.dbg { [:smqueue, :get, :returned_from_ack].inspect }
end
end
rescue Object => e
SMQueue.dbg { [:smqueue, :get, :exception, e].inspect }
handle_error e, "Exception in SMQueue#get: #{e.message}", caller
ensure
SMQueue.dbg { [:smqueue, :get, :ensure].inspect }
SMQueue.dbg { [:smqueue, :unsubscribe, destination, subscription_headers].inspect }
connection.unsubscribe destination, subscription_headers
SMQueue.dbg { [:smqueue, :disconnect].inspect }
connection.disconnect
end
SMQueue.dbg { [:smqueue, :get, :return].inspect }
message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch queue_name, source_uri\n ReliableMsg::Queue.new(queue_name, :drb_uri => source_uri).get { |m|\n begin\n tx = Thread.current[ReliableMsg::Client::THREAD_CURRENT_TX]\n Thread.current[ReliableMsg::Client::THREAD_CURRENT_TX] = nil\n\n @logger.info { \"message fetched - ... | [
"0.6847475",
"0.6817764",
"0.6575516",
"0.6494402",
"0.6459551",
"0.6417673",
"0.635251",
"0.6325152",
"0.6324526",
"0.62579566",
"0.621319",
"0.6132365",
"0.6126845",
"0.61154455",
"0.60985917",
"0.6041152",
"0.60304594",
"0.6026462",
"0.6013326",
"0.6007478",
"0.5997147",
... | 0.754202 | 0 |
put a message on the queue default headers are: :persistent => true :ack => "auto" :expires => configuration.expires | def put(body, headers = { })
body, headers = normalize_message(body, headers)
SMQueue.dbg { [:smqueue, :put, body, headers].inspect }
begin
self.connect
headers = {:persistent => true, :ack => "auto", :expires => SMQueue.calc_expiry_time(configuration.expires) }.merge(headers)
destination = configuration.name
SMQueue.dbg { [:smqueue, :send, body, headers].inspect }
connection.send destination, body, headers
rescue Exception => e
SMQueue.dbg { [:smqueue, :exception, e].inspect }
handle_error e, "Exception in SMQueue#put - #{e.message}", caller
#connection.disconnect
ensure
connection.disconnect
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish(message, headers = {})\n message = message.to_json unless message.is_a?(String)\n client.publish(\"/queue/#{queue}\", message, { priority: 4, persistent: true }.merge(headers))\n end",
"def queue(message); end",
"def publish(message)\n # TODO: queue name and configuration should be in a... | [
"0.682341",
"0.6787292",
"0.66728467",
"0.66507393",
"0.6475411",
"0.6409977",
"0.6406791",
"0.64059603",
"0.63284624",
"0.6297982",
"0.6289944",
"0.6217713",
"0.61912036",
"0.6118599",
"0.6118444",
"0.6075365",
"0.6066768",
"0.60657805",
"0.6056343",
"0.60331154",
"0.6009493... | 0.65237254 | 4 |
A full document diagnostic report. | def kind
attributes.fetch(:kind)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reporting\n # STUB\n end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report\n\t\tend",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def docum... | [
"0.6467909",
"0.6390335",
"0.6390335",
"0.6390335",
"0.6390335",
"0.6390335",
"0.63822997",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
... | 0.0 | -1 |
An optional result id. If provided it will be sent on the next diagnostic request for the same document. | def result_id
attributes.fetch(:resultId)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result_id\n @record['ResultId']\n end",
"def set_result\n @result = Api::V1::Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result ... | [
"0.68269473",
"0.65793854",
"0.64877886",
"0.64870065",
"0.64870065",
"0.64870065",
"0.64870065",
"0.64870065",
"0.64870065",
"0.64870065",
"0.64870065",
"0.64870065",
"0.6485361",
"0.6414498",
"0.63966376",
"0.63735723",
"0.63063425",
"0.60479057",
"0.60479057",
"0.59624535",
... | 0.65429044 | 2 |
initialize the new artist and place it in the artists array, also create an empty array for all the artists songs. | def initialize
super
@songs = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @@artists << self #artists will be stored at @@artists\n @songs = [] #its empty waiting for to be initilized throu attr_reader\n end",
"def artists(artist)\n if song.artist = nil || !Artist.find_by_name(name)\n song.artist = artist \n Artist.all << artist \n ... | [
"0.80120295",
"0.7922159",
"0.7880483",
"0.78510666",
"0.7760986",
"0.7462887",
"0.7437735",
"0.73781914",
"0.7299549",
"0.7251967",
"0.72185147",
"0.71775484",
"0.71683335",
"0.7101243",
"0.7093824",
"0.70860577",
"0.7058823",
"0.7016578",
"0.7012146",
"0.70104414",
"0.69957... | 0.0 | -1 |
add a song into the array and assign it to the current artist | def add_song(song)
@songs << song
song.artist = self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_song(song)\n @songs << song\n song.artist = self\n\n end",
"def add_song(song)\r\n @songs << song\r\n song.artist = self\r\n end",
"def add_song(song)\n song.artist = self\n @songs << song\n end",
"def add_song(song)\n song.artist = self\n @songs << song\n end",
"def ad... | [
"0.8554741",
"0.8489688",
"0.8468347",
"0.8468347",
"0.8465742",
"0.8338294",
"0.83375704",
"0.8319788",
"0.8315116",
"0.8294787",
"0.82816887",
"0.82786745",
"0.82706237",
"0.82608",
"0.8248994",
"0.8242684",
"0.82288986",
"0.82288986",
"0.82288986",
"0.82288986",
"0.8228898... | 0.84680945 | 12 |
GET /heights GET /heights.json | def index
@heights = Height.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @heights }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @height = Height.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @height }\n end\n end",
"def blocks_height_get(height, opts = {})\n data, _status_code, _headers = blocks_height_get_with_http_info(height, opts)\n dat... | [
"0.70800406",
"0.65383637",
"0.64297676",
"0.6352048",
"0.6190382",
"0.61019766",
"0.60021526",
"0.5912485",
"0.5897405",
"0.5841711",
"0.583789",
"0.5820834",
"0.58119255",
"0.57751393",
"0.57445395",
"0.56987196",
"0.5695987",
"0.5653103",
"0.55643266",
"0.55571854",
"0.548... | 0.76686114 | 0 |
GET /heights/1 GET /heights/1.json | def show
@height = Height.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @height }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @heights = Height.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heights }\n end\n end",
"def new\n @height = Height.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @height }\n ... | [
"0.7662199",
"0.690821",
"0.6573263",
"0.65249145",
"0.6465763",
"0.64495623",
"0.63425446",
"0.6262459",
"0.6211445",
"0.6207669",
"0.6182893",
"0.6169202",
"0.60852957",
"0.6051031",
"0.60239697",
"0.5986553",
"0.5965826",
"0.5965826",
"0.5917062",
"0.5917062",
"0.59003615"... | 0.7750798 | 0 |
GET /heights/new GET /heights/new.json | def new
@height = Height.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @height }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @height = Height.new(params[:height])\n\n respond_to do |format|\n if @height.save\n format.html { redirect_to [:admin,@height], notice: 'Height was successfully created.' }\n format.json { render json: @height, status: :created, location: @height }\n else\n format... | [
"0.7268724",
"0.67484576",
"0.6658037",
"0.6649552",
"0.6649552",
"0.6629322",
"0.66126955",
"0.6609386",
"0.6587612",
"0.6558441",
"0.65201265",
"0.6518075",
"0.6496735",
"0.64885277",
"0.64797276",
"0.6457502",
"0.6457502",
"0.64382243",
"0.64379805",
"0.64379805",
"0.64342... | 0.8330437 | 0 |
POST /heights POST /heights.json | def create
@height = Height.new(params[:height])
respond_to do |format|
if @height.save
format.html { redirect_to [:admin,@height], notice: 'Height was successfully created.' }
format.json { render json: @height, status: :created, location: @height }
else
format.html { render action: "new" }
format.json { render json: @height.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @heights = Height.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heights }\n end\n end",
"def new\n @height = Height.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @height }\n ... | [
"0.6345655",
"0.62291074",
"0.61206025",
"0.5885749",
"0.586413",
"0.5859676",
"0.5771747",
"0.5670831",
"0.5569124",
"0.556342",
"0.53458285",
"0.53324974",
"0.53019625",
"0.5291227",
"0.52649796",
"0.522007",
"0.522007",
"0.5205171",
"0.5119396",
"0.5110129",
"0.504688",
... | 0.66400814 | 0 |
PUT /heights/1 PUT /heights/1.json | def update
@height = Height.find(params[:id])
respond_to do |format|
if @height.update_attributes(params[:height])
format.html { redirect_to [:admin,@height], notice: 'Height was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @height.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_height(height) \n op = {:operation => :set_height, :height => height}\n add_operation op\n end",
"def destroy\n @height = Height.find(params[:id])\n @height.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_heights_url }\n format.json { head :ok }\n end\n ... | [
"0.68623585",
"0.6494575",
"0.6396879",
"0.63206464",
"0.62699413",
"0.6145354",
"0.60840815",
"0.6052528",
"0.6035753",
"0.6024977",
"0.6024977",
"0.59800327",
"0.5978973",
"0.5818782",
"0.5803534",
"0.5776734",
"0.5741394",
"0.5738084",
"0.57372826",
"0.5650065",
"0.5623416... | 0.72002494 | 0 |
DELETE /heights/1 DELETE /heights/1.json | def destroy
@height = Height.find(params[:id])
@height.destroy
respond_to do |format|
format.html { redirect_to admin_heights_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @attack_height.destroy\n respond_to do |format|\n format.html { redirect_to attack_heights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hoge = Hoge.find(params[:id])\n @hoge.destroy\n\n respond_to do |format|\n format.html { redirect_to ho... | [
"0.6963586",
"0.65752274",
"0.6524143",
"0.6413734",
"0.6382759",
"0.63695645",
"0.6369511",
"0.62958413",
"0.6287775",
"0.6242096",
"0.62301177",
"0.6222153",
"0.621128",
"0.6185798",
"0.6182409",
"0.6178444",
"0.6176936",
"0.6176364",
"0.6171362",
"0.61710143",
"0.6170305",... | 0.801813 | 0 |
not needed here, since this is only used in the views InlineForms::SPECIAL_COLUMN_TYPES[:info]=:string this will NOT stay in inline_forms, it belongs in an app. | def chicas_photo_list_show(object, attribute)
# the attribute should be like members_photos
# then it will look for object.members.photos
# I know it's crappy.
members, photos = attribute.to_s.split('_')
thumbnail_list = {}
object.send(members).each do |member|
member.send(photos).each do |photo|
thumbnail_list[photo.rating] ||= []
thumbnail_list[photo.rating] << photo.image.url(:thumb)
end
end
out = ''
out = "<div class='row #{cycle('odd', 'even')}'>no photos</div>" if thumbnail_list.empty?
unless thumbnail_list.empty?
out << "<div class='row #{cycle('odd', 'even')}'>"
thumbnail_list.sort.reverse.each do |rating, thumbnails|
thumbnails.each do |thumbnail|
out << image_tag(thumbnail)
end
end
out << '</div>'
end
out.html_safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _field_types\n special_attribute('@fieldTypes'.freeze)\n end",
"def extra_field_type(index)\r\n t = extra_type(index).to_s\r\n case t\r\n when 'password'\r\n 'password'\r\n when 'integer', 'float'\r\n 'number'\r\n when 'boolean'\r\n 'c... | [
"0.63806075",
"0.6266482",
"0.6246426",
"0.6099761",
"0.6073124",
"0.6014047",
"0.5934039",
"0.59221005",
"0.590444",
"0.58853346",
"0.5869757",
"0.58318",
"0.58311343",
"0.5819279",
"0.5805778",
"0.580262",
"0.5798562",
"0.5797139",
"0.57910144",
"0.57883334",
"0.5774041",
... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_expense
@expense = Expense.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
subclass should override this method | def begin_element(_path, _name, _attrs = {}); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def overrides; end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def custom; end",
"def custom; end",
"def implementation; end",
"def implementation; end",
"def initialize()\n super\n end",
"def ini... | [
"0.74382085",
"0.697613",
"0.6751325",
"0.6751325",
"0.6640694",
"0.6640694",
"0.6616233",
"0.6616233",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.6... | 0.0 | -1 |
FIXME: to be refactored! | def convert_attr_hash(attrs = [])
h = {}
attrs.each do |v|
# v is Nokogiri::XML::SAX::Parser::Attribute
# see http://nokogiri.org/Nokogiri/XML/SAX/Parser/Attribute.html
key = v.prefix ? v.prefix + ':' : ''
key += v.localname
h[key.to_sym] = v.value
end
h
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def identify; end",
"def formation; end",
"def custom; end",
"def custom; end",
"def stderrs; end",
"def terpene; end",
"def offences_by; end",
"def s... | [
"0.73149747",
"0.64782345",
"0.61868227",
"0.6163079",
"0.6163079",
"0.6163079",
"0.6163079",
"0.5870799",
"0.5821478",
"0.5789733",
"0.5789733",
"0.5780817",
"0.5753211",
"0.5740728",
"0.5690416",
"0.56878453",
"0.56878453",
"0.56827843",
"0.5679364",
"0.567121",
"0.56518173... | 0.0 | -1 |
update target craft sync attrs after moving a sync'd craft | def update_sync_targets old_campaign_id, new_campaign_id
sync_with_campaigns = sync_targets
return if sync_with_campaigns.blank?
target_craft = Craft.where(:campaign_id => sync_with_campaigns, :name => self.name)
target_craft.each do |c|
next if c.sync[:with].blank?
c.sync = {:with => c.sync[:with].map{|id| id.eql?(old_campaign_id) ? new_campaign_id : id } }
c.save
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_removed_from_list \n if @removed_from_sync_list && !@removed_from_sync_list.blank?\n rem_craft = Craft.where(:name => self.name, :campaign_id => @removed_from_sync_list)\n rem_craft.each do |c|\n c.sync = {:with => c.sync[:with].select{|id| ![self.campaign_id, self.sync[:with]].flat... | [
"0.63234824",
"0.5925684",
"0.58874685",
"0.58519167",
"0.5642389",
"0.5482552",
"0.54771453",
"0.5442153",
"0.54298294",
"0.5409485",
"0.53230095",
"0.53222114",
"0.5284291",
"0.5212498",
"0.52035415",
"0.51966465",
"0.5182097",
"0.5177199",
"0.51751125",
"0.5165404",
"0.515... | 0.6838039 | 0 |
takes either a Campaign object or an id for a campaign and adds it to the crafts sync[:with] list | def sync_with campaign
campaign_id = campaign.id if campaign.is_a?(Campaign)
campaign_id ||= campaign
sync_list = self.sync
sync_list[:with] ||= []
sync_list[:with] << campaign_id
self.sync = sync_list
self.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_sync_targets old_campaign_id, new_campaign_id\n sync_with_campaigns = sync_targets\n return if sync_with_campaigns.blank?\n\n target_craft = Craft.where(:campaign_id => sync_with_campaigns, :name => self.name)\n target_craft.each do |c|\n next if c.sync[:with].blank? \n c.sync = {:... | [
"0.64817184",
"0.6257517",
"0.6105462",
"0.58810407",
"0.5878085",
"0.57558006",
"0.5595809",
"0.54732835",
"0.54530966",
"0.5350305",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509"... | 0.76610833 | 0 |
write data to attrbute as json string, set instance var containing ids which have been removed since last write | def sync= sync_list
cur_list = sync
@removed_from_sync_list = cur_list[:with] - sync_list[:with] if sync_list[:with] && cur_list[:with]
sync_list[:with] = sync_list[:with].select{|id| id != self.campaign_id } if sync_list[:with]
super(sync_list.to_json)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_attrs\n self.temp_attrs[:id] = self.id\n self.temp_attrs[:created_at] ||= Time.now.utc.to_i\n\n attrs_to_write = self.temp_attrs.dup\n # Serialize nested hashes.\n self.nested_attributes.each do |name|\n val = attrs_to_write[name]\n attrs_to_write[name] = val.to_json if ! val.nil... | [
"0.7021902",
"0.621483",
"0.61295146",
"0.6055855",
"0.57228005",
"0.56922966",
"0.5682489",
"0.56765604",
"0.56566215",
"0.5651311",
"0.56464744",
"0.5632236",
"0.56275535",
"0.5609795",
"0.5593224",
"0.55904144",
"0.55251473",
"0.5473964",
"0.546931",
"0.5459242",
"0.543926... | 0.0 | -1 |
process the craft which have been removed from sync to no longer point back at this craft instance var is set by sync= being called. this method is called by the synchronize method | def update_removed_from_list
if @removed_from_sync_list && !@removed_from_sync_list.blank?
rem_craft = Craft.where(:name => self.name, :campaign_id => @removed_from_sync_list)
rem_craft.each do |c|
c.sync = {:with => c.sync[:with].select{|id| ![self.campaign_id, self.sync[:with]].flatten.include?(id) } }
c.save
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_sync\n reset_movement\n reset_flags\n end",
"def sync= sync_list\n cur_list = sync \n @removed_from_sync_list = cur_list[:with] - sync_list[:with] if sync_list[:with] && cur_list[:with]\n sync_list[:with] = sync_list[:with].select{|id| id != self.campaign_id } if sync_list[:with]... | [
"0.57707274",
"0.55127895",
"0.54536176",
"0.5440304",
"0.5425826",
"0.5278683",
"0.5263155",
"0.5256147",
"0.51834035",
"0.5126867",
"0.51265687",
"0.5110576",
"0.51086265",
"0.5065961",
"0.50260496",
"0.50104874",
"0.5002443",
"0.4984404",
"0.49516785",
"0.4938274",
"0.4929... | 0.6329431 | 0 |
GET /cloud_providers/1 GET /cloud_providers/1.json | def show
@cloud_provider = current_user.cloud_providers.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @cloud_provider }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @cloud_provider = current_user.cloud_providers.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloud_provider }\n end\n end",
"def show\n @provider = current_company.providers.find(params[:id])\n\n respond_to do |format|\n format.ht... | [
"0.72448206",
"0.66708875",
"0.6643025",
"0.6589265",
"0.65434766",
"0.64967513",
"0.645369",
"0.64236474",
"0.6386545",
"0.6386545",
"0.63220316",
"0.6312886",
"0.6206023",
"0.61762816",
"0.61558086",
"0.6119046",
"0.610792",
"0.6082324",
"0.60042185",
"0.5968971",
"0.595961... | 0.7597724 | 0 |
GET /cloud_providers/new GET /cloud_providers/new.json | def new
@cloud_provider = current_user.cloud_providers.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @cloud_provider }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.htm... | [
"0.77794886",
"0.77176195",
"0.75059843",
"0.75059843",
"0.7384776",
"0.7295979",
"0.72653306",
"0.72576916",
"0.7080923",
"0.70335186",
"0.7021476",
"0.7007189",
"0.6997756",
"0.69591427",
"0.6878553",
"0.67591",
"0.668349",
"0.6661483",
"0.6654626",
"0.6640935",
"0.66397434... | 0.8160487 | 0 |
POST /cloud_providers POST /cloud_providers.json | def create
@cloud_provider = params[:cloud_provider][:type].constantize.new(params[:cloud_provider])
respond_to do |format|
begin
@cloud_provider.save
format.html { redirect_to @cloud_provider, notice: 'Cloud provider was successfully created.' }
format.json { render json: @cloud_provider, status: :created, location: @cloud_provider }
rescue
flash[:error] = "Check the credentials again"
format.html { render action: "new" }
format.json { render json: @cloud_provider.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end",
"def create\n @provider = current_company.providers.new(params... | [
"0.6890394",
"0.6824008",
"0.6767965",
"0.6686018",
"0.6652364",
"0.65973735",
"0.6441565",
"0.64218587",
"0.6353372",
"0.6349242",
"0.62817836",
"0.6260438",
"0.6253456",
"0.62531996",
"0.62073165",
"0.618063",
"0.61667556",
"0.6144824",
"0.61415887",
"0.6120747",
"0.6056748... | 0.67938256 | 2 |
PUT /cloud_providers/1 PUT /cloud_providers/1.json | def update
@cloud_provider = current_user.cloud_providers.find(params[:id])
respond_to do |format|
if @cloud_provider.update_attributes(params[:cloud_provider])
format.html { redirect_to @cloud_provider, notice: 'Cloud provider was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @cloud_provider.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_provider!(provider, provider_info = {}, access = {})\n Api::Request.new do |request|\n request[:access] = access\n request[:method] = :PUT\n request[:path] = \"/mgmt/{{client_id}}/storages/#{provider}\"\n request[:request_body] = provider_info\n end.execute!\n\n ... | [
"0.67795",
"0.6509161",
"0.64946884",
"0.6317323",
"0.6298885",
"0.6298885",
"0.62078136",
"0.6187329",
"0.61618406",
"0.60791194",
"0.6009951",
"0.5980971",
"0.59672195",
"0.59303945",
"0.5912396",
"0.58625984",
"0.5859016",
"0.5849602",
"0.5839749",
"0.58388066",
"0.5837862... | 0.7211685 | 0 |
DELETE /cloud_providers/1 DELETE /cloud_providers/1.json | def destroy
@cloud_provider = current_user.cloud_providers.find(params[:id])
@cloud_provider.destroy
respond_to do |format|
format.html { redirect_to cloud_providers_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cloud.delete\n respond_to do |format|\n format.html { redirect_to clouds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content... | [
"0.71699774",
"0.71297544",
"0.70931643",
"0.7076154",
"0.7067633",
"0.7067633",
"0.7067633",
"0.7067169",
"0.70613575",
"0.6996486",
"0.6996486",
"0.6996486",
"0.6972775",
"0.69516116",
"0.6892063",
"0.68899137",
"0.6886542",
"0.6852625",
"0.6802769",
"0.67953634",
"0.678562... | 0.77228564 | 0 |
Palindromic String (Part 2) exercise Small Problems exercises from LaunchSchool | def palindrome?(arg)
arg == arg.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def palindrome_substrings(string)\n\nend",
"def palindrome(str)\nend",
"def palindromic(num) \n if num.to_s.split(\"\") == num.to_s.split(\"\").reverse\n true \n else \n false \n end \nend",
"def palindromes(str)\n evaluated_words = substrings(str)\n evaluated_words.select { |char| char.size > 1 &... | [
"0.74935734",
"0.7486841",
"0.7433131",
"0.7399811",
"0.73871654",
"0.72819734",
"0.72528565",
"0.7236275",
"0.71964806",
"0.71909493",
"0.71849954",
"0.7178259",
"0.7175654",
"0.7168487",
"0.7161198",
"0.7134021",
"0.71239865",
"0.7093375",
"0.7084107",
"0.7080357",
"0.70510... | 0.0 | -1 |
If the request passed a callback, answer in the appropiate way. Or else, answer normally. | def callback_response(callback,response)
if callback.nil?
response
else
callback + "(" + response + ")"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispatch_http_response(res, options, &block)\n callback = options.fetch('callback', nil)\n (res.blank? && callback.present?) ? callback.call(res) : block.call(res)\nend",
"def callback\n head :ok\n end",
"def callback\n return response if called\n self.response = k.inject(\n env.merge(RESP... | [
"0.6531643",
"0.6351651",
"0.6318307",
"0.6264702",
"0.6231524",
"0.6219892",
"0.6219167",
"0.6142713",
"0.611435",
"0.60610545",
"0.60595024",
"0.6014218",
"0.59468335",
"0.5936375",
"0.59288704",
"0.5915881",
"0.58784175",
"0.58024436",
"0.5785593",
"0.5768225",
"0.5703472"... | 0.6469977 | 1 |
before_action :set_x_organization_header has_scope :page, default: 1 | def cors_preflight_check
if request.method == 'OPTIONS'
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'
headers['Access-Control-Allow-Headers'] = '*' #'Origin, X-Requested-With, Content-Type, Accept, Authorization, Token'
headers['Access-Control-Request-Method'] = '*'
headers['Access-Control-Max-Age'] = '1728000'
render :text => '', :content_type => 'text/plain'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kopal_layout_before_page_header\n\n end",
"def Header\r\n\t\tif @page == 1\r\n\t\t\tfirst_page_header\r\n\t\telse\r\n\t\t\tpage_header\t\r\n\t\tend\r\n\tend",
"def index\n # Get page number\n page = params[:page].nil? ? 1 : params[:page]\n\n if current_user.admin?\n @organizations = Organiza... | [
"0.6581414",
"0.62604374",
"0.6200295",
"0.6117571",
"0.60257375",
"0.59432256",
"0.5899744",
"0.587185",
"0.5860271",
"0.5851856",
"0.5849072",
"0.5801358",
"0.57937956",
"0.57222396",
"0.57221293",
"0.5720161",
"0.56911933",
"0.5669275",
"0.56655353",
"0.5661351",
"0.565073... | 0.0 | -1 |
string Folder path This must be slashdelimited, but it must neither start nor end with a slash. Maximum of 5000 characters. | def path
@attributes[:path]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pathify_folder(folder)\n if folder.private?\n \"/home/files?folderId=#{folder.id}\"\n elsif folder.public?\n \"/home/files/everybody?folderId=#{folder.id}\"\n elsif folder.in_space?\n \"/home/files/spaces?folderId=#{folder.id}\"\n else\n raise \"Unable to build folder's path\"\n... | [
"0.6856811",
"0.6810782",
"0.6447439",
"0.63462573",
"0.625899",
"0.6173267",
"0.6164855",
"0.616426",
"0.60557014",
"0.6041702",
"0.6039195",
"0.60270005",
"0.5988001",
"0.5865795",
"0.5861753",
"0.58057344",
"0.5795963",
"0.5795963",
"0.578727",
"0.57809836",
"0.5775227",
... | 0.0 | -1 |
string Source filename, if applicable | def source
@attributes[:source]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source\n @_source ||= \"#{@rf['directory']}#{base_filename}.#{format}\"\n end",
"def source filename\n source_hash[filename]\n end",
"def file_name\n if source\n source.is_a?(File) ? File.basename(source.path) : File.basename(source)\n else\n object.origi... | [
"0.792559",
"0.76608425",
"0.7562311",
"0.7467065",
"0.7380775",
"0.7372563",
"0.7328934",
"0.7271527",
"0.72404355",
"0.7202952",
"0.7093526",
"0.7066947",
"0.7005585",
"0.70053023",
"0.7002793",
"0.69939137",
"0.69930047",
"0.69694936",
"0.69505686",
"0.6949947",
"0.6948332... | 0.0 | -1 |
string ID of automation that created request | def automation_id
@attributes[:automation_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def automation_id\n return @automation_id\n end",
"def request_id; end",
"def id\n # FIXME: make this number configurable and document the probabilities of clashes\n @id ||= @env[Action::REQUEST_ID] = SecureRandom.hex(Action::DEFAULT_ID_LENGTH)\n end",
"def automa... | [
"0.72546345",
"0.7032562",
"0.6984385",
"0.69742197",
"0.68896455",
"0.683108",
"0.683108",
"0.67906207",
"0.6688678",
"0.6649981",
"0.6646388",
"0.6619731",
"0.6475274",
"0.64695436",
"0.6407604",
"0.63708466",
"0.63668334",
"0.6337252",
"0.6337252",
"0.6316858",
"0.62934446... | 0.7316147 | 0 |
string User making the request (if applicable) | def user_display_name
@attributes[:user_display_name]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user\n @user ||= @uri && client.user(@uri.split(':')[2])\n end",
"def user_requested_by\n response = get(\"users/self/requested-by\")\n response\n end",
"def admin_http_auth_user\n # This needs special magic in mongrel: http://www.ruby-forum.com/topic/83067\n # Hence the ... | [
"0.68885666",
"0.6862821",
"0.67123306",
"0.6613009",
"0.6573832",
"0.65696734",
"0.6567153",
"0.65648025",
"0.6538043",
"0.65338075",
"0.65208584",
"0.6517496",
"0.6517496",
"0.6517496",
"0.6517496",
"0.65124947",
"0.6495803",
"0.6475025",
"0.64669937",
"0.6460731",
"0.64483... | 0.0 | -1 |
string A list of user IDs to request the file from. If sent as a string, it should be commadelimited. | def user_ids
@attributes[:user_ids]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_users_string\n read_users.join(', ')\n end",
"def user_tokens=(ids)\n self.user_ids = ids.split(\",\")\n end",
"def get_files(file_ids)\n file_ids = [file_ids] unless file_ids.is_a? Array\n debug \"DivShare.get_files(): #{file_ids.class}\"\n files = get_user_files\n ... | [
"0.62312734",
"0.6093678",
"0.606593",
"0.60624576",
"0.60335135",
"0.5956571",
"0.5875273",
"0.5851331",
"0.58004224",
"0.57294893",
"0.5722834",
"0.56856424",
"0.56604564",
"0.56468326",
"0.56119037",
"0.55858153",
"0.55769604",
"0.5536077",
"0.55360246",
"0.55284667",
"0.5... | 0.52486384 | 33 |
string A list of group IDs to request the file from. If sent as a string, it should be commadelimited. | def group_ids
@attributes[:group_ids]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_groups_string\n read_groups.join(', ')\n end",
"def read_groups_string=(groups)\n self.read_groups = groups.split(/[\\s,]+/)\n end",
"def groups\n group_ids.split(',').inject(Array.new) do |arr,gid|\n arr << Ecore::Group.where(:id => gid).first\n end\n end",... | [
"0.61319846",
"0.5798396",
"0.5795682",
"0.5773987",
"0.57076406",
"0.5674112",
"0.55216956",
"0.5487051",
"0.5426723",
"0.5388313",
"0.5388313",
"0.5386889",
"0.52791893",
"0.52576816",
"0.5228913",
"0.52208143",
"0.51673096",
"0.5160553",
"0.5158224",
"0.51313215",
"0.51261... | 0.5349069 | 13 |
Initializes a new Table instance with the specified columns. +columns+:: A list of Column instances representing the columns in the new table. | def initialize(*columns)
@columns = columns
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize( table, columns, opts = {} )\n @table = table\n @columns = [ *columns ]\n @opts = opts\n end",
"def initialize(columns, arel_table)\n @columns = columns.map do |column|\n OrderByColumnData.new(column, \"order_by_columns_#{column.attribute_name}\", ... | [
"0.7275576",
"0.6731631",
"0.661504",
"0.6569464",
"0.64577806",
"0.6434311",
"0.6242508",
"0.6184003",
"0.6184003",
"0.6042692",
"0.60329884",
"0.5954066",
"0.5930878",
"0.5835333",
"0.5730677",
"0.571784",
"0.57127786",
"0.5707533",
"0.57045555",
"0.57003146",
"0.56698436",... | 0.74814755 | 0 |
Outputs a formatted version of the receiver. A sideeffect of this method is that the width of each column in +columns+ will be large enough to fit its largest row value. | def to_s
stringio = StringIO.new
# Set the column widths
if @data
@data.each do |row|
next if row.length != @columns.length
@columns.each_with_index do |column, i|
data_string = column.data_to_s.call(row[i])
column.width = data_string.length if data_string.length > column.width
end
end
else
@columns.each { |column| column.width = column.label.length }
end
# Print the column headers
stringio.puts(@columns.collect do |column|
padding = column.padding || " "
padding + column.label.center(column.width) + padding
end.join("|"))
total_width = stringio.string.length - 1
# Print the bar below the column header
stringio.puts(@columns.collect do |column|
padding = column.padding || " "
"-" * (column.width + 2 * padding.length)
end.join("+"))
# If we have rows, print each one, otherwise print "No rows"
if @data
@data.each do |row|
# Skip rows that have the wrong number of columns
next if row.length != @columns.length
# Generate the row of data. These machinations with the index variable are because collect_with_index doesn't exist
# and Ruby 1.8.x doesn't support each_with_index.collect.
i = 0
stringio.puts(row.collect do |data|
padded_aligned_data = @columns[i].padded_aligned_data(data)
i += 1
padded_aligned_data
end.join("|"))
end
else
stringio.puts("No rows".center(total_width))
end
stringio.string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n str = \"\"\n count_row = 0\n count_col = 0\n str << \"-\"*25 << \"\\n\"\n rows.each do |row|\n row.each do |ele|\n str << ele.to_s << \" \"\n count_col += 1\n if count_col == 3\n str << \"| \"\n count_col = 0\n end... | [
"0.7065507",
"0.706443",
"0.6936777",
"0.69126815",
"0.68309635",
"0.6782193",
"0.6745901",
"0.6724159",
"0.6697752",
"0.6684842",
"0.6665344",
"0.66632074",
"0.66616714",
"0.6646469",
"0.662942",
"0.6621123",
"0.6589467",
"0.6577162",
"0.6565434",
"0.6557925",
"0.6526258",
... | 0.67741144 | 6 |
Sorts the receiver's data in ascending order using the specified sort keys. +sort_keys+:: A list of column IDs to sort on. If table does not have a column with one of the IDs, that ID is ignored. | def sort_data_ascending!(*sort_keys)
self.sort_data!(true, sort_keys)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_data!(is_ascending, sort_keys)\n sort_key_indices = sort_keys.collect { |key| @columns.index(@columns.find { |column| column.id == key }) }.reject { |e| !e }\n\n @data.sort! do |row1, row2|\n comparison_result = 0\n\n sort_key_indices.each do |index|\n comparison_result = ... | [
"0.75310045",
"0.71050555",
"0.61659116",
"0.61338425",
"0.59853387",
"0.59486353",
"0.5941142",
"0.59029365",
"0.5882253",
"0.58397055",
"0.58256537",
"0.5752118",
"0.5712452",
"0.5693306",
"0.5688002",
"0.56807214",
"0.56747276",
"0.567059",
"0.56665313",
"0.565522",
"0.562... | 0.7546592 | 0 |
Sorts the receiver's data in descending order using the specified sort keys. +sort_keys+:: A list of column IDs to sort on. If table does not have a column with one of the IDs, that ID is ignored. | def sort_data_descending!(*sort_keys)
self.sort_data!(false, sort_keys)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_data!(is_ascending, sort_keys)\n sort_key_indices = sort_keys.collect { |key| @columns.index(@columns.find { |column| column.id == key }) }.reject { |e| !e }\n\n @data.sort! do |row1, row2|\n comparison_result = 0\n\n sort_key_indices.each do |index|\n comparison_result = ... | [
"0.67709315",
"0.61913806",
"0.6041815",
"0.5955657",
"0.58654803",
"0.5819487",
"0.5719023",
"0.56759936",
"0.56563205",
"0.5629016",
"0.5552609",
"0.5478927",
"0.53748477",
"0.5373112",
"0.5331856",
"0.5313344",
"0.52585787",
"0.5248222",
"0.52466464",
"0.5220477",
"0.52024... | 0.8057964 | 0 |
Sorts the receiver's data using the specified sort order and keys. +is_ascending+:: Whether to sort the data in ascending order or not. +sort_keys+:: A list of column IDs to sort on. If table does not have a column with one of the IDs, that ID is ignored. | def sort_data!(is_ascending, sort_keys)
sort_key_indices = sort_keys.collect { |key| @columns.index(@columns.find { |column| column.id == key }) }.reject { |e| !e }
@data.sort! do |row1, row2|
comparison_result = 0
sort_key_indices.each do |index|
comparison_result = @columns[index].data_comparator.call(row1[index], row2[index])
comparison_result *= -1 if !is_ascending
break unless comparison_result == 0
end
comparison_result
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_data_ascending!(*sort_keys)\n self.sort_data!(true, sort_keys)\n end",
"def sort(sort_keys, *args)\n raise NotImplementedError\n end",
"def sort_data_descending!(*sort_keys)\n self.sort_data!(false, sort_keys)\n end",
"def sort_data\n sort_cols = @columns.selec... | [
"0.7599574",
"0.67001396",
"0.62033373",
"0.5866302",
"0.5826033",
"0.582195",
"0.5780125",
"0.57496655",
"0.57232267",
"0.5716997",
"0.5655909",
"0.5633429",
"0.56311405",
"0.5580525",
"0.55534935",
"0.55394953",
"0.5536905",
"0.5530142",
"0.5525046",
"0.5515125",
"0.5505150... | 0.8025702 | 0 |
Initializes a new Column instance with the specified ID and options. Valid keys for options are +:alignment+, +:data_comparator+, +:data_to_s+, +:label+, +:padding+, and +:width+, whose usage should be obvious. +id+:: The new instance's ID. +options+:: An options map specifying zero or more of the column's instance variable values. | def initialize(id, options = { })
@id = id
@alignment = options[:alignment] || :center
@data_comparator = options[:data_comparator] || Proc.new { |a, b| a <=> b }
@data_to_s = options[:data_to_s] || Proc.new { |o| o.to_s }
@label = options[:label] || id
@padding = options[:padding] || " "
@width = options[:width] || label.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column id = nil, options = {}\n unless id\n id = options[:id]\n raise \"Need a column ID\" if id.nil?\n end\n if options.empty?\n @cols << {}\n else\n @cols << options\n end\n @col_count = @cols.size\n @col_ids << id\n end",
"def initialize( i... | [
"0.688868",
"0.65057254",
"0.63720155",
"0.6269675",
"0.6225198",
"0.60997665",
"0.5945962",
"0.57345974",
"0.5703262",
"0.5688603",
"0.5688603",
"0.5675031",
"0.56600744",
"0.5642941",
"0.5642941",
"0.55620086",
"0.55620086",
"0.5556941",
"0.5535653",
"0.5533228",
"0.5533086... | 0.7794734 | 0 |
Returns a string representation of specified data with the appropriate alignment and padding for the receiver. +data+:: The data to pad and align. | def padded_aligned_data(data)
string_repr = @data_to_s.call(data)
string_repr = case @alignment
when :left
string_repr.ljust(@width)
when :center
string_repr.center(@width)
when :right
string_repr.rjust(@width)
else
string_repr
end
@padding ? @padding + string_repr + @padding : string_repr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_data(data, padding)\n p = \"\"\n (0..padding.length - data.to_s.length).map {p += \" \"}\n print data.to_s + p\n end",
"def to_s\n pad_field :data\n recalc_block_len\n super\n end",
"def fmt(data)\n pkt = \"<190>1 \"\n pkt += \"#{data[:t].strftime(\"%Y-%m-%dT... | [
"0.7239746",
"0.63989556",
"0.63953304",
"0.62947625",
"0.6128271",
"0.5971051",
"0.5968507",
"0.5967303",
"0.5940357",
"0.59368074",
"0.59193754",
"0.5870094",
"0.58287865",
"0.5814228",
"0.5760539",
"0.5665646",
"0.565248",
"0.5640018",
"0.55885226",
"0.55612975",
"0.550738... | 0.8301922 | 0 |
S _ _ _ ... row, col = 1 _ _ _ _ Strategy: 1. Solve this for 1 row only. Solve for horizontally only. 2. Transpose the matrix. Then we can use same code on transposed matrix to solve it vertically. Solve for 1 row: Test cases: Word = "test" OK. All same length as word 1. _ _ _ _ All blanks. Left and right of word must be either "" or border. 2. T _ N _ >=1 of characters are in word Not OK: 1. _ _ T E S T _ _ Can't start word from middle 2. T _ _ S Can't have 1 or more letters not matching letters in word 3. Can't have "" in word 4. T E S T _ W | def crossword(arr, word)
earliest_col = -1
ans = []
arr.each_with_index do |row, i|
earliest_col = solve_horiz(row, word)
ans = [i, earliest_col]
break
end
tarr = transpose arr
tarr.each_with_index do |col, i|
earliest_row = solve_horiz(row, word)
if earliest_row <= ans[0] && i <= ans[1]
ans = [earliest_row, i]
end
break
end
ans
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_square?(arr)\n # first brute force, using i and j \n i = 0 \n while i < arr.length \n j = 0 \n while j < arr.length \n # next if i >= j will overflow as j never increments\n if i >= j \n j+= 1 \n next \n end \n ... | [
"0.6241779",
"0.6122972",
"0.60796183",
"0.6054155",
"0.6001216",
"0.5909172",
"0.58565855",
"0.5821083",
"0.574051",
"0.5735618",
"0.57177836",
"0.56709856",
"0.5650652",
"0.5644215",
"0.563699",
"0.5599014",
"0.5588299",
"0.5588043",
"0.556366",
"0.55601954",
"0.55505073",
... | 0.6513128 | 0 |
Create a transaction on the db_mod database connection. Calls +BEGIN+ then yields to the given block. Calls +COMMIT+ once the block yields, or +ROLLBACK+ if the block raises an exception. Not thread safe. May not be called from inside another transaction. | def transaction
start_transaction!
result = yield
query 'COMMIT'
result
rescue
query 'ROLLBACK'
raise
ensure
end_transaction!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transaction(&block)\n db\n persister\n\n result = nil\n start_time = Time.now\n begin\n db.transaction(:rollback => :reraise, :isolation => :repeatable,\n :retry_on => @retry_on_error, :num_retries => 3) do\n result = yield block\n end\n ... | [
"0.79699194",
"0.77830887",
"0.7712146",
"0.75772774",
"0.7555144",
"0.7516007",
"0.74902254",
"0.74796426",
"0.74675095",
"0.74531394",
"0.73616916",
"0.7298876",
"0.7280622",
"0.725132",
"0.7241082",
"0.7241082",
"0.7212155",
"0.7196855",
"0.71037716",
"0.7092057",
"0.70883... | 0.75632626 | 4 |
Start the database transaction, or fail if one is already open. | def start_transaction!
fail DbMod::Exceptions::AlreadyInTransaction if @in_transaction
@in_transaction = true
query 'BEGIN'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def begin_db_transaction\n log('begin transaction', nil) do\n begin_isolated_db_transaction(default_transaction_isolation)\n end\n end",
"def begin_db_transaction\n # PG driver doesn't really do anything on setAutoCommit(false)\n # except for commit-ing a previous pe... | [
"0.77285904",
"0.7552407",
"0.75057083",
"0.75057083",
"0.7490247",
"0.74283314",
"0.73108745",
"0.71682006",
"0.71258897",
"0.706478",
"0.7041109",
"0.7038126",
"0.7038126",
"0.70136744",
"0.696685",
"0.6962065",
"0.6883738",
"0.6822559",
"0.67258966",
"0.6724869",
"0.670789... | 0.8204365 | 0 |
End the database transaction | def end_transaction!
@in_transaction = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit_db_transaction\n execute(\"COMMIT\")\n end",
"def commit_db_transaction\n execute(\"COMMIT\")\n end",
"def rollback_db_transaction() end",
"def rollback_db_transaction() end",
"def rollback_db_transaction\n execute(\"ROLLBACK\")\n end",
"def roll... | [
"0.8019847",
"0.8019847",
"0.77375084",
"0.77375084",
"0.76324254",
"0.76324254",
"0.7618432",
"0.7618432",
"0.7577138",
"0.75130767",
"0.74851495",
"0.7382211",
"0.7234997",
"0.7234997",
"0.72074765",
"0.7205753",
"0.71591",
"0.71304965",
"0.7120575",
"0.7098702",
"0.7050998... | 0.825406 | 0 |
returns the customer for that given review | def customer
@@all.select {|review| self.restaurant.customers}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customers\n self.reviews.collect do |review|\n review.customer\n end\n end",
"def reviews\n Review.all.select {|review| review.customer == self}\n end",
"def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end",
"def customer_info(customer)\n return customer\n en... | [
"0.73927265",
"0.7021797",
"0.6681378",
"0.66530454",
"0.6397355",
"0.6392147",
"0.6286351",
"0.6278143",
"0.6274091",
"0.6260268",
"0.6226777",
"0.6219151",
"0.62127304",
"0.621204",
"0.6182674",
"0.61805177",
"0.6160093",
"0.6143058",
"0.6133048",
"0.61160433",
"0.61119837"... | 0.7124252 | 1 |
returns the restaurant for that given review | def restaurant
@restaurant
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def review\n fetch('restaurant.review')\n end",
"def reviewed?(restaurant, options = {})\n self.reviews.of_restaurant(restaurant, options).first\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n @reviews = Review.where(restaurant_id: params[:id])\n end",
"def show\n R... | [
"0.8102352",
"0.8025022",
"0.7583525",
"0.73381543",
"0.70767486",
"0.706454",
"0.69421977",
"0.69169235",
"0.69092065",
"0.67775613",
"0.6749716",
"0.6743598",
"0.67216897",
"0.670337",
"0.6641336",
"0.66171736",
"0.65653527",
"0.6464025",
"0.64590925",
"0.6458032",
"0.64391... | 0.6553296 | 17 |
GET /vocab_words GET /vocab_words.json | def index
logger.debug "-----index-----"
@vocab_words = VocabWord.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vocab_word_params\n params.require(:vocab_word).permit(:id, :word, :lesson)\n end",
"def set_vocab\n @vocab = Vocab.find(params[:id])\n end",
"def set_vocab_word\n logger.debug \"-----set_vocab_word----- \" + params[:id].to_s\n @vocab_word = VocabWord.find(params[:id])\n end",
... | [
"0.6881367",
"0.67803496",
"0.6658347",
"0.6625513",
"0.6545644",
"0.65180147",
"0.6476694",
"0.6476694",
"0.6469742",
"0.64538854",
"0.6389014",
"0.63863206",
"0.6380747",
"0.6372136",
"0.6322738",
"0.62874854",
"0.6276235",
"0.6267971",
"0.624049",
"0.6160532",
"0.61428565"... | 0.7528659 | 0 |
GET /vocab_words/1 GET /vocab_words/1.json | def show
logger.debug "-----show----- " + @vocab_word.word
#@vocab_word = VocabWord.first
logger.debug "-----id----- " + @vocab_word.id.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n logger.debug \"-----index-----\"\n @vocab_words = VocabWord.all\n end",
"def set_vocab\n @vocab = Vocab.find(params[:id])\n end",
"def set_vocab_word\n logger.debug \"-----set_vocab_word----- \" + params[:id].to_s\n @vocab_word = VocabWord.find(params[:id])\n end",
"de... | [
"0.7296224",
"0.70161885",
"0.688909",
"0.6884174",
"0.67165685",
"0.6663507",
"0.665158",
"0.654935",
"0.64854443",
"0.6416037",
"0.63935256",
"0.63797176",
"0.63795954",
"0.63511527",
"0.62814844",
"0.6275007",
"0.6254517",
"0.6248282",
"0.6234731",
"0.6228555",
"0.61967814... | 0.6237235 | 18 |
POST /vocab_words POST /vocab_words.json | def create
logger.debug "-----create-----"
@vocab_word = VocabWord.new(vocab_word_params)
logger.debug "-----before do-----"
logger.debug "---" + vocab_word_params.to_s
respond_to do |format|
if @vocab_word.save
format.html { redirect_to @vocab_word, notice: 'Vocab word was successfully created.' }
format.json { render :show, status: :created, location: @vocab_word }
else
format.html { render :new }
format.json { render json: @vocab_word.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vocab_word_params\n params.require(:vocab_word).permit(:id, :word, :lesson)\n end",
"def create\n @vocab = Vocab.new(vocab_params)\n\n respond_to do |format|\n if @vocab.save\n format.html { redirect_to @vocab, notice: \"Vocab was successfully created.\" }\n format.json { ren... | [
"0.72978127",
"0.7191699",
"0.69026977",
"0.6883259",
"0.6792142",
"0.6653299",
"0.64842373",
"0.64377415",
"0.6390551",
"0.6366225",
"0.6343987",
"0.62779063",
"0.62092596",
"0.6204751",
"0.61958855",
"0.6194163",
"0.61762506",
"0.6145415",
"0.6140732",
"0.61377466",
"0.6134... | 0.6960612 | 2 |
PATCH/PUT /vocab_words/1 PATCH/PUT /vocab_words/1.json | def update
logger.debug "-----update-----"
respond_to do |format|
if @vocab_word.update(vocab_word_params)
format.html { redirect_to @vocab_word, notice: 'Vocab word was successfully updated.' }
format.json { render :show, status: :ok, location: @vocab_word }
else
format.html { render :edit }
format.json { render json: @vocab_word.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @vocab.update(vocab_params)\n format.html { redirect_to @vocab, notice: \"Vocab was successfully updated.\" }\n format.json { render :show, status: :ok, location: @vocab }\n else\n format.html { render :edit, status: :unprocessable_entity }... | [
"0.7512258",
"0.73817486",
"0.71767724",
"0.6978025",
"0.6967143",
"0.6788993",
"0.67834914",
"0.66867137",
"0.6663082",
"0.6663082",
"0.6663082",
"0.6663082",
"0.66244763",
"0.6617048",
"0.659911",
"0.6586325",
"0.65775645",
"0.65340495",
"0.65164196",
"0.64963764",
"0.64770... | 0.776472 | 0 |
DELETE /vocab_words/1 DELETE /vocab_words/1.json | def destroy
@vocab_word.destroy
respond_to do |format|
format.html { redirect_to vocab_words_url, notice: 'Vocab word was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @vocab = Vocab.find(params[:id])\n @vocab.destroy\n\n respond_to do |format|\n format.html { redirect_to(vocabs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @spanish_vocab = SpanishVocab.find(params[:id])\n @spanish_vocab.destroy\n\n respond_to do |... | [
"0.7855895",
"0.77942723",
"0.77530044",
"0.76281035",
"0.7529423",
"0.7412873",
"0.72109514",
"0.714293",
"0.7027356",
"0.6936333",
"0.686022",
"0.68407667",
"0.6831672",
"0.6831672",
"0.6831672",
"0.6831672",
"0.6831672",
"0.6811018",
"0.67788315",
"0.67589533",
"0.6712174"... | 0.7729978 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_vocab_word
logger.debug "-----set_vocab_word----- " + params[:id].to_s
@vocab_word = VocabWord.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def vocab_word_params
params.require(:vocab_word).permit(:id, :word, :lesson)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Sperimentale, 20 agosto 2021 non ha un reale utilizzo, per ora | def soap_get_loans
client = SoapClient::get_wsdl('loan')
soap = :get_patron_active_loans
r = client.call(soap, message: {username:self.opac_username})
return [] if r.body["#{soap}_response".to_sym][:return].nil?
res=r.body["#{soap}_response".to_sym][:return][:item]
return if res.nil?
res.each do |e|
if e.class == Array
next if e.first != :item
e[1].each do |i|
next if !['ManifestationId','Title','ItemId'].include?(i[:key])
puts "A: #{i.inspect}"
end
else
e[:item].each do |i|
next if !['ManifestationId','Title','ItemId'].include?(i[:key])
puts "B: #{i.inspect}"
end
end
end
"test"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toca_actualizar\n (Time.now.to_date - self.historiales.last.fecha).to_i >= 30\n end",
"def prueba\n #onemonthago = \"> \" + Time.now.to_date.to_s\n #self.historiales.count\n query\n end",
"def scadenza\n if Setting.fee?\n #se l'utente non fa parte di un organismo convenzionato o q... | [
"0.659019",
"0.6394898",
"0.63039327",
"0.60691375",
"0.60685134",
"0.604469",
"0.60186946",
"0.5987143",
"0.59172195",
"0.58598316",
"0.58561254",
"0.57927275",
"0.5786053",
"0.57830805",
"0.5746755",
"0.5744075",
"0.5744075",
"0.5688655",
"0.5670321",
"0.5661955",
"0.566076... | 0.0 | -1 |
PUT /processed_samples/1 PUT /processed_samples/1.xml | def update
@processed_sample = ProcessedSample.find(params[:id])
ProcessedSample.transaction do
@processed_sample.update_attributes!(params[:processed_sample])
flash[:notice] = 'Processed sample successfully updated'
redirect_to(@processed_sample)
end
rescue ActiveRecord::RecordInvalid
render :action => "edit"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @xml_sample = XmlSample.find(params[:id])\n \n respond_to do |format|\n format.html do\n @xml_sample = XmlSample.update_attributes(params[:xml_sample])\n if @xml_sample.save\n return redirect_to @xml_sample, notice: 'Xml sample was successfully updated.'\n e... | [
"0.6220045",
"0.6095602",
"0.57013047",
"0.561126",
"0.55221444",
"0.55009156",
"0.5474981",
"0.5468895",
"0.5342076",
"0.5322039",
"0.5315566",
"0.5297336",
"0.5286427",
"0.52857375",
"0.52739745",
"0.5251494",
"0.52421975",
"0.5227644",
"0.521639",
"0.5215109",
"0.5213487",... | 0.5522456 | 4 |
POST /ordered_products POST /ordered_products.json | def create
product = Product.find(params[:product_id])
qty=params[:quantity].to_i
@ordered_product = @cart.add_product(product.id,qty)
@ordered_product.save
respond_to do |format|
format.html { redirect_to store_index_url, notice: 'Order placed successfully' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # @order = Order.new() \n total = 0\n \n @order = Order.new()\n for product in params[:_json]\n \n if (product[:quantity].nil? || product[:quantity].to_f < 1 || !isint(product[:quantity]))\n # Handle case when order invalid quantity\n render json: \"\", status... | [
"0.71917796",
"0.68572104",
"0.6814531",
"0.6812163",
"0.66617906",
"0.66579384",
"0.6610146",
"0.6609833",
"0.65833217",
"0.65512246",
"0.65207",
"0.64931464",
"0.64602286",
"0.6357968",
"0.6339317",
"0.6295839",
"0.627902",
"0.62328935",
"0.62245107",
"0.62226135",
"0.61819... | 0.6360396 | 13 |
DELETE /ordered_products/1 DELETE /ordered_products/1.json | def destroy
ordered_product = OrderedProduct.find(params[:id])
ordered_product.destroy
respond_to do |format|
format.html { redirect_to ordered_products_url, notice: 'Ordered product was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_product(id)\n @client.raw('delete', \"/ecommerce/products/#{id}\")\n end",
"def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end",
"def destroy\n product = Product.find(params[:id])\n product.destroy\n\n render json: { deleted: params[:id] }\n end",
"def dele... | [
"0.73640126",
"0.73628706",
"0.7301586",
"0.7228808",
"0.71954626",
"0.7171018",
"0.71342015",
"0.712623",
"0.7096929",
"0.70152444",
"0.7013235",
"0.69853884",
"0.69637036",
"0.695253",
"0.6946865",
"0.6940598",
"0.6940037",
"0.69364256",
"0.69355965",
"0.6934195",
"0.693193... | 0.72612166 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_ordered_product
@ordered_product =OrderedProduct.find_by(product_id: params[:product_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def ordered_product_params
params.require(:ordered_product).permit(:quantity, :product_id, :cart_id, :price_per_unit)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Create two line items, then delete one and post. | def test_should_create_and_delete_line_items_before_post
assert_difference 'Invoice.count' do
assert_difference 'LineItem.count', 1 do
@basic_user.creates_new_invoice
@basic_user.enter_new_customer(
:name => "Test 8 Customer Name 4")
#get first row in the table.
trows = @basic_user.line_items_rows
assert_equal 1, trows.length
tr1 = trows[::WatirBrowser.item_index(1)]
assert tr1.exists?
@basic_user.populate(tr1.text_field(:name, "invoice[line_items_attributes][][description]"), "Description one")
@basic_user.link(:id, "add_line_item").click
#get second row in the table.
trows = @basic_user.line_items_rows
assert_equal 2, trows.length
tr2 = trows[::WatirBrowser.item_index(2)]
assert tr2.exists?
@basic_user.populate(tr2.text_field(:name, 'invoice[line_items_attributes][][description]'),'Description two')
#remove the first line item
@basic_user.line_items_rows[::WatirBrowser.item_index(1)].link(:name, 'remove').click
@basic_user.submits
end
end
invoice = Invoice.find(:first, :order => 'id desc')
assert_equal 1, invoice.line_items.count
assert_equal 'Description two', invoice.line_items[0].description
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_two_items\n Item.create(id: 1,\n name: \"Ergonomic Steel Bottle\",\n description: \"Sint quasi modi officiis.\",\n image_url: \"http://robohash.org/0.png?set=set2&bgset=bg1&size\",\n created_at: \"2016-03-08 14:53:57\",\n updated_at: \"2016-03-08 14:53:57\")\n\n Item.creat... | [
"0.619228",
"0.59818095",
"0.5954227",
"0.5844343",
"0.58334655",
"0.58043057",
"0.5686945",
"0.5669499",
"0.55842483",
"0.5581403",
"0.5569404",
"0.5557265",
"0.5544393",
"0.5426482",
"0.54170287",
"0.54046047",
"0.53990847",
"0.5392674",
"0.5374734",
"0.53691435",
"0.536513... | 0.61168075 | 1 |
Test editing an invoice with line items Remove first line item from existing invoice | def test_should_remove_first_line_item_from_invoice
assert_no_difference 'Invoice.count' do
assert_difference 'LineItem.count', -1 do
@basic_user.edits_invoice(invoices(:invoice_with_line_items).id)
#get first row in the table.
trows = @basic_user.line_items_rows
assert_equal 2, trows.length
tr1 = trows[::WatirBrowser.item_index(1)]
assert tr1.exists?
@basic_user.populate(tr1.text_field(:name, "invoice[line_items_attributes][][description]"),"Removed Description one")
#remove the first line item
tr1.link(:name, 'remove').click
@basic_user.submits
end
end
invoice = Invoice.find(invoices(:invoice_with_line_items).id)
assert_equal 1, invoice.line_items.count
assert_equal line_items(:line_item_two).description, invoice.line_items[0].description
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_remove_second_line_item_from_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', -1 do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_... | [
"0.83617604",
"0.79391605",
"0.7673628",
"0.76541674",
"0.70887643",
"0.6625306",
"0.6349206",
"0.629921",
"0.6234087",
"0.62202394",
"0.6171657",
"0.6151414",
"0.61462253",
"0.6124051",
"0.60942584",
"0.60929424",
"0.60852313",
"0.6070845",
"0.60570127",
"0.60429543",
"0.603... | 0.84499925 | 0 |
Remove second line item from existing invoice | def test_should_remove_second_line_item_from_invoice
assert_no_difference 'Invoice.count' do
assert_difference 'LineItem.count', -1 do
@basic_user.edits_invoice(invoices(:invoice_with_line_items).id)
#get first row in the table.
trows = @basic_user.line_items_rows
assert_equal 2, trows.length
tr2 = trows[::WatirBrowser.item_index(2)]
assert tr2.exists?
@basic_user.populate(tr2.text_field(:name, "invoice[line_items_attributes][][description]"),"Removed Description two")
#remove the second line item
tr2.link(:name, 'remove').click
@basic_user.submits
end
end
invoice = Invoice.find(invoices(:invoice_with_line_items).id)
assert_equal 1, invoice.line_items.count
assert_equal line_items(:line_item_one).description, invoice.line_items[0].description
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_remove_first_line_item_from_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', -1 do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_i... | [
"0.7385918",
"0.69709754",
"0.6472073",
"0.6346085",
"0.63355845",
"0.6247482",
"0.6227869",
"0.6215378",
"0.6121174",
"0.6109852",
"0.60717595",
"0.604536",
"0.6017167",
"0.6006678",
"0.60055923",
"0.59993374",
"0.59986085",
"0.59845936",
"0.5981097",
"0.5944877",
"0.5933211... | 0.75662285 | 0 |
Add and remove items from existing invoice | def test_should_add_edit_and_remove_line_items_in_invoice
assert_no_difference 'Invoice.count' do
assert_no_difference 'LineItem.count' do
@basic_user.edits_invoice(invoices(:invoice_with_line_items).id)
@basic_user.link(:id, "add_line_item").click
#get newly added last row in the table to enter text
trows = @basic_user.line_items_rows
assert_equal 3, trows.length
tr = trows[::WatirBrowser.item_index(trows.length)]
assert tr.exists?
@basic_user.populate(tr.text_field(:name, "invoice[line_items_attributes][][description]"),'Description of new line item')
#remove the second line item
trows = @basic_user.line_items_rows
assert_equal 3, trows.length
tr = trows[::WatirBrowser.item_index(2)]
assert tr.exists?
@basic_user.populate(tr.text_field(:name, "invoice[line_items_attributes][][description]"),"Deleted Description two")
tr.link(:name, 'remove').click
assert_equal false, tr.visible?
#edit the first row in the table.
trows = @basic_user.line_items_rows
assert_equal 3, trows.length
tr = trows[::WatirBrowser.item_index(1)]
assert tr.exists?
@basic_user.populate(tr.text_field(:name, "invoice[line_items_attributes][][description]"),"Changed Description One")
@basic_user.submits
end
end
invoice = Invoice.find(invoices(:invoice_with_line_items).id)
assert_equal 2, invoice.line_items.count
assert_equal 'Changed Description One', invoice.line_items[0].description
assert_equal line_items(:line_item_one).description, invoice.line_items[0].description
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rebuild_invoice\n end",
"def test_dsl_should_add_edit_and_remove_line_items_in_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_no_difference 'LineItem.count' do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n assert_equal 3, @basic_user.adds_line... | [
"0.66532695",
"0.6511211",
"0.6505147",
"0.64429724",
"0.6395524",
"0.6354986",
"0.6324268",
"0.6311021",
"0.6232456",
"0.6216701",
"0.62118167",
"0.6158757",
"0.6153422",
"0.6135942",
"0.61298585",
"0.60817504",
"0.6078907",
"0.60595196",
"0.60558444",
"0.60461545",
"0.60274... | 0.62403065 | 8 |
DSL tests Test dsl for add, remove, and edit items from existing invoice | def test_dsl_should_add_edit_and_remove_line_items_in_invoice
assert_no_difference 'Invoice.count' do
assert_no_difference 'LineItem.count' do
@basic_user.edits_invoice(invoices(:invoice_with_line_items).id)
assert_equal 3, @basic_user.adds_line_item(:unit => 'New line item', :description => 'Description of new line item')
assert @basic_user.removes_line_item(2)
@basic_user.edits_line_item(1, :description => 'Changed Description One').
and_submits
end
end
invoice = Invoice.find(invoices(:invoice_with_line_items).id)
assert_equal 2, invoice.line_items.count
assert_equal 'Changed Description One', invoice.line_items[0].description
assert_equal line_items(:line_item_one).description, invoice.line_items[0].description
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_add_edit_and_remove_line_items_in_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_no_difference 'LineItem.count' do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n @basic_user.link(:id, \"add_line_item\").click\r\n\r\n ... | [
"0.7535946",
"0.7379648",
"0.695239",
"0.6883084",
"0.6797367",
"0.67200434",
"0.6701178",
"0.66296726",
"0.6491032",
"0.6433756",
"0.64238167",
"0.63970625",
"0.63964486",
"0.63707995",
"0.63685155",
"0.6353537",
"0.63334715",
"0.6266988",
"0.62041867",
"0.61894464",
"0.6125... | 0.8291523 | 0 |
AUTENTICADOR DE USUARIOS se ejecuta antes de los metodos solo en los seleccionados before_action :imprimir, execept: [:index, :show, :update, :destroy] se ejecuta antes de los metodos en todos menos lo seleccionado | def show
# no se que hace
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imprimir_todo\n\n # aqui guardo todos los datos que necesito para imprimirlos en las variable\n\n @width_layout = '955'\n @form_title = ''\n @imprimo='1'\n \n #@ordenes_de_despacho_aux=OrdenDespachoDetalle.find(:all, :conditions=>\"id in #{params[:ordenes_despachos_id]}\")\n\n\n @factura_orden... | [
"0.60304195",
"0.5563668",
"0.5520838",
"0.55039513",
"0.54616994",
"0.5419574",
"0.5382897",
"0.53623044",
"0.53151214",
"0.53027296",
"0.5270561",
"0.52387244",
"0.52054787",
"0.5200205",
"0.51983345",
"0.5198257",
"0.5197056",
"0.5185644",
"0.5185644",
"0.51443225",
"0.512... | 0.0 | -1 |
respond to checkjira command same as interval except we answer with 'no issues found' if there are no issues | def checkjira_command(msg)
begin
msg.speak "no new issues since I last checked #{@lastlast} ago" \
if !check_jira(msg)
rescue
msg.speak "sorry, we had trouble connecting to JIRA."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_jira_deploy_task\n jira_search_url = 'https://projects.engineering.redhat.com/rest/api/2/search'\n jira_query = \"Project = ERRATA AND Type = Task AND labels = pntdevops-sysops-deploy ORDER BY updated Desc\"\n response_json = %x{ curl -s -H \"Content-Type: application/json\" \\\n \"#{jira_search_url}... | [
"0.63642186",
"0.63343",
"0.625044",
"0.61547637",
"0.6061006",
"0.60454756",
"0.5998648",
"0.5927596",
"0.59033316",
"0.5882272",
"0.5823309",
"0.5747291",
"0.5721177",
"0.570943",
"0.5679453",
"0.5659468",
"0.5638854",
"0.56316507",
"0.5629341",
"0.5620768",
"0.5604003",
... | 0.74881154 | 0 |
fetch jira url and return a list of ticket Hashes | def fetch_jira_poll_url()
jiraconfig = bot.config['jira_poll_url']
if jiraconfig.is_a?(Array)
searchurls_str = jiraconfig
else
searchurls_str = [jiraconfig]
end
tix = []
searchurls_str.each do |searchurl_str|
begin
@log.info "checking jira for new issues... #{searchurl_str}"
# jira_poll_url: "http://username:password@www.host.com/jira/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+OPS+ORDER+BY+updated+DESC%2C+priority+DESC%2C+created+ASC&tempMax=25&field=key&field=link&field=title&field=reporter&field=assignee&field=type&field=priority&field=updated"
searchurl = Addressable::URI.parse(searchurl_str)
@log.debug pp lookupurl.to_hash
xmldata = open(searchurl.omit(:user, :password), \
:http_basic_authentication=>[searchurl.user, searchurl.password]).read
doc = REXML::Document.new(xmldata)
raise Exception.new("response had no content") if doc.nil?
doc.elements.inject('rss/channel/item', tix) do |tix, element|
tix.push(parse_ticket_info(element))
end
rescue Exception => e
@log.error "error connecting to jira: #{e.message}"
# @log.error "#{e.backtrace}"
end
end
return tix
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_issues\n jira_issues = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n uri = URI(JIRA_BASE_URL + '/rest/api/2/search?jql=' + JQL)\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request =... | [
"0.7108783",
"0.7011311",
"0.68948025",
"0.6683555",
"0.65772647",
"0.6380045",
"0.63721925",
"0.6224195",
"0.61780363",
"0.61041003",
"0.6091607",
"0.6051491",
"0.597635",
"0.5954039",
"0.5953175",
"0.5949902",
"0.5934485",
"0.5919058",
"0.5848761",
"0.5840244",
"0.58103335"... | 0.7252817 | 0 |
extract array of comments from an xml element (ticket) | def parse_ticket_for_comments(xml)
comments = []
doc = REXML::Document.new(xml)
doc.elements.inject('item/comments', comments) do |comments, element|
comments.push(parse_comment_info(element))
end
return comments
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments\n if nodes = @node.xpath(\"comments\")\n nodes.map { |node| node.content }.compact\n end\n end",
"def comments\n get_ticket_property_list(\"comments\" , Unfuddled::Comment)\n end",
"def extract_ticket_ids\n tickets = message.split('Ref: ').last\n tickets.gsub('#',... | [
"0.68685955",
"0.66146517",
"0.5963169",
"0.59491605",
"0.5747329",
"0.57101387",
"0.5701599",
"0.5660127",
"0.562449",
"0.56160307",
"0.56068105",
"0.55906016",
"0.5577316",
"0.5571283",
"0.55611193",
"0.55536056",
"0.5549933",
"0.5549933",
"0.5549933",
"0.5531084",
"0.55240... | 0.8522526 | 0 |
extract comment hash from individual xml element | def parse_comment_info(xml_element)
text = xml_element.elements['comment'].text rescue ""
author = xml_element.elements['comment'].key['author'] rescue ""
created = xml_element.elements['comment'].key['created'] rescue ""
return {
:text => text,
:author => author,
:created => created
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_xml_comment(el, opts)\n block = el.options[:category] == :block\n indent = SPACE * @current_indent\n content = el.value\n content.gsub!(/^<!-{2,}\\s*/, \"\") if content.start_with?(\"<!--\")\n content.gsub!(/-{2,}>$/, \"\") if content.end_with?(\"-->\")\n resul... | [
"0.64380425",
"0.58777505",
"0.56281865",
"0.56281865",
"0.56281865",
"0.5613709",
"0.560455",
"0.5583392",
"0.55376524",
"0.55260986",
"0.55250883",
"0.5472814",
"0.544129",
"0.5417839",
"0.5410514",
"0.5402042",
"0.5397296",
"0.5386199",
"0.5317554",
"0.53128827",
"0.531158... | 0.6524682 | 0 |
extract ticket hash from individual xml element | def parse_ticket_info(xml_element)
id = xml_element.elements['key'].text rescue ""
id, spacekey = split_spacekey_and_id(id) rescue ""
link = xml_element.elements['link'].text rescue ""
title = xml_element.elements['title'].text rescue ""
reporter = xml_element.elements['reporter'].text rescue ""
assignee = xml_element.elements['assignee'].text rescue ""
type = xml_element.elements['type'].text rescue ""
priority = xml_element.elements['priority'].text rescue ""
updated = xml_element.elements['updated'].text rescue ""
status = xml_element.elements['status'].text rescue ""
return {
:spacekey => spacekey,
:id => id,
:link => link,
:title => title,
:reporter => reporter,
:assignee => assignee,
:type => type,
:priority => priority,
:updated => updated,
:status => status
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getHash element\n\tfile = File.new(element)\n\thash = Digest::SHA256.file file\n\tfile.close\n\treturn hash.hexdigest \n\tend",
"def hash\n element.hash\n end",
"def lookup_remote(md5_hash)\n unhash_data = Scrubyt::Extractor.define do\n fetch \"http://gdataonline.com/qkhash.php?mode=txt&has... | [
"0.5922472",
"0.58482444",
"0.5809524",
"0.57388896",
"0.56058156",
"0.556271",
"0.55327725",
"0.5470769",
"0.5463087",
"0.54590654",
"0.54402834",
"0.5395999",
"0.53182447",
"0.52731335",
"0.52523834",
"0.5250259",
"0.5247216",
"0.52017915",
"0.5194405",
"0.5184408",
"0.5171... | 0.619712 | 0 |
extract the spacekey and id from the ticket id | def split_spacekey_and_id(key)
spacekey = key.scan(/^([A-Z]+)/).to_s
id = key.scan(/([0-9]+)$/)[0].to_s.to_i
return id, spacekey
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDetails id\n\t\tticket = @tickets.read ['id', 'pid', 'title', 'description', 'tracker', 'creator', 'created', 'status'], ['id', id]\n\t\tticket = ticket[0]\n\tend",
"def parse_ticket_info(xml_element)\n id = xml_element.elements['key'].text rescue \"\"\n id, spacekey = split_spacekey_and_id(id) resc... | [
"0.61230016",
"0.60488576",
"0.5990504",
"0.59409875",
"0.5786135",
"0.57694894",
"0.57614124",
"0.57599014",
"0.57484484",
"0.567149",
"0.5654165",
"0.5646187",
"0.56349105",
"0.5570488",
"0.55477464",
"0.552996",
"0.5519182",
"0.55168974",
"0.5502929",
"0.5499951",
"0.54960... | 0.68602353 | 0 |
has this ticket been seen before this run? | def seen?(ticket, old_cache)
!old_cache.key?(ticket[:spacekey]) or
old_cache[ticket[:spacekey]] < ticket[:id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_recent_acquisition?\n contexts.flag5 == 1\n end",
"def has_history?\n Ticket.client(client).any?\n end",
"def old?\n # they specifically told us via chatops that they were done, so they\n # probably don't mean this one\n return true if chat_end\n\n # the incident is s... | [
"0.67480403",
"0.6736863",
"0.673405",
"0.6564503",
"0.65400577",
"0.6409934",
"0.6403669",
"0.637367",
"0.63374555",
"0.63249755",
"0.631583",
"0.6275977",
"0.6214029",
"0.6204687",
"0.6184628",
"0.6165513",
"0.6160943",
"0.61553645",
"0.61475426",
"0.6134437",
"0.6123838",
... | 0.6519521 | 5 |
only update the cached highest ID if it is in fact the highest ID | def update_cache(ticket, cache)
cache[ticket[:spacekey]] = ticket[:id] if seen?(ticket, cache)
cache
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_key\n last_key = User.find_by_sql('select max(userId) as maxid from user')[0].maxid\n self.userId = last_key.to_i + 1\n end",
"def set_key\n last_key = Issue.find_by_sql('select max(issueId) as maxid from issue')[0].maxid\n self.issueId = last_key.to_i + 1\n end",
"def check_id\n unles... | [
"0.6537332",
"0.6504027",
"0.6429609",
"0.6163954",
"0.6021805",
"0.6020452",
"0.6018281",
"0.59736353",
"0.5902077",
"0.58867997",
"0.58355767",
"0.5814599",
"0.5781771",
"0.57282966",
"0.5722804",
"0.5676779",
"0.5662845",
"0.5652453",
"0.5649362",
"0.5625645",
"0.5610484",... | 0.0 | -1 |
write the cache to disk | def flush_cache(cache)
cache[:last_checked] = @last_checked
File.open(@data_file, 'w') do |out|
YAML.dump(cache, out)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_cache\n data = cache_data\n open(writable_file, \"wb\") do |f|\n\tf.puts Marshal.dump(data)\n end\n end",
"def write_cache_file\n open(@cache_file, 'w') do |f|\n f.puts({ \n :userid => @userid,\n :token => @token,\n :account_info => @account_info,\n ... | [
"0.84125865",
"0.8215292",
"0.81883854",
"0.8075977",
"0.8073828",
"0.79505724",
"0.7723713",
"0.77076095",
"0.76915324",
"0.7678307",
"0.74382246",
"0.74256533",
"0.74256533",
"0.7341669",
"0.72908884",
"0.7206609",
"0.70832866",
"0.70690906",
"0.7047646",
"0.70200586",
"0.6... | 0.6519086 | 32 |
Format fragment operation as string | def format_fragment_operation(fragment_operation, level)
result = []
result << indent(level) + format_fragment_operation_signature(fragment_operation)
result << "#{indent(level)}{"
result += fragment_operation.__nodes.map { |node| format_node(node, level + 1) }
result << "#{indent(level)}}"
result.join("\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_fragment_operation_signature(fragment_operator)\n [\n \"fragment #{fragment_operator.__name}\",\n \"on #{fragment_operator.__type}\",\n format_directives(fragment_operator.__directives, false),\n ].compact.join(' ')\n end",
"def fragment(string); end",
"... | [
"0.7952485",
"0.6508253",
"0.64462006",
"0.62495637",
"0.6096381",
"0.59725726",
"0.5758454",
"0.5752238",
"0.5742718",
"0.5738212",
"0.5724992",
"0.5721963",
"0.57028353",
"0.57016456",
"0.5695638",
"0.56856865",
"0.56808215",
"0.5670218",
"0.5643368",
"0.5639466",
"0.561187... | 0.72659457 | 1 |
Format fragment operation signature as string | def format_fragment_operation_signature(fragment_operator)
[
"fragment #{fragment_operator.__name}",
"on #{fragment_operator.__type}",
format_directives(fragment_operator.__directives, false),
].compact.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signature_base_string\n \"#{method.to_s.upcase}&#{full_uri}&#{normalise_signature_params}\"\n end",
"def signature\n # FIXME merb keeps mangling this by replacing \"+\" with \"\\s\" \n oauth_merged_params[:oauth_signature]\n end",
"def string_to_sign\n if content... | [
"0.70344776",
"0.66106296",
"0.6537091",
"0.65270776",
"0.6473858",
"0.6378303",
"0.62362593",
"0.6228909",
"0.6199462",
"0.6150939",
"0.6069784",
"0.60474354",
"0.6043087",
"0.60250705",
"0.60044414",
"0.5975935",
"0.596834",
"0.5963453",
"0.59380937",
"0.5929398",
"0.592906... | 0.78802097 | 0 |
def ask_for_name puts "What's the name of the recipe?" gets.chomp end def ask_for_description puts "What's the description of the recipe?" gets.chomp end | def ask_for_(thing)
puts "What's the #{thing}?"
gets.chomp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ask_name\n listing\n puts \"please input your recipe name\"\n recipe_name = gets.chomp\n end",
"def ask_user_for(something)\n puts \"What is the recipe #{something} ?\"\n return gets.chomp\n end",
"def ask_for_name\n puts \"what s the name of the task you want to create?\"\n name = g... | [
"0.8356335",
"0.77842045",
"0.7642762",
"0.7580817",
"0.75043017",
"0.7496162",
"0.744863",
"0.7379423",
"0.7268149",
"0.7156204",
"0.71454865",
"0.7103286",
"0.70916665",
"0.7090229",
"0.7083376",
"0.70820856",
"0.7072963",
"0.70597225",
"0.704792",
"0.7036228",
"0.7004203",... | 0.7185545 | 9 |
GET /admin/rights/1 GET /admin/rights/1.json | def show
@right = Right.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @right }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @rights = Right.all\n end",
"def index\n @access_rights = AccessRight.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @access_rights }\n end\n end",
"def show\n @access_right = AccessRight.find(params[:id])\n\n respond_to do |... | [
"0.7418531",
"0.7017065",
"0.6966152",
"0.6679354",
"0.64964217",
"0.6463677",
"0.63731945",
"0.6355264",
"0.634057",
"0.63171875",
"0.63143224",
"0.63143224",
"0.63143224",
"0.63143224",
"0.63143224",
"0.62540203",
"0.6169052",
"0.6121812",
"0.61162615",
"0.6101706",
"0.6098... | 0.6186792 | 16 |
GET /admin/rights/new GET /admin/rights/new.json | def new
@right = Right.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @right }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @access_right = AccessRight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @access_right }\n end\n end",
"def new\n \n @roles_and_permission = @roles.roles_and_permission.new\n \n respond_to do |format|\n format.html # new.h... | [
"0.728867",
"0.6990209",
"0.68578523",
"0.6855714",
"0.67928547",
"0.6774837",
"0.6774837",
"0.6704889",
"0.6704889",
"0.6704889",
"0.6651943",
"0.6631726",
"0.6598057",
"0.6594575",
"0.65912896",
"0.6590574",
"0.6576664",
"0.6569264",
"0.6564156",
"0.655572",
"0.6551336",
... | 0.7044477 | 1 |
POST /admin/rights POST /admin/rights.json | def create
@right = Right.new(params[:right])
respond_to do |format|
if @right.save
format.html { redirect_to admin_right_path(@right), notice: 'Right was successfully created.' }
format.json { render json: @right, status: :created, location: @right }
else
format.html { render action: "new" }
format.json { render json: @right.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rights\n @rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def add_right\n role = Role.find(params[:id])\n\tright = Right.find(params[:right_id])\n role.rights << right\n redirect_to roles_rights_url\n\n end",
"def create\n @company = Company.... | [
"0.67527276",
"0.66291976",
"0.66136247",
"0.6526833",
"0.64326364",
"0.64307266",
"0.6354329",
"0.6254608",
"0.61004204",
"0.61004204",
"0.61004204",
"0.61004204",
"0.61004204",
"0.59401983",
"0.5927311",
"0.5906211",
"0.59023947",
"0.58282226",
"0.5816841",
"0.5765109",
"0.... | 0.65926313 | 3 |
PUT /admin/rights/1 PUT /admin/rights/1.json | def update
@right = Right.find(params[:id])
respond_to do |format|
if @right.update_attributes(params[:right])
format.html { redirect_to admin_right_path(@right), notice: 'Right was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @right.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rights\n @rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def update\n @access_right = AccessRight.find(params[:id])\n\n respond_to do |format|\n if @access_right.update_attributes(params[:access_right])\n format.html { redirect_to @access... | [
"0.67360616",
"0.66180056",
"0.6443705",
"0.6359975",
"0.63044715",
"0.62529695",
"0.62529695",
"0.62529695",
"0.62529695",
"0.62529695",
"0.6232228",
"0.6224553",
"0.6091866",
"0.6089308",
"0.60690236",
"0.60633045",
"0.602135",
"0.6013465",
"0.59934676",
"0.5965458",
"0.595... | 0.6751367 | 0 |
DELETE /admin/rights/1 DELETE /admin/rights/1.json | def destroy
@right = Right.find(params[:id])
@right.destroy
respond_to do |format|
format.html { redirect_to admin_rights_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @privilege.destroy\n respond_to do |format|\n format.html { redirect_to privileges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @right.destroy\n respond_to do |format|\n format.html { redirect_to rights_url, notice: 'Right was successfully des... | [
"0.6821523",
"0.6796628",
"0.66926265",
"0.6686518",
"0.6645824",
"0.66284394",
"0.6593673",
"0.65813273",
"0.6548169",
"0.6537271",
"0.6532709",
"0.6524623",
"0.65094864",
"0.65058345",
"0.64883137",
"0.64711654",
"0.6463697",
"0.64591",
"0.64466465",
"0.64441735",
"0.643603... | 0.74355155 | 0 |
GET /clasifications or /clasifications.json | def index
@clasifications = Clasification.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classifications(classification)\n params = {\n classification: classification\n }.compact\n\n _get(\"/account/classifications\", params) { |json| json }\n end",
"def index\n @citizenship_classes = @grantee.citizenship_classes.all\n\n respond_to do |format|\n form... | [
"0.73342395",
"0.61597574",
"0.6052229",
"0.6044177",
"0.5962895",
"0.59367573",
"0.5924675",
"0.5913115",
"0.5905584",
"0.58767897",
"0.5853619",
"0.5838951",
"0.5827974",
"0.5788656",
"0.57782507",
"0.5752925",
"0.5745936",
"0.57021964",
"0.5683032",
"0.56769085",
"0.567234... | 0.704686 | 1 |
GET /clasifications/1 or /clasifications/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classifications(classification)\n params = {\n classification: classification\n }.compact\n\n _get(\"/account/classifications\", params) { |json| json }\n end",
"def index\n @clasifications = Clasification.all\n end",
"def show\n @class = Classe.find(params[:id])\n... | [
"0.68108886",
"0.67072684",
"0.6277717",
"0.619331",
"0.6120883",
"0.60485315",
"0.60104614",
"0.59777987",
"0.5952075",
"0.5938955",
"0.591932",
"0.5914917",
"0.5884447",
"0.5874903",
"0.5855379",
"0.5845953",
"0.5764008",
"0.57478034",
"0.57432467",
"0.57344365",
"0.5714910... | 0.0 | -1 |
POST /clasifications or /clasifications.json | def create
@clasification = Clasification.new(clasification_params)
respond_to do |format|
if @clasification.save
format.html { redirect_to @clasification, notice: "Clasification was successfully created." }
format.json { render :show, status: :created, location: @clasification }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @clasification.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n Rails.logger.debug \"[ClassificationsController.create] params.class: #{params.class}, params: #{params}\"\n @classifaction = Classification.new transaction_data: params\n @classifaction.classifiers << StatusCodeClassifier.classify( @classifaction.transaction_data )\n @classifaction.classi... | [
"0.69274217",
"0.6877386",
"0.64458674",
"0.63242775",
"0.63035417",
"0.6214275",
"0.62128997",
"0.619138",
"0.61775076",
"0.6161782",
"0.6152889",
"0.6144488",
"0.6135515",
"0.6110071",
"0.6085759",
"0.60156703",
"0.59860504",
"0.5980081",
"0.5960773",
"0.5891116",
"0.586456... | 0.71609735 | 0 |
PATCH/PUT /clasifications/1 or /clasifications/1.json | def update
respond_to do |format|
if @clasification.update(clasification_params)
format.html { redirect_to @clasification, notice: "Clasification was successfully updated." }
format.json { render :show, status: :ok, location: @clasification }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @clasification.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @clazz = Clazz.find(params[:id])\n\n respond_to do |format|\n if @clazz.update_attributes(params[:clazz])\n format.html { redirect_to @clazz, notice: 'Clazz was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit... | [
"0.67100155",
"0.66281736",
"0.6524881",
"0.6452379",
"0.6452379",
"0.6433005",
"0.64201784",
"0.6417815",
"0.63855267",
"0.6357982",
"0.634495",
"0.633136",
"0.6271337",
"0.6270323",
"0.6196443",
"0.61885625",
"0.6135036",
"0.6129476",
"0.6114893",
"0.61010915",
"0.60980946"... | 0.71494967 | 0 |
DELETE /clasifications/1 or /clasifications/1.json | def destroy
@clasification.destroy
respond_to do |format|
format.html { redirect_to clasifications_url, notice: "Clasification was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @classtable = Classtable.find(params[:id])\n @classtable.destroy\n\n respond_to do |format|\n format.html { redirect_to classtables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classification = Classification.find(params[:id])\n @classification... | [
"0.7173859",
"0.7167455",
"0.69788367",
"0.69367486",
"0.6934053",
"0.6852698",
"0.6843896",
"0.684144",
"0.68140477",
"0.6777117",
"0.676174",
"0.675907",
"0.6743268",
"0.67407304",
"0.67407304",
"0.6730304",
"0.6728989",
"0.6725533",
"0.67099106",
"0.6672651",
"0.6659072",
... | 0.74043316 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_clasification
@clasification = Clasification.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def clasification_params
params.require(:clasification).permit(:clasification)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Returns the coordinate's latitude. | def lat
return @latitude
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latitude\n geo_attribute('lat')\n end",
"def latitude\n self.to_coordinates[0]\n end",
"def latitude\n coordinates[0];\n end",
"def latitude\n \tif(self.coordinates != nil)\n\t \treturn self.coordinates.y\n\t else\n\t \treturn nil\n\t end\n end",
"def latitude\n \ti... | [
"0.81763697",
"0.81739193",
"0.815997",
"0.79705924",
"0.79705924",
"0.7879613",
"0.764805",
"0.7607237",
"0.75363827",
"0.7529193",
"0.7521371",
"0.7493734",
"0.7419465",
"0.74028563",
"0.7374033",
"0.7320704",
"0.7243116",
"0.7211252",
"0.7183088",
"0.71645087",
"0.7118947"... | 0.76033735 | 8 |
Returns the coordinate's longitude. | def lon
return @longitude
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def longitude\n self.to_coordinates[1]\n end",
"def longitude\n geo_attribute('long')\n end",
"def longitude\n @longitude\n end",
"def longitude\n if public_address?\n (location['location'] || {})['longitude']\n elsif zip_coords.present?\n zip_coords[1]\n ... | [
"0.86828744",
"0.82348293",
"0.822472",
"0.80912775",
"0.806118",
"0.79826885",
"0.79341197",
"0.7801044",
"0.7653951",
"0.7617614",
"0.73927003",
"0.73670065",
"0.72800153",
"0.71187216",
"0.7035157",
"0.7000586",
"0.6957537",
"0.6906267",
"0.68618035",
"0.6857905",
"0.67037... | 0.8222612 | 3 |
Return block.call and ignore any exceptions. | def ignore &block
begin; block.call; rescue; end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callBlock\n yield\n yield\nend",
"def safe_call(&block)\n begin\n block.call\n rescue NoMethodError => e\n nil\n end\n end",
"def call(&block)\n execute(&block) if valid?\n execution_attempted!\n self\n end",
"def call_block(&block)\n block.call\nend",
"def ca... | [
"0.7307136",
"0.7278108",
"0.72582936",
"0.7183618",
"0.71162266",
"0.70423657",
"0.6824858",
"0.68083197",
"0.6780153",
"0.6780119",
"0.6752686",
"0.6752551",
"0.6730992",
"0.6700268",
"0.6682103",
"0.66270113",
"0.66044366",
"0.653387",
"0.653387",
"0.653387",
"0.6531826",
... | 0.6588713 | 17 |
Check every 0.5 seconds to see if block.call returns true. nil is considered a failure. Give up after 30 seconds. | def wait_true max_wait=30, interval=0.5, &block
max_wait = 1 if max_wait <= 0
result = nil
timeout max_wait do
until (result = begin; block.call; rescue; end)
sleep interval
end
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keep_trying_till_true timeout = 30\n t_begin = Time.now\n delay = 10\n loop do\n if yield\n break\n elsif (Time.now - t_begin) > timeout\n fail \"Timeout after trying for #{timeout} seconds\"\n else\n sleep delay\n end\n delay += 1\n end\nend",
"def wait_until(timeout=10, &b... | [
"0.6829118",
"0.6670128",
"0.66382533",
"0.6588048",
"0.65865827",
"0.64950585",
"0.64216465",
"0.6327964",
"0.6284875",
"0.6152245",
"0.6101874",
"0.60759",
"0.60516053",
"0.6038432",
"0.5987311",
"0.59793013",
"0.5964858",
"0.5927506",
"0.5926482",
"0.5924625",
"0.5901724",... | 0.67188305 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.