query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Syntax: (cons expr1 expr2) | def func_cons(args)
p = @o_man.new_object(LObject::OBJ_CONS)
p.value.c.car = _eval(car(args))
p.value.c.cdr = _eval(car(cdr(args)))
return p
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def two1 a; a[0] + a[1] end",
"def cons\n\t\t\tarray = pop\n\t\t\telement = pop\n\t\t\traise ArgumentError, \"CONS: first element is not an Array.\" unless array.is_a? Array\n\t\t\tpush array.insert(0, element)\n\t\tend",
"def to_cons; self; end",
"def expressions_over(op1, op2)\n expressions_over_lists( as... | [
"0.58771133",
"0.5459989",
"0.5311257",
"0.52684706",
"0.5159612",
"0.49958274",
"0.49590334",
"0.49565104",
"0.49475864",
"0.4872846",
"0.4845985",
"0.48316345",
"0.47476876",
"0.47466958",
"0.47340178",
"0.47336397",
"0.47124395",
"0.47120455",
"0.46930513",
"0.4691773",
"0... | 0.66611093 | 0 |
Syntax: (setq name value...) Syntax: (setf name value...) `name' is not eval'd | def func_setq(args)
p = args
p2 = nil
loop do
p1 = car(p)
p2 = _eval(car(cdr(p)))
@o_man.set_object(p1, p2)
p = cdr(cdr(p))
break unless (p != @o_man.nil)
end
return p2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setq(sym, expr)\n\t\tif expr.is_a?(String)\n\t\t\tif expr.match(/\\(list/)\t\n\t\t\t\tstr = \"(setq #{sym.to_s} #{expr.to_s})\" \n\t\t\telse\t\n\t\t\t\tstr = \"(setq #{sym.to_s} \\\"#{expr.to_s}\\\")\" \n\t\t\tend\t\n\t\t\tputs str\n\t\telse\n\t\t\tstr = \"(setq #{sym.to_s} #{expr.to_s})\" \n\t\t\tputs str\n\n... | [
"0.690037",
"0.57841706",
"0.57568055",
"0.5749876",
"0.5737015",
"0.5673337",
"0.56443495",
"0.56443495",
"0.5600668",
"0.5599788",
"0.5589148",
"0.55313545",
"0.55186045",
"0.5480182",
"0.54761577",
"0.5470533",
"0.54342234",
"0.54246193",
"0.54240125",
"0.5406393",
"0.5366... | 0.62442225 | 1 |
Public: Returns the String tag separator. | def tag_separator
@@separator || raise(TagSeparatorError)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def separator\n return @separator\n end",
"def sep; end",
"def sep; end",
"def extract_separator\n if meta_tags[:separator] == false\n # Special case: if separator is hidden, do not display suffix/prefix\n prefix = separator = suffix = \"\"\n else\n pr... | [
"0.72427803",
"0.6851132",
"0.6851132",
"0.6816906",
"0.6765777",
"0.6765777",
"0.6653996",
"0.6603907",
"0.64903975",
"0.6468968",
"0.63235444",
"0.6313648",
"0.6175129",
"0.60625756",
"0.6017458",
"0.5999291",
"0.5973228",
"0.59069943",
"0.58710456",
"0.58506256",
"0.579078... | 0.7495712 | 0 |
Private: provides the regexp used for scanning a tagful string. separator The String separator used for tag extraction. container The String container used for tag extraction. multiword A Boolean to indicate if multiple words tags are to be extracted. Returns a Regexp. | def get_regex(separator, container, multiword)
# We get the default separator & containers if none were specified
tag_separator = separator || TagExtractor::tag_separator
tag_container = container || TagExtractor::words_container
# Transforms the container string into an array like ['['... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tag_regex(tag)\n return Regexp.new(\"\\\\A\\\\{#{tag} /\\\\}\")\n end",
"def get_open_tag_regex(tag)\n return Regexp.new(\"\\\\A\\\\{#{tag}\\\\}\")\n end",
"def single_tag\n @single_tag_regex ||= tag_regexp\n end",
"def define_regexp\n # Default pattern if there is no tags specif... | [
"0.6269754",
"0.57896036",
"0.57854396",
"0.57444876",
"0.56810486",
"0.55525523",
"0.5535162",
"0.53430295",
"0.51990575",
"0.50581306",
"0.50178826",
"0.49441248",
"0.49304327",
"0.49299482",
"0.4723119",
"0.4723119",
"0.4717397",
"0.4692314",
"0.4688681",
"0.46782646",
"0.... | 0.84908015 | 0 |
Private: Remove tags container from a tag. t The tag, as a String. c the container, as a String. Returns the cleaned tag. | def remove_tags_container(t, c)
l, r = container_array(c)
t.gsub!(l, '')
t.gsub!(r, '')
t
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeTag(text,tag)\n return 0 unless text\n text=text.to_s\n text=text.gsub(\"<\"+tag+\">\", \"\")\n text=text.gsub(\"</\"+tag+\">\", \"\")\n \n return text.to_s\nend",
"def destroy_tag(*tags)\n tags.each do |tag|\n gsub! Regexp.new(\"<\\s*#{tag}[^>]*>.*?<\\s*\\/#{tag}\\s*>\", Regexp::IG... | [
"0.6244698",
"0.594488",
"0.5882951",
"0.58772784",
"0.5708439",
"0.5681947",
"0.5647498",
"0.5645629",
"0.55729795",
"0.5530865",
"0.55156094",
"0.5501618",
"0.54462355",
"0.5442768",
"0.53457713",
"0.5333861",
"0.5324582",
"0.5280328",
"0.52615714",
"0.5256913",
"0.52478343... | 0.8493978 | 0 |
Private: Transforms the container string into an array. c the container's String. Examples container_array '[]' => ['[',']'] Returns an Array of two strings. | def container_array(c)
c = c || TagExtractor::words_container
c = c.split ''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform_string_array(value)\n (value.is_a?(Array) ? value : [value]).map(&:to_s)\n end",
"def content_as_array\n begin\n # '[\"a\",\"b\", \"c\"]' -> '\"a\",\"b\",\"c\"'\n no_brackets = content[1...-1]\n\n # '\"a\",\"b\",\"c\"' -> ['\"a\"', '\"b\"', '\"c\"']\n quoted_eleme... | [
"0.67726916",
"0.63105917",
"0.6223851",
"0.62022626",
"0.61795765",
"0.60986567",
"0.60986567",
"0.5967733",
"0.5904043",
"0.58675176",
"0.5759204",
"0.57495606",
"0.573737",
"0.5723067",
"0.57145274",
"0.569073",
"0.5664142",
"0.5662161",
"0.5659551",
"0.565585",
"0.5644704... | 0.71916014 | 0 |
Public: Native String helper for TagExtractor::HTMLExtractorconvert_tags_to_html_links. See API for TagExtractor::HTMLExtractorconvert_tags_to_html_links Returns an HTML String. | def convert_tags_to_html_links(separator = nil, container = nil, opts = { multiword: true }, &block)
TagExtractor::HTMLExtractor.new(self).convert_tags_to_html_links(separator, container, opts, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag_links(tags)\n base_dir = @context.registers[:site].config['tag_dir']\n tags = tags.sort!.map do |tag|\n tag_dir = LinksHelper.join_path(base_dir, tag)\n # Make sure the tag directory begins with a slash.\n tag_dir = \"/#{tag_dir}\" unless tag_dir =~ /^\\//\n \"<a class... | [
"0.64165664",
"0.63516164",
"0.61377716",
"0.6075432",
"0.6062856",
"0.6062856",
"0.6062856",
"0.605426",
"0.605426",
"0.5979159",
"0.5937612",
"0.59069544",
"0.5883135",
"0.5845919",
"0.5820696",
"0.5808363",
"0.58064413",
"0.5798843",
"0.57897276",
"0.57813585",
"0.5775855"... | 0.68274003 | 0 |
MANAGING RATES AND SHIPMENTS API: GET /shipments?originalTransactionId API signature: get/shipments Retry a shipment that was previously submitted with no successful response. By default, the returned result would overwrite the current state of the object. To avoid overwriting, set the input argument overwrite to False... | def retry(auth_obj, txid, originalTxid, overwrite=true)
hdrs = { PBShipping::txid_attrname => txid }
params = {:originalTransactionId => originalTxid}
api_sig = "get/shipments"
api_version = PBShipping::get_api_version(api_sig)
api_path = "/shipments"
json_resp = PBShipping::api_requ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retry_consignment_note(company_id: nil, shipment_id: nil)\n nil\n end",
"def retry_job\n JobTransaction.create(:job_id => params[:id], :status_code => 1, :comments => \"Retry\", :modified_date => Time.now)\n end",
"def retry\n\t\tclient = GocardlessPro.new(self.customer.client.organisation)\n\t\tcl... | [
"0.59763134",
"0.57265896",
"0.5713081",
"0.56278056",
"0.561534",
"0.5470804",
"0.5461796",
"0.5429063",
"0.53866595",
"0.5358675",
"0.5349951",
"0.53076",
"0.5292589",
"0.51726556",
"0.51598203",
"0.51369923",
"0.5134007",
"0.5087056",
"0.508007",
"0.5079682",
"0.5079644",
... | 0.7592926 | 0 |
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIE... | def remove_bucket_conditional_iam_binding bucket_name:
# The ID of your GCS bucket
# bucket_name = "your-unique-bucket-name"
require "google/cloud/storage"
storage = Google::Cloud::Storage.new
bucket = storage.bucket bucket_name
role = "roles/storage.objectViewer"
title = "Title"
descrip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_bucket_iam_members bucket_name:\n # The ID of your GCS bucket\n # bucket_name = \"your-unique-bucket-name\"\n\n require \"google/cloud/storage\"\n\n storage = Google::Cloud::Storage.new\n bucket = storage.bucket bucket_name\n\n policy = bucket.policy requested_policy_version: 3\n policy.bindings.ea... | [
"0.6169119",
"0.57884127",
"0.545872",
"0.54117566",
"0.5378016",
"0.5373045",
"0.537153",
"0.532375",
"0.5301208",
"0.52859783",
"0.52859783",
"0.5277151",
"0.5276371",
"0.52656657",
"0.52560735",
"0.5240241",
"0.5209631",
"0.52021396",
"0.51763225",
"0.5161425",
"0.51419556... | 0.87333757 | 0 |
GET /route_types GET /route_types.json | def index
@route_types = RouteType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_types\n user = current_user\n if !params[:distance].nil? and params[:distance].to_i > 0\n distance = params[:distance].to_i\n else\n distance = 30\n end\n if !params[:latitude].blank? \n latitude = params[:latitude].to_f\n else\n latitude = user.la... | [
"0.65864825",
"0.65770876",
"0.64133275",
"0.6396846",
"0.63498765",
"0.6330232",
"0.6322615",
"0.62331796",
"0.61780125",
"0.6159511",
"0.61506075",
"0.6096282",
"0.6095815",
"0.60406756",
"0.5973282",
"0.595725",
"0.5957131",
"0.5946636",
"0.593951",
"0.5933294",
"0.5926537... | 0.7555528 | 0 |
POST /route_types POST /route_types.json | def create
@route_type = RouteType.new(route_type_params)
respond_to do |format|
if @route_type.save
format.html { redirect_to @route_type, notice: 'Route type was successfully created.' }
format.json { render action: 'show', status: :created, location: @route_type }
else
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route_type_params\n params.require(:route_type).permit(:name)\n end",
"def index\n @route_types = RouteType.all\n end",
"def post_route(route, message)\n raise TypeError unless route.is_a? Route\n @changeset = @api.create_changeset(message, tags={'created_by'=>'ITCR'})\n ways_list = []... | [
"0.67935246",
"0.6348369",
"0.60737926",
"0.60622483",
"0.6029223",
"0.5994516",
"0.5915448",
"0.5795102",
"0.5779305",
"0.5777996",
"0.56944597",
"0.5676542",
"0.5676542",
"0.5621734",
"0.5614551",
"0.5611831",
"0.5611831",
"0.5592738",
"0.5587378",
"0.5577868",
"0.55435723"... | 0.68561417 | 0 |
PATCH/PUT /route_types/1 PATCH/PUT /route_types/1.json | def update
respond_to do |format|
if @route_type.update(route_type_params)
format.html { redirect_to @route_type, notice: 'Route type was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @route... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_type\n\t\t\trender json: User.update_type_by_id(params[:id], params[:type], params[:is])\n\t\tend",
"def set_route_type\n @route_type = RouteType.find(params[:id])\n end",
"def update\n @type.update(type_params)\n end",
"def update\n @realty_type = RealtyType.find(params[:id])\n\n ... | [
"0.6240838",
"0.61699677",
"0.6077129",
"0.6042177",
"0.59995717",
"0.59995717",
"0.59995717",
"0.59976417",
"0.5992506",
"0.59747124",
"0.5963547",
"0.59561104",
"0.5952582",
"0.59386444",
"0.5918509",
"0.59142905",
"0.5908897",
"0.588292",
"0.58749396",
"0.5871249",
"0.5865... | 0.7319646 | 0 |
DELETE /route_types/1 DELETE /route_types/1.json | def destroy
@route_type.destroy
respond_to do |format|
format.html { redirect_to route_types_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @route.delete\n respond_to do |format|\n format.html { redirect_to routes_url, notice: t(\"routes.deleted\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n respond_to do |format|\n format.html { ... | [
"0.7256923",
"0.7040309",
"0.70247775",
"0.70247775",
"0.70247775",
"0.7011694",
"0.7011694",
"0.7011694",
"0.7011694",
"0.6923681",
"0.6920727",
"0.68972164",
"0.6885282",
"0.68702453",
"0.68637353",
"0.6848954",
"0.68385184",
"0.6834954",
"0.682367",
"0.68096876",
"0.678198... | 0.80162305 | 0 |
Enumerates keys starting with +key+. | def each_key(prefix)
after = nil
keys, after = list_keys prefix
until keys.nil? or keys.empty? do
keys.each { |k| yield k }
keys, after = list_keys prefix, after
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_key\n @keys.values.each do |k|\n yield k\n end\n end",
"def possible_keys(key); end",
"def each_key(&block)\n keys.each(&block)\n end",
"def each_key\n\t record = @head\r\n\t while record.next && record.next != @tail\r\n\t\t record = record.next\n\t\t yield record... | [
"0.66230834",
"0.65595853",
"0.64789146",
"0.6453514",
"0.645261",
"0.64394546",
"0.63881576",
"0.61805475",
"0.61805475",
"0.6066799",
"0.60231155",
"0.5971133",
"0.5971133",
"0.5957276",
"0.591905",
"0.5891217",
"0.58825684",
"0.579633",
"0.579633",
"0.5794461",
"0.57848644... | 0.6691295 | 0 |
Get the paths for +key+. | def get_paths(key, noverify = true, zone = nil)
opts = { :domain => @domain, :key => key,
:noverify => noverify ? 1 : 0, :zone => zone }
@backend.respond_to?(:_get_paths) and return @backend._get_paths(opts)
res = @backend.get_paths(opts)
(1..res['paths'].to_i).map { |i| res["path#{i}"] }.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all(key)\n configuration.hpath(key)\n end",
"def keys\n return full_path.to_s.split('.') if full_path\n return [key.to_s] unless path&.present?\n\n [path, key].compact.join('.').split('.')\n end",
"def path\n # Because @key becomes nil at ListValidator, I remove it from p... | [
"0.75829065",
"0.71318215",
"0.6717001",
"0.6532342",
"0.6403134",
"0.6382913",
"0.6382913",
"0.62962836",
"0.6281895",
"0.6271389",
"0.6222386",
"0.62046355",
"0.6175001",
"0.6157857",
"0.6099689",
"0.6071993",
"0.60701555",
"0.60016847",
"0.5988231",
"0.59866273",
"0.598472... | 0.7375991 | 1 |
Creates a new file +key+ in +klass+. +bytes+ is currently unused. The +block+ operates like File.open. | def new_file(key, klass = nil, bytes = 0, &block) # :yields: file
raise MogileFS::ReadOnlyError if readonly?
opts = { :domain => @domain, :key => key, :multi_dest => 1 }
opts[:class] = klass if klass
res = @backend.create_open(opts)
dests = if dev_count = res['dev_count'] # multi_dest succeeded
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_file(key, klass, file)\n raise MogileFS::ReadOnlyError if readonly?\n\n new_file key, klass do |mfp|\n if file.respond_to? :sysread then\n return sysrwloop(file, mfp)\n else\n\tif File.size(file) > 0x10000 # Bigass file, handle differently\n\t mfp.big_io = file\n\t return\n\telse... | [
"0.6287475",
"0.57504356",
"0.56305903",
"0.5403281",
"0.5303005",
"0.51630616",
"0.51192534",
"0.5104515",
"0.50837475",
"0.5035621",
"0.5026723",
"0.49657246",
"0.49543053",
"0.49438915",
"0.49303734",
"0.49156997",
"0.4902605",
"0.48359057",
"0.48240766",
"0.48077625",
"0.... | 0.70022696 | 0 |
Copies the contents of +file+ into +key+ in class +klass+. +file+ can be either a file name or an object that responds to read. | def store_file(key, klass, file)
raise MogileFS::ReadOnlyError if readonly?
new_file key, klass do |mfp|
if file.respond_to? :sysread then
return sysrwloop(file, mfp)
else
if File.size(file) > 0x10000 # Bigass file, handle differently
mfp.big_io = file
return
else
return F... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(key, filename, content)\n @key = key\n @filename = filename\n @content = content\n end",
"def load_file(file)\n klasses = ObjectSpace.classes.dup\n load file\n LOADED_CLASSES[file] = ObjectSpace.classes - klasses\n MTIMES[file] = File.mtime(file)\n en... | [
"0.58273363",
"0.5723826",
"0.57186943",
"0.56617737",
"0.56074226",
"0.55116373",
"0.5451376",
"0.5392195",
"0.53557235",
"0.53392327",
"0.5296627",
"0.5224869",
"0.5207683",
"0.5207683",
"0.52068835",
"0.5193821",
"0.5176149",
"0.5142905",
"0.50871325",
"0.5083826",
"0.5070... | 0.65352446 | 0 |
Stores +content+ into +key+ in class +klass+. | def store_content(key, klass, content)
raise MogileFS::ReadOnlyError if readonly?
new_file key, klass do |mfp|
if content.is_a?(MogileFS::Util::StoreContent)
mfp.streaming_io = content
else
mfp << content
end
end
content.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(key, value)\n @content[key] = value\n end",
"def set(key, value)\n @content[key] = value\n end",
"def write(key, content)\n set(key.to_s, content.to_json)\n end",
"def storeSerialised( handle, key, klass )\n s = Marshal.dump( klass )\n handle[ key ] = s;\ne... | [
"0.651384",
"0.64900595",
"0.6303242",
"0.6223314",
"0.61364585",
"0.6083157",
"0.607519",
"0.6034932",
"0.600043",
"0.5824358",
"0.57328486",
"0.5731575",
"0.5731575",
"0.57280815",
"0.56793493",
"0.5655784",
"0.5618766",
"0.5611468",
"0.559758",
"0.55711776",
"0.556569",
... | 0.6635726 | 0 |
Renames a key +from+ to key +to+. | def rename(from, to)
raise MogileFS::ReadOnlyError if readonly?
@backend.rename :domain => @domain, :from_key => from, :to_key => to
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rename(to, options = {})\n self.class.rename(key, to, bucket.name, options)\n end",
"def rename(from, to)\n write(read(from))\n end",
"def rename(from_path, to_path)\n ::File.rename(abspath(from_path), abspath(to_path))\n entry_path(to_path)\n end",
"def r... | [
"0.6967314",
"0.69080544",
"0.66440505",
"0.645032",
"0.6329139",
"0.63276213",
"0.63049334",
"0.616274",
"0.6117266",
"0.61112267",
"0.60298586",
"0.5988242",
"0.5951138",
"0.5897098",
"0.58827233",
"0.5866046",
"0.5825175",
"0.5814617",
"0.5732452",
"0.5721283",
"0.5708838"... | 0.7575325 | 0 |
Lists keys starting with +prefix+ follwing +after+ up to +limit+. If +after+ is nil the list starts at the beginning. | def list_keys(prefix, after = nil, limit = 1000, &block)
if @backend.respond_to?(:_list_keys)
return @backend._list_keys(domain, prefix, after, limit, &block)
end
res = begin
@backend.list_keys(:domain => domain, :prefix => prefix,
:after => after, :limit => limit)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _list_keys(domain, prefix = '', after = '', limit = 1000, &block)\n # this code is based on server/lib/MogileFS/Worker/Query.pm\n dmid = get_dmid(domain)\n\n # don't modify passed arguments\n limit ||= 1000\n limit = limit.to_i\n limit = 1000 if limit > 1000 || limit <= 0\n after, prefix =... | [
"0.74787086",
"0.5734372",
"0.55891174",
"0.50921905",
"0.5089069",
"0.5053092",
"0.49900162",
"0.49735284",
"0.49197993",
"0.48679146",
"0.48572206",
"0.4844643",
"0.4838422",
"0.48183203",
"0.48183203",
"0.48090404",
"0.47978675",
"0.4794709",
"0.47879592",
"0.4730818",
"0.... | 0.7918597 | 0 |
given a URI, this returns a readable socket with ready data from the body of the response. | def http_read_sock(uri, http_method = "GET")
sock = Socket.mogilefs_new_request(uri.host, uri.port,
"#{http_method} #{uri.request_uri} HTTP/1.0\r\n\r\n",
@get_file_data_timeout)
buf = sock.recv_nonblock(4096, Socket::MSG_PEEK)
head, body = buf.split(/\r\n\r\n/, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(uri, opts = {}, &block)\n initialize_socket(uri, opts)\n HttpStream::get(uri, opts, &block)\n rescue IOError => e\n raise e unless @intentional_termination\n end",
"def obtain_socket(uri)\n socket = TCPSocket.new(uri.host, uri.port || socket_port(uri))\n\n if secure_uri?(ur... | [
"0.63340366",
"0.60863984",
"0.60203695",
"0.6017839",
"0.5986584",
"0.58593243",
"0.5836849",
"0.57314116",
"0.5725741",
"0.5689698",
"0.5663488",
"0.56323045",
"0.56217146",
"0.55733263",
"0.5563246",
"0.5557537",
"0.55480427",
"0.5542377",
"0.5532711",
"0.5529855",
"0.5513... | 0.63918334 | 0 |
PUT /testcases/1 PUT /testcases/1.json | def update
@testcase = Testcase.find(params[:id])
respond_to do |format|
if @testcase.update_attributes(params[:testcase])
format.html { redirect_to @testcase, :notice => 'Test was successfully updated.' }
format.json { head :no_content }
else
format.html { render :action =>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{conte... | [
"0.6848109",
"0.6630957",
"0.6585738",
"0.65286785",
"0.6486647",
"0.6482463",
"0.63608646",
"0.6345679",
"0.6345675",
"0.63435286",
"0.6320938",
"0.63081586",
"0.6288897",
"0.61587024",
"0.6119726",
"0.61073107",
"0.6093803",
"0.6081904",
"0.60817426",
"0.6066283",
"0.606248... | 0.6838469 | 1 |
DELETE /testcases/1 DELETE /testcases/1.json | def destroy
@testcase = Testcase.find(params[:id])
@testcase.destroy
respond_to do |format|
format.html { redirect_to testcases_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @test_case.destroy\n respond_to do |format|\n format.html { redirect_to test_cases_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTE... | [
"0.76045567",
"0.7378888",
"0.7306705",
"0.72656447",
"0.72366494",
"0.72366494",
"0.7208239",
"0.71768177",
"0.7133372",
"0.7084047",
"0.7082916",
"0.70773196",
"0.7065023",
"0.7063305",
"0.7061007",
"0.7058521",
"0.70364714",
"0.7031288",
"0.70249814",
"0.69981575",
"0.6998... | 0.7586286 | 1 |
str outputs: str reqs: find the highest scoring word in a str add value of each char in the word based on char position in the alphabet find the max value for the words rtn the word with max value rules: letter score is based on position in alphabet a == 1, b == 2, ... struct: arr algo: create an arr of alpha_chars ini... | def alphabet_score(str)
alpha_chars = ('a'..'z').to_a
max_score = 0
max_word = ''
arr = str.split(' ')
arr.each do |word|
word_score = word.chars.map { |char| alpha_chars.index(char) + 1 }.sum
if word_score > max_score
max_score = word_score
max_word = word
end
end
max_word
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def high(string)\n letter_scores = ('a'..'z').zip(1..26).to_h\n words = string.split\n\n word_scores = words.map do |word|\n score = 0\n word.chars.each { |char| score += letter_scores[char]}\n score \n end\n words[word_scores.index(word_scores.max)]\nend",
"def high(string)\n letter_scores = ('... | [
"0.7867902",
"0.7828036",
"0.76885957",
"0.7656196",
"0.7638611",
"0.74156857",
"0.73803043",
"0.70692295",
"0.70551056",
"0.69510996",
"0.69488233",
"0.6782218",
"0.6762207",
"0.67419344",
"0.6714261",
"0.6688521",
"0.6677016",
"0.66712856",
"0.66623765",
"0.66578436",
"0.66... | 0.78349257 | 1 |
GET /material_item_names GET /material_item_names.json | def index
@material_item_names = MaterialItemName.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item_names\n items = []\n Static.get_item_list.values.each do |f|\n items << f[\"name\"]\n end\n items\n end",
"def index\n @magic_item_names = MagicItemName.all\n end",
"def name_list\n begin\n @products = Product.pluck(:name)\n render json: { names: @products ... | [
"0.687595",
"0.66698647",
"0.66658574",
"0.6532098",
"0.63806725",
"0.63148504",
"0.6197086",
"0.6189616",
"0.618035",
"0.6149137",
"0.60975087",
"0.60868365",
"0.60770285",
"0.59868455",
"0.59868455",
"0.5948775",
"0.5921684",
"0.5897711",
"0.5839966",
"0.5805795",
"0.580210... | 0.7841525 | 0 |
POST /material_item_names POST /material_item_names.json | def create
@material_item_name = MaterialItemName.new(material_item_name_params)
respond_to do |format|
if @material_item_name.save
format.html { redirect_to @material_item_name, notice: 'Material item name was successfully created.' }
format.json { render :show, status: :created, locatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def material_item_name_params\n params.require(:material_item_name).permit(:material_item_id, :name, :name_type_id)\n end",
"def index\n @material_item_names = MaterialItemName.all\n end",
"def set_material_item_name\n @material_item_name = MaterialItemName.find(params[:id])\n end",
"def ... | [
"0.72709966",
"0.68706137",
"0.63915527",
"0.6365043",
"0.62611395",
"0.6239886",
"0.59498686",
"0.5869827",
"0.5862007",
"0.58034784",
"0.5774383",
"0.5753995",
"0.5752605",
"0.57518995",
"0.5736693",
"0.5709809",
"0.566829",
"0.5658684",
"0.56236255",
"0.56198525",
"0.56065... | 0.6951723 | 1 |
PATCH/PUT /material_item_names/1 PATCH/PUT /material_item_names/1.json | def update
respond_to do |format|
if @material_item_name.update(material_item_name_params)
format.html { redirect_to @material_item_name, notice: 'Material item name was successfully updated.' }
format.json { render :show, status: :ok, location: @material_item_name }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @magic_item_name.update(magic_item_name_params)\n format.html { redirect_to @magic_item_name, notice: 'Magic item name was successfully updated.' }\n format.json { render :show, status: :ok, location: @magic_item_name }\n else\n format.html... | [
"0.7074514",
"0.6814977",
"0.6687372",
"0.66737586",
"0.66728896",
"0.653025",
"0.6507784",
"0.64963526",
"0.64664614",
"0.6438749",
"0.6416824",
"0.631356",
"0.62072587",
"0.61535066",
"0.6148063",
"0.6132106",
"0.60576284",
"0.60552734",
"0.60448796",
"0.60405195",
"0.60320... | 0.75116694 | 0 |
DELETE /material_item_names/1 DELETE /material_item_names/1.json | def destroy
@material_item_name.destroy
respond_to do |format|
format.html { redirect_to material_item_names_url, notice: 'Material item name was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @itemname = Itemname.find(params[:id])\n @itemname.destroy\n\n respond_to do |format|\n format.html { redirect_to itemnames_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @magic_item_name.destroy\n respond_to do |format|\n format.html { redir... | [
"0.74102527",
"0.7193729",
"0.7008444",
"0.6998669",
"0.69935197",
"0.6851897",
"0.6754438",
"0.6729833",
"0.66992784",
"0.66888267",
"0.6680751",
"0.6664368",
"0.6663428",
"0.66483706",
"0.6627083",
"0.6623341",
"0.6585599",
"0.65831137",
"0.65541756",
"0.6529275",
"0.652614... | 0.7613816 | 0 |
GET /ship_fittings GET /ship_fittings.json | def index
@ship_fittings = ShipFitting.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_ship_fitting\n @ship_fitting = ShipFitting.find(params[:id])\n end",
"def ship_fitting_params\n params.require(:ship_fitting).permit(:name, :description, :cost, :power, :mass, :min_hull_class, :max_hull_class, :tech_level, :notes, :gm_notes)\n end",
"def create\n @ship_fitting = Ship... | [
"0.72675055",
"0.67166686",
"0.65661645",
"0.6537064",
"0.60192275",
"0.5991168",
"0.5937412",
"0.5848879",
"0.5804927",
"0.5804361",
"0.57251364",
"0.57184976",
"0.5649804",
"0.56468636",
"0.56468636",
"0.56193554",
"0.55711925",
"0.55435914",
"0.5543378",
"0.55146176",
"0.5... | 0.7659877 | 0 |
POST /ship_fittings POST /ship_fittings.json | def create
@ship_fitting = ShipFitting.new(ship_fitting_params)
respond_to do |format|
if @ship_fitting.save
format.html { redirect_to @ship_fitting, notice: 'Ship fitting was successfully created.' }
format.json { render :show, status: :created, location: @ship_fitting }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ship_fitting_params\n params.require(:ship_fitting).permit(:name, :description, :cost, :power, :mass, :min_hull_class, :max_hull_class, :tech_level, :notes, :gm_notes)\n end",
"def set_ship_fitting\n @ship_fitting = ShipFitting.find(params[:id])\n end",
"def update\n respond_to do |forma... | [
"0.7489352",
"0.6971595",
"0.6583745",
"0.64541835",
"0.6075398",
"0.6063108",
"0.6048937",
"0.60460246",
"0.59847754",
"0.59756577",
"0.5975343",
"0.5946229",
"0.5911731",
"0.5904444",
"0.5886837",
"0.5868542",
"0.5861755",
"0.5795279",
"0.57779986",
"0.57742083",
"0.5773662... | 0.75240713 | 0 |
PATCH/PUT /ship_fittings/1 PATCH/PUT /ship_fittings/1.json | def update
respond_to do |format|
if @ship_fitting.update(ship_fitting_params)
format.html { redirect_to @ship_fitting, notice: 'Ship fitting was successfully updated.' }
format.json { render :show, status: :ok, location: @ship_fitting }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_ship_fitting\n @ship_fitting = ShipFitting.find(params[:id])\n end",
"def ship_fitting_params\n params.require(:ship_fitting).permit(:name, :description, :cost, :power, :mass, :min_hull_class, :max_hull_class, :tech_level, :notes, :gm_notes)\n end",
"def update\n respond_to do |forma... | [
"0.699603",
"0.6630378",
"0.6540532",
"0.6433229",
"0.6385158",
"0.6363659",
"0.63128394",
"0.62841505",
"0.6237662",
"0.61397034",
"0.61185515",
"0.60427207",
"0.602343",
"0.60157746",
"0.5979202",
"0.59663266",
"0.5965244",
"0.5955053",
"0.5952123",
"0.5952123",
"0.59447044... | 0.7666931 | 0 |
DELETE /ship_fittings/1 DELETE /ship_fittings/1.json | def destroy
@ship_fitting.destroy
respond_to do |format|
format.html { redirect_to ship_fittings_url, notice: 'Ship fitting was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @shipfleet.destroy\n respond_to do |format|\n format.html { redirect_to shipfleets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to ships_url ... | [
"0.69764173",
"0.67851955",
"0.6742548",
"0.6741261",
"0.6720306",
"0.67168295",
"0.67091095",
"0.6690475",
"0.66573143",
"0.66565454",
"0.66565454",
"0.65972376",
"0.65938145",
"0.6568072",
"0.6561756",
"0.65226746",
"0.6497743",
"0.642263",
"0.64218307",
"0.6415678",
"0.640... | 0.7754245 | 0 |
Add a new pipeline with the given inputs to the project. | def input(*inputs, &block)
# Allow pipelines without a specified block. This is possible
# if before and after filters are all that are needed for a
# given input.
block = proc {} unless block_given?
project.build_pipeline(*inputs, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input(*inputs, &block)\n project.build_pipeline(*inputs, &block)\n end",
"def add_pipeline(m, *args)\n raise IOError.new(\"pipelining not enabled\") unless @in_pipeline\n return add_sync_pipeline(m, *args) if @synchronous_pipeline\n\n input = (@active_pipelines.empty? ? $stdin : @act... | [
"0.7549028",
"0.69694346",
"0.608884",
"0.5905596",
"0.5780478",
"0.5755706",
"0.57537025",
"0.5717917",
"0.57077146",
"0.5660139",
"0.5588958",
"0.558722",
"0.55003715",
"0.545791",
"0.5397583",
"0.5281368",
"0.5262451",
"0.5186991",
"0.5164742",
"0.51126003",
"0.511049",
... | 0.7245974 | 1 |
Returns all the subdomains as an array, so ["dev", "www"] would be returned for "dev. You can specify a different tld_length, such as 2 to catch ["www"] instead of ["www", "mackframework"] in " Thanks Ruby on Rails for this. | def subdomains(tld_length = 1)
return [] unless named_host?(host)
parts = host.split('.')
parts[0..-(tld_length+2)]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subdomains(tld_length = T.unsafe(nil)); end",
"def subdomains(tld_length = 1) \n parts = host.split('.')\n parts[0..-(tld_length+2)]\n end",
"def extract_subdomains(host, tld_length); end",
"def subdomains(tld_length = 1)\n parts = host.split('.')\n parts - parts.last(1 + tld_length)\n ... | [
"0.8158473",
"0.8149889",
"0.8065619",
"0.805973",
"0.7271407",
"0.69576967",
"0.6762226",
"0.67448485",
"0.66103303",
"0.6560398",
"0.6540514",
"0.65313244",
"0.65125513",
"0.65036166",
"0.6474532",
"0.64614075",
"0.6394439",
"0.63862574",
"0.63792276",
"0.6347623",
"0.63254... | 0.8328805 | 0 |
get wiki images for a project | def wiki_images(project, on_page = nil)
opts = {}
opts[:page] = on_page if on_page
fetch_all("projects/#{project}/features/wiki/images", 'images', opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def images_for_project\n project = find_or_goto_index(Project, params[:id].to_s)\n return unless project\n\n query = create_query(:Image, :for_project, project: project)\n show_selected_images(query, always_index: 1)\n end",
"def images_for_project\n if project = find_or_goto_index(Project, param... | [
"0.7206328",
"0.70834273",
"0.6834761",
"0.6571698",
"0.65380913",
"0.6509472",
"0.649205",
"0.6491991",
"0.6431398",
"0.6417501",
"0.6373889",
"0.63629216",
"0.63596016",
"0.6322625",
"0.63101447",
"0.6279837",
"0.62749904",
"0.62640774",
"0.6182574",
"0.61821896",
"0.617170... | 0.81231445 | 0 |
get the wiki raw image data for an image | def wiki_image_data(image)
RestClient.get(image['image_url'], :accept => image['image_content_type'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contents\n image.contents[image_offset, size]\n end",
"def contents\n image.contents[image_offset, size]\n end",
"def picdata\n object.imgdata\n end",
"def image_data\n return @image_data if defined? @image_data\n @image_data = HTTParty.get(image_url).body rescue nil\n en... | [
"0.7020813",
"0.7020813",
"0.7000009",
"0.69630617",
"0.67776555",
"0.6766321",
"0.6737883",
"0.6684183",
"0.66121376",
"0.65968513",
"0.65440553",
"0.64609605",
"0.64177626",
"0.6409144",
"0.6375386",
"0.6348872",
"0.6267806",
"0.62613386",
"0.62531185",
"0.62135595",
"0.620... | 0.821057 | 0 |
get wiki pages for a project | def wiki_pages(project, on_page = nil)
opts = {}
opts[:page] = on_page if on_page
fetch_all("projects/#{project}/features/wiki/pages", 'pages', opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_wiki_pages\n results = WikiPage.joins(wiki: :project)\n .where(\"CONCAT_WS(':', `projects`.`name`, `wiki_pages`.`title`) LIKE ? \", \"%#{params[:term]}%\")\n .select('projects.name, wiki_pages.title')\n .limit(10)\n\n render :json => results.map { |x|... | [
"0.7412103",
"0.73503",
"0.6923134",
"0.6724201",
"0.66003317",
"0.6585496",
"0.65726465",
"0.6536777",
"0.6430522",
"0.6430522",
"0.64285326",
"0.64239913",
"0.6295219",
"0.6269554",
"0.6255695",
"0.6238918",
"0.6231687",
"0.62119526",
"0.6202594",
"0.61837196",
"0.6169987",... | 0.7960471 | 0 |
edit a single wiki page yields the current page contents, and saves them back if the result of the block is different | def edit_wiki_page(proj_name, page_name)
# fetch current page contents
page = wiki_page_client(proj_name, page_name)
begin
page_data = JSON.parse(page.get)
current_src = page_data['text']
rescue RestClient::ResourceNotFound
page_data = {}
current_src = ''
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n @page = @wiki.find_or_new_page(params[:page]) \n @page.content = WikiContent.new(:page => @page) if @page.new_record?\n \n @content = @page.content_for_version(params[:version])\n @content.text = \"h1. #{@page.pretty_title}\" if @content.text.blank?\n # don't keep previous comment\n... | [
"0.75389653",
"0.72111994",
"0.6911351",
"0.68874866",
"0.6736836",
"0.6648428",
"0.65506977",
"0.6510322",
"0.64046663",
"0.63980395",
"0.63283783",
"0.63189965",
"0.63147366",
"0.6298091",
"0.6268508",
"0.62577665",
"0.6256875",
"0.6216407",
"0.61795044",
"0.6175297",
"0.61... | 0.78230006 | 0 |
Returns the phone number in the E164 standardized format, e.g.: "+15105551234" | def standardized_phone_number
Phonelib.parse(phone_number, "US").e164
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_phone_number_e164(phone)\n Phonelib.parse(phone).e164\n end",
"def phone_number\n '+18773289677'\n end",
"def phone_number\n '+18009977777'\n end",
"def formatted_phone_number\n Phonelib.parse(phone_number).local_number\n end",
"def formatted_phone_number\n Phonelib.parse(phon... | [
"0.8227386",
"0.7714799",
"0.7660336",
"0.73783886",
"0.73783886",
"0.73783886",
"0.72025484",
"0.7187268",
"0.7117702",
"0.7026102",
"0.6991275",
"0.69020766",
"0.6881997",
"0.6844438",
"0.68433994",
"0.6789595",
"0.6785559",
"0.6755071",
"0.6689773",
"0.66896623",
"0.668869... | 0.82774335 | 1 |
Tests whether a given holdings for a broad location has notes to show | def holdings_location_has_notes?(holdings_loc)
return false if holdings_loc.nil? || holdings_loc.empty?
holdings_loc.any? do |_loc_n, item_data|
items_have_notes?(item_data['items'])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def may_note?\n false\n end",
"def multiple_locations?(holdings)\n locations = holdings.reject { |_k, h| h['library'] == 'Online' }.map { |_k, h| h['location'] }.uniq\n locations.length > 1\n end",
"def additional_holdings_location_notes(document, location)\n location_notes = []\n\n ... | [
"0.62232345",
"0.621975",
"0.61920524",
"0.6184791",
"0.61758804",
"0.61758804",
"0.60551745",
"0.6034573",
"0.5990162",
"0.59566844",
"0.5884269",
"0.58312494",
"0.5830184",
"0.5828082",
"0.57953966",
"0.57671124",
"0.57649624",
"0.5740405",
"0.5693778",
"0.56918895",
"0.567... | 0.78165615 | 0 |
tests whether there are notes for any of the items in an array | def items_have_notes?(items)
return false if items.nil? || items.empty?
items.any? { |i| !i.fetch('notes', '').empty? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty?\n notes.empty?\n end",
"def appropriate\n notes.map(&:class).uniq.size >= @chord.notes.size\n end",
"def holdings_location_has_notes?(holdings_loc)\n return false if holdings_loc.nil? || holdings_loc.empty?\n holdings_loc.any? do |_loc_n, item_data|\n items... | [
"0.65214324",
"0.6362448",
"0.6234079",
"0.6202038",
"0.6008418",
"0.59347105",
"0.5856205",
"0.5846581",
"0.5812223",
"0.57880455",
"0.5778876",
"0.57648486",
"0.57407105",
"0.57318515",
"0.57318383",
"0.5730036",
"0.5729294",
"0.5715291",
"0.57085",
"0.5703236",
"0.5701746"... | 0.78885204 | 0 |
Deserialize Ansible Galaxy installation metadata for a role | def galaxy_install_info(role_name)
role_path = File.join("deployment", "ansible", "roles", role_name)
galaxy_install_info = File.join(role_path, "meta", ".galaxy_install_info")
if (File.directory?(role_path) || File.symlink?(role_path)) && File.exists?(galaxy_install_info)
YAML.load_file(galaxy_install_info)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_role_attrs role:\n {\n role_name: role['metadata']['name'],\n version: role['metadata']['resourceVersion'],\n created_at: role['metadata']['creationTimestamp'],\n is_default: role['metadata'].try(:[], 'labels')... | [
"0.58374363",
"0.54046524",
"0.52997166",
"0.5177106",
"0.51464075",
"0.5101217",
"0.5095951",
"0.5086803",
"0.50796336",
"0.50460654",
"0.5034637",
"0.5000244",
"0.4985647",
"0.498041",
"0.49783203",
"0.4970884",
"0.4960613",
"0.49557257",
"0.4953488",
"0.4948193",
"0.491875... | 0.7456403 | 0 |
Uses the contents of roles.txt to ensure that ansiblegalaxy is run if any dependencies are missing | def install_dependent_roles
ansible_directory = File.join("deployment", "ansible")
ansible_roles_txt = File.join(ansible_directory, "roles.txt")
File.foreach(ansible_roles_txt) do |line|
role_name, role_version = line.split(",")
role_path = File.join(ansible_directory, "roles", role_name)
galaxy_meta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ansible_galaxy(local)\n venv = File.join local, '..', 'venv'\n roles = File.join local, '..', 'roles'\n file = File.join local, '..', 'galaxy-roles.txt'\n `#{venv}/bin/ansible-galaxy install -r #{file} -p #{roles}`\nend",
"def isAnsibleRole?(path)\n begin\n Dir.foreach(path) { |entry|\n ... | [
"0.70500857",
"0.6358526",
"0.6283592",
"0.6274069",
"0.6151699",
"0.61466676",
"0.60730493",
"0.6023956",
"0.5998603",
"0.57801163",
"0.5733976",
"0.5724132",
"0.5709162",
"0.57045066",
"0.56616455",
"0.5659612",
"0.5547738",
"0.552983",
"0.5521111",
"0.5509593",
"0.5487871"... | 0.8119926 | 0 |
returns an array of strings representing available mime types in the array of mime parts. | def mime_types
[].tap do |result|
@parts.each do |part|
result << part.content_type
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mime_types\n safe_const_get(:MIME_TYPES) || []\n end",
"def selected_mime_types\n return [] if mime_types.blank?\n\n mime_types.split(',')\n end",
"def mime\n mimes = []\n self.class.ancestors.each do |parent|\n if parent.const_defined? 'MIMES'\n parent.const_get('M... | [
"0.8085397",
"0.7841016",
"0.7468796",
"0.73161465",
"0.71879953",
"0.71341085",
"0.700919",
"0.69883066",
"0.6954226",
"0.6900459",
"0.6899505",
"0.67408395",
"0.6435777",
"0.6391359",
"0.63664347",
"0.6365813",
"0.63466275",
"0.6332496",
"0.6324582",
"0.63071734",
"0.622936... | 0.8856349 | 0 |
GET /program_relationships GET /program_relationships.json | def index
@program_relationships = ProgramRelationship.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def program_related_list(program, relationship, title)\n related = program.send(\"#{relationship}_programs\")\n logger.debug(\"---------- program #{program.name} relationship #{relationship} related #{related.count} ----------\")\n program_list = related.map do |related|\n (related.program_kind.eql? ... | [
"0.65970993",
"0.63197803",
"0.63012373",
"0.6298858",
"0.6263766",
"0.62197715",
"0.6123369",
"0.6105705",
"0.59501654",
"0.5897461",
"0.5843647",
"0.58032346",
"0.5707473",
"0.5707473",
"0.5684215",
"0.55589515",
"0.5550921",
"0.55411434",
"0.55318594",
"0.54955286",
"0.549... | 0.75911885 | 0 |
POST /program_relationships POST /program_relationships.json | def create
puts('Relationships: ' + program_relationship_params)
@program_relationship = ProgramRelationship.new(program_relationship_params)
respond_to do |format|
if @program_relationship.save
format.html { redirect_to @program_relationship, notice: 'Program relationship was successfully cr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def program_relationship_params\n params.require(:program_relationship).permit(:parent_id, :child_id)\n end",
"def index\n @program_relationships = ProgramRelationship.all\n end",
"def set_program_relationship\n @program_relationship = ProgramRelationship.find(params[:id])\n end",
"def ge... | [
"0.6585259",
"0.64520067",
"0.6378535",
"0.5912248",
"0.5882382",
"0.58812743",
"0.583791",
"0.5722715",
"0.5713742",
"0.5630059",
"0.55706865",
"0.5568484",
"0.55659986",
"0.5518101",
"0.54706216",
"0.5446229",
"0.54390305",
"0.5427671",
"0.5423249",
"0.54129905",
"0.5412736... | 0.7423939 | 0 |
PATCH/PUT /program_relationships/1 PATCH/PUT /program_relationships/1.json | def update
respond_to do |format|
if @program_relationship.update(program_relationship_params)
format.html { redirect_to @program_relationship, notice: 'Program relationship was successfully updated.' }
format.json { render :show, status: :ok, location: @program_relationship }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_program_relationship\n @program_relationship = ProgramRelationship.find(params[:id])\n end",
"def update\n relationship = Relationships.find(params[:id])\n if relationship.update(relationship_params)\n render json: relationship, status: 200\n else\n render json: { errors: relat... | [
"0.6635274",
"0.6463224",
"0.63553154",
"0.6214691",
"0.6212586",
"0.6187341",
"0.6180614",
"0.61005706",
"0.6096216",
"0.60557634",
"0.60503024",
"0.59886265",
"0.595488",
"0.59460455",
"0.59460455",
"0.5923233",
"0.5870643",
"0.5833206",
"0.5828799",
"0.5828799",
"0.5828799... | 0.71515626 | 0 |
DELETE /program_relationships/1 DELETE /program_relationships/1.json | def destroy
@program_relationship.destroy
respond_to do |format|
format.html { redirect_to program_relationships_url, notice: 'Program relationship was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end",
"def destroy\n @interaction_program = InteractionProgram.find(params[:id])\n @interaction_program.destroy\n\n respond_to do |format|\n format.html { redirect_to interaction_record_path }... | [
"0.6922076",
"0.68059987",
"0.6762018",
"0.67050624",
"0.65701187",
"0.65701187",
"0.65391606",
"0.65007347",
"0.6463749",
"0.6462072",
"0.6449839",
"0.64426124",
"0.6441266",
"0.6396112",
"0.638324",
"0.63811785",
"0.63807684",
"0.6375242",
"0.6371076",
"0.6371076",
"0.63339... | 0.7405108 | 0 |
Toggles whether this entity receives the tick event. This is only meaningful if a :tick actionhandler is defined. | def tick flag
return unless self.class.method_defined? :on_tick
@is_ticking = self.class.method_defined?(:old_on_tick) unless instance_variable_defined?(:@is_ticking)
return if @is_ticking == flag
@is_ticking = flag
if flag
alias_method :on_tick, :old_on_tick
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tick event\n raise NotImplementedError, \"Subclass responsibility to implement #tick\"\n end",
"def toggle\n fire\n end",
"def notify_when_off_sick=(arg)\n @notify_when_off_sick = (arg ? true : false)\n end",
"def need_tick_tock?\n if @minute == 60\n @minute = 0\n tick_to... | [
"0.6088219",
"0.59592074",
"0.5910011",
"0.5694822",
"0.55928147",
"0.5463733",
"0.53942955",
"0.5391616",
"0.5367387",
"0.5355378",
"0.53338575",
"0.5237857",
"0.5212896",
"0.51643825",
"0.5147576",
"0.5142991",
"0.50773734",
"0.50717485",
"0.50645506",
"0.5064387",
"0.50598... | 0.7605375 | 0 |
For simplicity, initial implementation returns repo ID's only from toplevel (i.e., not nested) contents. This is done since we have not clarified what an _ordered_ list of repo ID's should look like if structure contains nested contents. | def structure_repo_ids
default_struct_map['contents'].map { |content| content['contents'].map { |content| content['repo_id'] } }.flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repo_elements\n elements = @url.gsub('https://github.com/', '').split('/').compact.map(&:strip)\n end",
"def all\n return @raw_repos unless @raw_repos.empty?\n return [Template.root.basename.to_s] if Template.project?\n Template.root.join(Meta.new({}).repos_dir).children.map do |path... | [
"0.5905317",
"0.56957257",
"0.5667572",
"0.5664988",
"0.5620589",
"0.5596998",
"0.5566368",
"0.5552688",
"0.5542149",
"0.5501065",
"0.54480505",
"0.5437931",
"0.54077977",
"0.54065055",
"0.5397029",
"0.5387195",
"0.53679764",
"0.5365933",
"0.5354803",
"0.5331647",
"0.5330238"... | 0.76748496 | 0 |
==== Parameters session_id<String:: The ID of the session to retrieve. ==== Returns SessionStoreContainer:: SessionStoreContainer instance with the session data. If no sessions matched session_id, a new SessionStoreContainer will be generated. ==== Notes If there are persisted exceptions callbacks to execute, they all ... | def retrieve(session_id)
unless session_id.blank?
begin
session_data = store.retrieve_session(session_id)
rescue => err
Merb.logger.warn!("Could not retrieve session from #{self.name}: #{err.message}")
end
# Not in container, but assume that cookie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def persist(session_id)\n unless session_id.blank?\n session = ::Cache.get(\"session:#{session_id}\")\n if session.nil?\n # Not in memcached, but assume that cookie exists\n session = new(session_id)\n end\n else\n # No cookie...make a new ses... | [
"0.67515373",
"0.64818347",
"0.64341056",
"0.6353191",
"0.6197888",
"0.6197888",
"0.6161912",
"0.6098674",
"0.6087412",
"0.5968167",
"0.5847905",
"0.5844818",
"0.58317953",
"0.5763401",
"0.56687367",
"0.5575133",
"0.5551224",
"0.55097526",
"0.54956776",
"0.54921097",
"0.54469... | 0.7237596 | 0 |
Regenerate the session ID. | def regenerate
store.delete_session(self.session_id)
self.session_id = Merb::SessionMixin.rand_uuid
store.store_session(self.session_id, self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def regenerate\n self.session_id = Merb::SessionMixin::rand_uuid\n self.needs_new_cookie = true\n self.save\n end",
"def regenerate \n \t @session_id = Merb::SessionMixin::rand_uuid \n \t self.needs_new_cookie=true \n \tend",
"def regenerate\n update_attributes(:session_id => Mer... | [
"0.78848916",
"0.7736823",
"0.7687345",
"0.7387687",
"0.73457557",
"0.6993442",
"0.69596606",
"0.69523686",
"0.69506353",
"0.68401",
"0.6768713",
"0.6768713",
"0.67621464",
"0.67583627",
"0.67325604",
"0.667493",
"0.6601158",
"0.65901715",
"0.65834874",
"0.65813595",
"0.65569... | 0.82689404 | 0 |
Transforms an object to a nested struct. | def nested_struct obj
case obj
when Hash
obj.each_with_object(OpenStruct.new) do |(k,v), acc|
acc[k]= case v
when Hash then send(__method__,v)
when Array then v.map(&method(__method__))
else v
end
end.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_ostruct(obj)\n return OpenStruct.new(Hash[obj.map { |k, v| [k, _convert_ostruct(v)] }]).freeze if obj.is_a?(Hash)\n return obj.map { |v| _convert_ostruct(v) }.freeze if obj.is_a?(Array)\n obj\n end",
"def _struct(obj)\n obj.class.new(*_renc(obj.to_h).values)\n end",
"def hashes2ostru... | [
"0.69427836",
"0.6710124",
"0.6609458",
"0.6609458",
"0.64221096",
"0.62490034",
"0.61707664",
"0.61616284",
"0.60542864",
"0.594782",
"0.5945093",
"0.58298296",
"0.58274627",
"0.578196",
"0.57325447",
"0.5667133",
"0.56351244",
"0.56074375",
"0.560394",
"0.5577484",
"0.55692... | 0.6895664 | 1 |
Read user data from console | def read_from_console
puts "Please write URL: "
@url = STDIN.gets.strip
puts "Please write URL description"
@text = STDIN.gets.strip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_from_console\n puts 'Enter URL, please:'\n @url = STDIN.gets.chomp\n\n puts 'Enter the name to this link, please:'\n @text = STDIN.gets.chomp\n end",
"def read_from_console\n puts \"Link adress(url):\"\n @url = STDIN.gets.chomp\n\n puts \"Short description\"\n @text = STDIN.gets... | [
"0.70160323",
"0.6934752",
"0.6902347",
"0.6806177",
"0.6738618",
"0.6689358",
"0.6660698",
"0.6637481",
"0.661686",
"0.66137147",
"0.65034145",
"0.64892274",
"0.63769597",
"0.63399124",
"0.63153934",
"0.6292194",
"0.62874687",
"0.6231399",
"0.6226151",
"0.6222755",
"0.621838... | 0.7081887 | 0 |
5 Groups, by letter ae => A fj => F ko => K pt => P uz => U | def letter_group(letter)
case letter.downcase
when 'a'..'e'
'A'
when 'f'..'j'
'F'
when 'k'..'o'
'K'
when 'p'..'t'
'P'
when 'u'..'z'
'U'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step_one(input)\r\n\tletters = input.upcase.gsub(/[^a-zA-Z]/, \"\").split(\"\").compact\r\n\tgroups = letters.join(\"\").scan(/.{1, 5}/)\r\n\tx_group = groups.pop\r\n\tif x_group.length < 5 \r\n\t\tuntil x_group.length == 5\r\n\t\t\tx_group += \"X\"\r\n\t\tend\r\n\tend\r\n\tgroups = groups.push(x_group)\r\nen... | [
"0.6915954",
"0.66672355",
"0.66239023",
"0.6312136",
"0.62838155",
"0.62584555",
"0.6226353",
"0.60950667",
"0.60912967",
"0.6063283",
"0.60274893",
"0.6019242",
"0.60143477",
"0.59744346",
"0.5954932",
"0.5950288",
"0.58601385",
"0.5851242",
"0.5820967",
"0.5803052",
"0.576... | 0.70340997 | 0 |
sets the path for the PID file of the master process | def pid=(path)
if path
if x = valid_pid?(path)
return path if pid && path == pid && x == $$
if x == reexec_pid && pid =~ /\.oldbin\z/
logger.warn("will not set pid=#{path} while reexec-ed "\
"child is running PID:#{x}")
return
end
raise... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pid=(path)\n if path\n if x = valid_pid?(path)\n return path if pid && path == pid && x == $$\n if x == reexec_pid && pid =~ /\\.oldbin\\z/\n logger.warn(\"will not set pid=#{path} while reexec-ed \"\\\n \"child is running PID:#{x}\")\n return\n ... | [
"0.7261832",
"0.722282",
"0.7087862",
"0.7043755",
"0.703333",
"0.70228887",
"0.70228887",
"0.69949865",
"0.693081",
"0.6913161",
"0.6799012",
"0.67507225",
"0.6726757",
"0.67129207",
"0.67129207",
"0.66924244",
"0.6673328",
"0.66681683",
"0.66575027",
"0.6632474",
"0.6629619... | 0.74115294 | 0 |
Returns the value of data[key] as a scalar value. These values are usually arrays containing a single item, but are occasionally strings or numbers. | def get_value(data, key)
if data.has_key?(key) == false || data[key].nil? || data[key] == []
return ''
end
value = data[key]
if value.is_a?(Array)
return value[0]
end
return value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value_for_data(key, item, value_key = :value)\n if item and item[:data] and item[:data][key]\n return item[:data][key][value_key]\n end\n return nil\n end",
"def find_scalar_raw(key)\n @stack.reverse_each do |level|\n if level.has_key?(key)\n val = level[key]\n re... | [
"0.67756987",
"0.6632469",
"0.66322064",
"0.64008594",
"0.63149107",
"0.6242065",
"0.62388265",
"0.6187943",
"0.6172536",
"0.61316353",
"0.6130327",
"0.6125709",
"0.60301954",
"0.6006635",
"0.6006635",
"0.6006635",
"0.6006635",
"0.6006635",
"0.6006635",
"0.5998982",
"0.599729... | 0.7364954 | 0 |
updates closest attribute for a city | def update_closest(array, city, new_dist)
if !array.include?([city, new_dist])
insert_point = binary_insert(array, new_dist)
array.insert(insert_point,[city, new_dist])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grab_nearest_by_location(distance, loc)\n\n end",
"def update_distance\n project = Project.find(params[:project_id])\n location = project.locations.find(params[:location_id])\n location.update_distance\n head :ok\n end",
"def closest_planet\n finder = self.class.select(\"id, name, locatio... | [
"0.6481104",
"0.59679246",
"0.59344333",
"0.5892845",
"0.5882746",
"0.5881754",
"0.57139283",
"0.57092476",
"0.5681272",
"0.5613243",
"0.5585045",
"0.55785245",
"0.5564932",
"0.5554854",
"0.5554854",
"0.55126464",
"0.5509044",
"0.5443414",
"0.54377544",
"0.5418613",
"0.538660... | 0.6789479 | 0 |
Create an execution engine acting on +plan+, using +control+ as the decision control object See Roby::Plan and Roby::DecisionControl | def initialize(plan, control = Roby::DecisionControl.new)
@plan = plan
plan.engine = self
@control = control
@scheduler = Schedulers::Null.new
@propagation = nil
@propagation_id = 0
@propagation_exceptions = nil
@applicatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plan plan\n plan.myself if respond_to?(:run)\n end",
"def plan=(plan)\n @plan = plan\n @relation_graphs = plan&.event_relation_graphs\n @execution_engine = plan.execution_engine if plan&.executable?\n end",
"def plan\n unless planned?\n @plan_id = Gr... | [
"0.5876621",
"0.5734846",
"0.5723887",
"0.5641055",
"0.56323254",
"0.56022304",
"0.5574517",
"0.55620927",
"0.55301565",
"0.548744",
"0.5463393",
"0.54522985",
"0.53737086",
"0.5364087",
"0.53392464",
"0.53171825",
"0.5300689",
"0.52766114",
"0.52249813",
"0.51956606",
"0.518... | 0.6911156 | 0 |
The propagation handlers are blocks that should be called at various places during propagation for all plans. These objects are called in propagation context, which means that the events they would call or emit are injected in the propagation process itself. | def add_propagation_handler(options = Hash.new, &block)
if options.respond_to?(:call) # for backward compatibility
block, options = options, Hash.new
end
handler_options, poll_options = Kernel.filter_options options,
:type => :exte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def propagation_context(sources)\n raise InternalError, \"not in a gathering context in #fire\" unless gathering?\n\n if sources\n current_sources = @propagation_sources\n @propagation_sources = sources\n else\n @propagation_sources = []... | [
"0.62599945",
"0.59983134",
"0.59742916",
"0.59522146",
"0.56645644",
"0.55877966",
"0.5557795",
"0.54797214",
"0.5441257",
"0.52801996",
"0.52741724",
"0.5259969",
"0.5219577",
"0.51800394",
"0.5135436",
"0.5086266",
"0.50513273",
"0.49948636",
"0.49328429",
"0.49121785",
"0... | 0.6104229 | 1 |
This method removes a propagation handler which has been added by ExecutionEngine.add_propagation_handler. THe +id+ value is the value returned by ExecutionEngine.add_propagation_handler. | def remove_propagation_handler(id)
propagation_handlers.delete_if { |p| p.id == id }
external_events_handlers.delete_if { |p| p.id == id }
disabled_handlers.delete_if { |p| p.id == id }
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_propagation_handler(id)\n propagation_handlers.delete_if { |p| p.id == id }\n external_events_handlers.delete_if { |p| p.id == id }\n nil\n end",
"def remove_periodic_handler(id)\n execute do\n process_every.delete_if { |spec| spec[0].i... | [
"0.8824204",
"0.56716585",
"0.5539126",
"0.5493911",
"0.54886353",
"0.54514456",
"0.5440006",
"0.53781426",
"0.5348108",
"0.525159",
"0.5245683",
"0.5173066",
"0.51605916",
"0.51304996",
"0.5023626",
"0.50109196",
"0.49835932",
"0.4885576",
"0.48836422",
"0.48799926",
"0.4867... | 0.8709895 | 1 |
This method removes a propagation handler which has been added by add_propagation_handler. THe +id+ value is the value returned by add_propagation_handler. In its first form, the argument is the proc object to be added. In the second form, the block is taken the handler. In both cases, the method returns a value which ... | def remove_propagation_handler(id)
propagation_handlers.delete_if { |p| p.id == id }
external_events_handlers.delete_if { |p| p.id == id }
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_propagation_handler(id)\n propagation_handlers.delete_if { |p| p.id == id }\n external_events_handlers.delete_if { |p| p.id == id }\n disabled_handlers.delete_if { |p| p.id == id }\n nil\n end",
"def add_propagation_handler(options... | [
"0.7874742",
"0.6144399",
"0.61427104",
"0.53705287",
"0.5329913",
"0.51634985",
"0.5077287",
"0.50241417",
"0.49758163",
"0.49692735",
"0.4913788",
"0.48292577",
"0.4821466",
"0.4819763",
"0.4793078",
"0.4769011",
"0.47555992",
"0.47324553",
"0.47244725",
"0.47126082",
"0.46... | 0.79827076 | 0 |
True if we are currently in the propagation stage | def gathering?; !!@propagation end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_queued_events?\n !@propagation.empty?\n end",
"def in_progress?\n transitive_states.include? status\n end",
"def isInTransition()\n\t\t\treturn @_state == nil\n\t\tend",
"def transition?\n current.transition?\n end",
"def dampening_state\n !dampening.nil?\n ... | [
"0.6466656",
"0.6437389",
"0.63971174",
"0.6384713",
"0.63145477",
"0.6306899",
"0.6284928",
"0.62497914",
"0.61975974",
"0.61950076",
"0.6131101",
"0.6098027",
"0.60856867",
"0.6079048",
"0.606475",
"0.606475",
"0.60594225",
"0.605081",
"0.60409474",
"0.6037984",
"0.6032453"... | 0.7261008 | 0 |
Adds a propagation step to be performed when the current time is greater than +time+. The propagation step is a signal if +is_forward+ is false and a forward otherwise. This method should not be called directly. Use add_event_propagation with the appropriate +timespec+ argument. See also delayed_events and execute_dela... | def add_event_delay(time, is_forward, source, target, context)
delayed_events << [time, is_forward, source, target, context]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_event_propagation(is_forward, from, target, context, timespec)\n if target.plan != plan\n raise Roby::EventNotExecutable.new(target), \"#{target} not in executed plan\"\n end\n\n @propagation_step_id += 1\n\n step = (@propagation[target] ||= [@prop... | [
"0.5488666",
"0.4937777",
"0.45835453",
"0.4502002",
"0.44578683",
"0.44087675",
"0.44071236",
"0.4367419",
"0.4300244",
"0.4216659",
"0.4208604",
"0.41696072",
"0.4109614",
"0.4097528",
"0.40250406",
"0.39798385",
"0.3967458",
"0.39162973",
"0.3909821",
"0.39057222",
"0.3851... | 0.59824276 | 0 |
Adds the events in +delayed_events+ whose time has passed into the propagation. This must be called in propagation context. See add_event_delay and delayed_events | def execute_delayed_events
reftime = Time.now
delayed_events.delete_if do |time, forward, source, signalled, context|
if time <= reftime
add_event_propagation(forward, [source], signalled, context, nil)
true
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_event_delay(time, is_forward, source, target, context)\n delayed_events << [time, is_forward, source, target, context]\n end",
"def gather_external_events\n gather_framework_errors('delayed events') { execute_delayed_events }\n call_poll_blocks(self.class.exter... | [
"0.67829853",
"0.6109362",
"0.5345597",
"0.5081673",
"0.4898232",
"0.4857953",
"0.48519415",
"0.48329407",
"0.47928753",
"0.47922057",
"0.47543144",
"0.47079867",
"0.46405455",
"0.46287104",
"0.46264374",
"0.46150503",
"0.45869464",
"0.45050174",
"0.4464378",
"0.4450242",
"0.... | 0.6974081 | 0 |
Called by plan when an event became unreachable | def unreachable_event(event)
delayed_events.delete_if { |_, _, _, signalled, _| signalled == event }
super if defined? super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finalized_event(event)\n event.unreachable!(nil, plan)\n # since the event is already finalized, \n super if defined? super\n end",
"def unreachable!(options = Hash.new)\n poll_timer.cancel\n @raw_last_sample = nil\n\n # ensure that thi... | [
"0.7461098",
"0.64747506",
"0.5853299",
"0.58452064",
"0.5719851",
"0.5655763",
"0.56224036",
"0.5608677",
"0.5596885",
"0.55566525",
"0.5515068",
"0.54773843",
"0.54559004",
"0.54475474",
"0.5410217",
"0.5392533",
"0.53841525",
"0.53841525",
"0.53667223",
"0.5353678",
"0.535... | 0.8315785 | 0 |
Called by plan when an event has been finalized | def finalized_event(event)
event.unreachable!(nil, plan)
# since the event is already finalized,
super if defined? super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finalized_event(event)\n\t\tsuper if defined? super\n\t\tPlanModificationHooks.finalized_object(self, event) \n\t end",
"def finalized_plan_event(transaction, proxy); end",
"def finalized; end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
"def finalize\n end",
... | [
"0.805322",
"0.7867723",
"0.70312554",
"0.6769385",
"0.6769385",
"0.6769385",
"0.6769385",
"0.6769385",
"0.6769385",
"0.6769385",
"0.6760086",
"0.67350286",
"0.67341787",
"0.6724232",
"0.66196924",
"0.65514463",
"0.65449685",
"0.6529962",
"0.6519514",
"0.642294",
"0.64090854"... | 0.8070504 | 0 |
Returns true if some events are queued | def has_queued_events?
!@propagation.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_pending_events?\n\t\treturn self.pending_event_count.nonzero? ? true : false\n\tend",
"def queued_messages?\n @pointer < @buffer.length\n end",
"def queued_messages?\r\n @pointer < @buffer.length\r\n end",
"def queued?\n @queued\n end",
"def queued?\n @state == STATE_QU... | [
"0.7808109",
"0.75087607",
"0.7475618",
"0.7430477",
"0.73110735",
"0.7282014",
"0.71861976",
"0.7140255",
"0.7111006",
"0.7102875",
"0.69703674",
"0.6951295",
"0.6882075",
"0.68529487",
"0.68434954",
"0.68215215",
"0.6787345",
"0.6785631",
"0.6725701",
"0.6715741",
"0.670327... | 0.8295222 | 0 |
Returns true if there is an error queued that originates from +origin+ | def has_error_from?(origin)
if @propagation_exceptions
@propagation_exceptions.any? do |error|
error.originates_from?(origin)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_origin\n origin = @transport.get_data(\"meta\",\"origin\")\n # compare two arrays with intersection\n return (origin & [@name,@version,@action]).empty?\n end",
"def originated?\n self.state == 'originated'\n end",
"def discarded?\n finished? && error.present?\n end",
... | [
"0.6255219",
"0.6150914",
"0.5919311",
"0.58398575",
"0.5739633",
"0.57045573",
"0.5674672",
"0.56706786",
"0.5642749",
"0.5642749",
"0.5591818",
"0.5575353",
"0.5530014",
"0.55266577",
"0.55188954",
"0.55167854",
"0.55123526",
"0.5510643",
"0.5505944",
"0.54645205",
"0.54641... | 0.73498136 | 0 |
If called in execution context, adds the planbased error +e+ to be handled later in the execution cycle. Otherwise, calls add_framework_error | def add_error(e)
plan_exception = e.to_execution_exception
if @additional_errors
# We are currently propagating exceptions. Gather new ones in
# @additional_errors
@additional_errors << e
elsif @propagation_exceptions
@p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_perform_error(_e); end",
"def add_framework_error(error, source)\n if @application_exceptions\n @application_exceptions << [error, source]\n elsif Roby.app.abort_on_application_exception? || error.kind_of?(SignalException)\n raise error, \"in #{sourc... | [
"0.6639085",
"0.6297347",
"0.60531324",
"0.6008635",
"0.5918864",
"0.5888939",
"0.58207005",
"0.56931597",
"0.5653937",
"0.56360835",
"0.55880165",
"0.55823964",
"0.5555597",
"0.5552335",
"0.55446315",
"0.5537983",
"0.55342567",
"0.5527457",
"0.55133927",
"0.5511127",
"0.5509... | 0.70650834 | 0 |
Yields to the block, calling add_framework_error if an exception is raised | def gather_framework_errors(source)
if @application_exceptions
has_application_errors = true
else
@application_exceptions = []
end
yield
rescue Exception => e
add_framework_error(e, source)
ensure
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_yield(&block)\n begin\n block.call\n rescue Exception => e\n puts \"Exception! #{e.to_s}\"\n Rails.logger.error \"Caught exception: #{e.to_s}\"\n raise e\n end\n end",
"def with_error_handling\n yield\n rescue => error\n report_error(error)\n ... | [
"0.7059723",
"0.69249535",
"0.6817297",
"0.6773447",
"0.6670995",
"0.6584345",
"0.65724415",
"0.6567703",
"0.6565305",
"0.6524365",
"0.64704126",
"0.64664704",
"0.639616",
"0.6366388",
"0.63650185",
"0.6362073",
"0.6362073",
"0.635266",
"0.6346009",
"0.63395244",
"0.6329988",... | 0.70050395 | 1 |
Adds a propagation to the next propagation step: it registers a propagation step to be performed between +source+ and +target+ with the given +context+. If +is_forward+ is true, the propagation will be a forwarding, otherwise it is a signal. If +timespec+ is not nil, it defines a delay to be applied before calling the ... | def add_event_propagation(is_forward, from, target, context, timespec)
if target.plan != plan
raise Roby::EventNotExecutable.new(target), "#{target} not in executed plan"
end
@propagation_step_id += 1
step = (@propagation[target] ||= [@propagation_step_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_add_propagation(only_forward, marshalled_from, marshalled_to, event_id, time, context)\n\t\tfrom_generator = peer.local_object(marshalled_from)\n\t\tto_generator\t= peer.local_object(marshalled_to)\n\t\tcontext = peer.local_object(context)\n\n\t\tevent\t\t= event_for(from_generator, event_id, ti... | [
"0.6089788",
"0.5899624",
"0.5864237",
"0.5104901",
"0.4973473",
"0.48341966",
"0.46760526",
"0.46441466",
"0.44534242",
"0.438406",
"0.4278943",
"0.4028153",
"0.40261954",
"0.40065715",
"0.3878761",
"0.38590625",
"0.37839538",
"0.376926",
"0.37177765",
"0.37006283",
"0.36976... | 0.7324824 | 0 |
Process the pending worker completion blocks | def process_workers
cleanup_worker_threads
completion_blocks = []
while !worker_completion_blocks.empty?
block = worker_completion_blocks.pop
completion_blocks << PollBlockDefinition.new("worker completion handler #{block}", block, Hash.new)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complete\n @result_handler.call(*result) while @jobcount > 0\n end",
"def finished_work(worker, work_unit, result)\n end",
"def do_work\n until @worker_input_queue.empty?\n @output_queue << yield(@worker_input_queue.pop)\n end\n end",
"def handle_work_complete(hostport, data)\n... | [
"0.6873616",
"0.648638",
"0.63923943",
"0.6349253",
"0.6327774",
"0.62438995",
"0.62438995",
"0.62378526",
"0.6094773",
"0.60881245",
"0.60430205",
"0.60002977",
"0.59452176",
"0.5926885",
"0.5905011",
"0.58882594",
"0.58861005",
"0.5851981",
"0.583939",
"0.58325094",
"0.5813... | 0.7665745 | 0 |
Called whenever the scheduler did something, to report about its state | def report_scheduler_state(state)
super if defined? super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_completed\n end",
"def some_business_logic\n puts \"\\nSubject: I am doing something important.\"\n @state = rand(0..10)\n\n puts \"Subject: My state has just changed to: #{state}\"\n notify\n end",
"def some_business_logic\n puts \"\\nSubject: I'm doing something important.\"\n @st... | [
"0.6525876",
"0.64062345",
"0.63558775",
"0.6330107",
"0.6149261",
"0.6149261",
"0.61347127",
"0.61245084",
"0.6106146",
"0.6082545",
"0.6030141",
"0.603014",
"0.59492123",
"0.5931132",
"0.5928666",
"0.59272844",
"0.5911121",
"0.5911121",
"0.5904228",
"0.588709",
"0.5879978",... | 0.7304667 | 0 |
callseq: next_event(pending) => event, propagation_info Determines the event in +current_step+ which should be signalled now. Removes it from the set and returns the event and the associated propagation information. See gather_propagation for the format of the returned +propagation_info+ | def next_event(pending)
# this variable is 2 if selected_event is being forwarded, 1 if it
# is both forwarded and signalled and 0 if it is only signalled
priority, step_id, selected_event = nil
for propagation_step in pending
target_event = propagation_st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_propagation_step(current_step)\n signalled, step_id, forward_info, call_info = next_event(current_step)\n\n next_step = nil\n if call_info\n source_events, source_generators, context = prepare_propagation(signalled, false, call_info)\n if sou... | [
"0.63183254",
"0.51885533",
"0.50564545",
"0.49404225",
"0.49231166",
"0.48922706",
"0.4825022",
"0.48183548",
"0.48058176",
"0.47716776",
"0.47669172",
"0.47043836",
"0.46998578",
"0.46324697",
"0.4606959",
"0.45750588",
"0.4563068",
"0.45515668",
"0.44815153",
"0.44602293",
... | 0.58464056 | 1 |
callseq: prepare_propagation(target, is_forward, info) => source_events, source_generators, context prepare_propagation(target, is_forward, info) => nil Parses the propagation information +info+ in the context of a signalling if +is_forward+ is true and a forwarding otherwise. +target+ is the target event. The method a... | def prepare_propagation(target, is_forward, info)
timeref = Time.now
source_events, source_generators, context = ValueSet.new, ValueSet.new, []
delayed = true
info.each_slice(3) do |src, ctxt, time|
if time && (delay = ExecutionEngine.make_delay(timeref,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_event_propagation(is_forward, from, target, context, timespec)\n if target.plan != plan\n raise Roby::EventNotExecutable.new(target), \"#{target} not in executed plan\"\n end\n\n @propagation_step_id += 1\n\n step = (@propagation[target] ||= [@prop... | [
"0.631078",
"0.60993725",
"0.580587",
"0.5778696",
"0.5622453",
"0.52668005",
"0.51954305",
"0.5022328",
"0.48337612",
"0.4745767",
"0.4693107",
"0.46877676",
"0.45813453",
"0.44654596",
"0.4459199",
"0.4416104",
"0.43801218",
"0.4291167",
"0.42202067",
"0.4173652",
"0.409778... | 0.80963284 | 0 |
Propagate one step +current_step+ describes all pending emissions and calls. This method calls ExecutionEngine.next_event to get the description of the next event to call. If there are signals going to this event, they are processed and the forwardings will be treated in the next step. The method returns the next set o... | def event_propagation_step(current_step)
signalled, step_id, forward_info, call_info = next_event(current_step)
next_step = nil
if call_info
source_events, source_generators, context = prepare_propagation(signalled, false, call_info)
if source_events
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_step\n self.step_flow.next_step if can_increment_step\n end",
"def next_event(pending)\n # this variable is 2 if selected_event is being forwarded, 1 if it\n # is both forwarded and signalled and 0 if it is only signalled\n priority, step_id, selected_event = nil\n ... | [
"0.63125384",
"0.5992947",
"0.5601939",
"0.55708206",
"0.54034853",
"0.5187837",
"0.51671296",
"0.5148327",
"0.51273537",
"0.5118591",
"0.51129115",
"0.5093241",
"0.504177",
"0.50392073",
"0.5000602",
"0.49890262",
"0.49874318",
"0.4976893",
"0.49459204",
"0.49299192",
"0.487... | 0.73865163 | 0 |
The core exception propagation algorithm | def propagate_exception_in_plan(exceptions)
# Remove all exception that are not associated with a task
exceptions = exceptions.find_all do |e, _|
if !e.origin
Roby.display_exception(Roby.logger.io(:warn), e.exception)
e.generator.unreachabl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def propagate\n @propagate_exceptions = true\n end",
"def continued_exception; end",
"def continued_exception=(_arg0); end",
"def gather_errors\n if @propagation_exceptions\n raise InternalError, \"recursive call to #gather_errors\"\n end\n\n # The ensu... | [
"0.6566445",
"0.65287554",
"0.6321704",
"0.6118133",
"0.6023718",
"0.58559215",
"0.58382815",
"0.5816024",
"0.5780478",
"0.5767052",
"0.5738525",
"0.57272685",
"0.57236373",
"0.56370026",
"0.5609121",
"0.5609121",
"0.5609121",
"0.5609121",
"0.5609121",
"0.55892026",
"0.558363... | 0.675578 | 0 |
Schedules +block+ to be called once after +delay+ seconds passed, in the propagation context | def delayed(delay, options = Hash.new, &block)
handler = PollBlockDefinition.new("delayed block #{block}", block, Hash[:once => true].merge(options))
once do
process_every << [handler, cycle_start, delay]
end
handler.id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _delay\n class << self; self; end.module_eval { yield }\n end",
"def deliver_later_with_additional_delay\n yield.deliver_later(wait: 1.second)\n end",
"def delay(time)\n @context.backend.delay(time)\n end",
"def with_delay(delay, &block)\n # Delay should be either an integer or a ran... | [
"0.68778414",
"0.6667342",
"0.6431183",
"0.6342658",
"0.6183502",
"0.6149078",
"0.61421776",
"0.60863847",
"0.60800517",
"0.6011292",
"0.5941804",
"0.59197336",
"0.59084314",
"0.59056735",
"0.5875334",
"0.5874263",
"0.5874263",
"0.58691597",
"0.5864503",
"0.58418506",
"0.5818... | 0.7075189 | 0 |
Kills and removes all unneeded tasks. +force_on+ is a set of task whose garbagecollection must be performed, even though those tasks are actually useful for the system. This is used to properly kill tasks for which errors have been detected. | def garbage_collect(force_on = nil)
if force_on && !force_on.empty?
ExecutionEngine.info "GC: adding #{force_on.size} tasks in the force_gc set"
mismatching_plan = force_on.find_all do |t|
if t.plan == self.plan
plan.force_gc << t
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_all(force = false)\n @monitor.stop if @monitor\n \n failed_to_kill = false\n debug = options[:debug]\n wait = options[:force_kill_wait].to_i\n pids = unix_pids\n if wait > 0 && pids.size > 0\n puts \"[daemons_ext]: Killing #{app_name} with force after #{wait} secs... | [
"0.68050647",
"0.6095737",
"0.60080767",
"0.55633396",
"0.55203015",
"0.55198723",
"0.550959",
"0.5480315",
"0.54711074",
"0.5469832",
"0.54320455",
"0.5399584",
"0.53504145",
"0.53455824",
"0.5333525",
"0.5309237",
"0.52993166",
"0.5285073",
"0.52804226",
"0.5265769",
"0.522... | 0.7402737 | 0 |
Call +block+ every +duration+ seconds. Note that +duration+ is round up to the cycle size (time between calls is at least duration) The returned value is the periodic handler ID. It can be passed to remove_periodic_handler to undefine it. | def every(duration, options = Hash.new, &block)
handler = PollBlockDefinition.new("periodic handler #{block}", block, options)
once do
if handler.call(self, plan)
process_every << [handler, cycle_start, duration]
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interval duration, &block\n `setInterval(function() { #{block.call} }, duration * 1000)`\n end",
"def delayed(delay, options = Hash.new, &block)\n handler = PollBlockDefinition.new(\"delayed block #{block}\", block, Hash[:once => true].merge(options))\n once do\n ... | [
"0.6370444",
"0.5911374",
"0.5522722",
"0.5514895",
"0.5480243",
"0.54706067",
"0.54154074",
"0.5272541",
"0.51817256",
"0.51305723",
"0.50978416",
"0.50978416",
"0.5088303",
"0.5045322",
"0.5017834",
"0.5013242",
"0.48841506",
"0.4876056",
"0.48447114",
"0.483535",
"0.477555... | 0.79914975 | 0 |
Removes a periodic handler defined by every. +id+ is the value returned by every. | def remove_periodic_handler(id)
execute do
process_every.delete_if { |spec| spec[0].id == id }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_propagation_handler(id)\n propagation_handlers.delete_if { |p| p.id == id }\n external_events_handlers.delete_if { |p| p.id == id }\n disabled_handlers.delete_if { |p| p.id == id }\n nil\n end",
"def clearTimer(id)\n [@timers_... | [
"0.62895805",
"0.62662077",
"0.62165225",
"0.6140096",
"0.59767723",
"0.5848819",
"0.5822761",
"0.5755955",
"0.56627405",
"0.5601906",
"0.55885816",
"0.5518848",
"0.55078554",
"0.5500249",
"0.543023",
"0.5422992",
"0.53891134",
"0.5382624",
"0.5371584",
"0.52786535",
"0.52629... | 0.8512412 | 0 |
True if the current thread is the execution thread of this engine See outside_control? for a discussion of the use of inside_control? and outside_control? when testing the threading context | def inside_control?
t = thread
!t || t == Thread.current
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outside_control?\n\t t = thread\n\t !t || t != Thread.current\n\tend",
"def thread?\n false\n end",
"def with_own_thread()\n true\n end",
"def reactor_thread?\n @reactor_thread == Thread.current\n end",
"def sync_exec_required?\n Thread.current != DisplayProxy... | [
"0.81170756",
"0.75847894",
"0.75157547",
"0.74930674",
"0.7464021",
"0.7331975",
"0.7274495",
"0.7256704",
"0.7250293",
"0.7250293",
"0.7237076",
"0.72270304",
"0.7217907",
"0.72102195",
"0.72102195",
"0.71978056",
"0.7191337",
"0.7191337",
"0.7191337",
"0.7177658",
"0.71503... | 0.8330575 | 0 |
True if the current thread is not the execution thread of this engine, or if there is not control thread. When you check the current thread context, always use a negated form. Do not do if Roby.inside_control? ERROR end Do instead if !Roby.outside_control? ERROR end Since the first form will fail if there is no control... | def outside_control?
t = thread
!t || t != Thread.current
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inside_control?\n\t t = thread\n\t !t || t == Thread.current\n\tend",
"def do_not_thread\n true\n end",
"def do_not_thread\n true\n end",
"def do_not_thread\n true\n end",
"def do_not_thread\n\n true\n end",
"def do_not_thread; true; end",
"def do_not_t... | [
"0.7979639",
"0.7076062",
"0.6977343",
"0.6977343",
"0.6974442",
"0.67213374",
"0.67213374",
"0.67213374",
"0.6580144",
"0.64148927",
"0.63846946",
"0.6376118",
"0.6198038",
"0.61850774",
"0.6167656",
"0.61050636",
"0.6102741",
"0.61016154",
"0.603525",
"0.603525",
"0.5968801... | 0.80069166 | 0 |
:nodoc: Sets up the plan for clearing: it discards all missions and undefines all permanent tasks and events. Returns nil if the plan is cleared, and the set of remaining tasks otherwise. Note that quaranteened tasks are not counted as remaining, as it is not possible for the execution engine to stop them. | def clear
Roby.synchronize do
plan.missions.dup.each { |t| plan.unmark_mission(t) }
plan.permanent_tasks.dup.each { |t| plan.unmark_permanent(t) }
plan.permanent_events.dup.each { |t| plan.unmark_permanent(t) }
plan.force_gc.merge( plan.known_tasks )
quaranteened_subplan = plan.useful_task_component(nil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_plan\n plan.clear\n plan\n end",
"def new_plan\n\t plan.clear\n\t plan\n\tend",
"def delete\n\t @name = self.name\n\t @tasks = nil\n\t if plan\n\t\tplan.remove_object(self)\n\t else\n\t\tclear_relations\n\t\tfreeze \n\t end\n\tend",
"def prepare_plan... | [
"0.6426055",
"0.6333709",
"0.61993587",
"0.61786616",
"0.6154336",
"0.5855511",
"0.58381665",
"0.5820027",
"0.5606826",
"0.55016524",
"0.548516",
"0.5483619",
"0.54813147",
"0.54630816",
"0.5449732",
"0.53738064",
"0.5319978",
"0.52729213",
"0.5214953",
"0.5208953",
"0.516475... | 0.7667234 | 0 |
Adds to the stats the given duration as the expected duration of the +name+ step. The field in +stats+ is named "expected_". | def add_expected_duration(stats, name, duration)
stats[:"expected_#{name}"] = Time.now + duration - stats[:start]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_timepoint(stats, name)\n stats[:end] = stats[name] = Time.now - stats[:start]\n @remaining_cycle_time = cycle_length - stats[:end]\n end",
"def around_perform_stats(*args)\n start = Time.now\n yield\n time_taken = Time.now - start\n statsd.timing(\... | [
"0.5718664",
"0.5395649",
"0.5229604",
"0.5143364",
"0.50910807",
"0.50661325",
"0.50633436",
"0.5040111",
"0.5027817",
"0.4978035",
"0.4959904",
"0.49262995",
"0.48828918",
"0.48641047",
"0.4825009",
"0.4807655",
"0.47828782",
"0.47802365",
"0.47793427",
"0.47159153",
"0.470... | 0.87923706 | 0 |
Adds in +stats+ the current time as a timepoint named +time+, and update remaining_cycle_time | def add_timepoint(stats, name)
stats[:end] = stats[name] = Time.now - stats[:start]
@remaining_cycle_time = cycle_length - stats[:end]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_stat(state, time)\n @stats[state] = 0.to_f if @stats[state].nil?\n @stats[state] += time\n end",
"def cycle_end_time\n Time.at(*stats[:start]) + stats[:end]\n end",
"def cycle_end_time\n Time.at(*stats[:start]) + stats[:end]\n en... | [
"0.5866825",
"0.57701045",
"0.57701045",
"0.5683643",
"0.56612724",
"0.5646709",
"0.5563056",
"0.5546391",
"0.5456036",
"0.5396354",
"0.53845066",
"0.53770113",
"0.53625065",
"0.5353219",
"0.52943647",
"0.5279666",
"0.52791274",
"0.5253615",
"0.5221617",
"0.5207482",
"0.52042... | 0.766311 | 0 |
Set the cycle_start attribute and increment cycle_index This is only used for testing purposes | def start_new_cycle(time = Time.now)
@cycle_start = time
@cycle_index += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_cycle(cycle)\n @cycle=cycle\n if !@se.nil?\n @se.set_cycle(cycle)\n end\n end",
"def set_cycle\n @cycle = Cycle.find(params[:id])\n end",
"def set_cycle\n @cycle = Cycle.find(params[:id])\n end",
"def set_cycle_id(cycle)\n cycle['id'] = cycle['releaseCy... | [
"0.6717883",
"0.6291065",
"0.6291065",
"0.61485296",
"0.6082863",
"0.60588205",
"0.60588205",
"0.597165",
"0.5889453",
"0.5802116",
"0.57875156",
"0.57875156",
"0.5721838",
"0.5698016",
"0.5630777",
"0.5628738",
"0.5623878",
"0.55142444",
"0.5512631",
"0.5482674",
"0.54639155... | 0.6953611 | 0 |
Make control quit properly | def quit; @quit = 1 end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def force_quit; @quit = 2 end",
"def forced_exit?; @quit > 1 end",
"def quit; end",
"def quit; end",
"def mouse_quit\n $game_system.se_play($data_system.cancel_se)\n if display_message(ext_text(8997, 40), 1, ext_text(8997, 33), ext_text(8997, 34)) == 0\n @return_data = false\n @runn... | [
"0.73224795",
"0.72843593",
"0.7281624",
"0.7281624",
"0.7230939",
"0.7222317",
"0.7028276",
"0.69747376",
"0.6971123",
"0.6962184",
"0.69117785",
"0.69067687",
"0.69067687",
"0.69004166",
"0.6868853",
"0.68339264",
"0.6828788",
"0.6818017",
"0.6818017",
"0.6790746",
"0.67772... | 0.74524975 | 0 |
Force quitting, without cleaning up | def force_quit; @quit = 2 end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quit!\n quit\n exit!\n end",
"def forced_exit?; @quit > 1 end",
"def quit; end",
"def quit; end",
"def quit; @quit = 1 end",
"def quit\n exit(1)\n end",
"def quit\n system('clear')\n exit\n end",
"def quit\n end",
"def exit\n @main_loop = false\n end",
"de... | [
"0.833436",
"0.8287258",
"0.81285334",
"0.81285334",
"0.80995494",
"0.8094997",
"0.79301775",
"0.77786577",
"0.7710612",
"0.7668522",
"0.7649714",
"0.76163226",
"0.7564802",
"0.7541747",
"0.75221366",
"0.7502455",
"0.7495553",
"0.74297804",
"0.73901075",
"0.7385634",
"0.73753... | 0.8427942 | 0 |
Stops the current thread until the given even is emitted. If the event becomes unreachable, an UnreachableEvent exception is raised. | def wait_until(ev)
if inside_control?
raise ThreadMismatch, "cannot use #wait_until in execution threads"
end
Roby.condition_variable(true) do |cv, mt|
caller_thread = Thread.current
# Note: no need to add the caller thread in waiting_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_event_thread\n if @event_thread\n logger.debug { \"##{__method__}\" }\n shut_down!\n wake_event_loop!\n @event_thread.join\n @event_thread = nil\n end\n end",
"def stop!\n synchronize do\n @thread.exit if @thread\n\n yield if block_given... | [
"0.5892155",
"0.5454543",
"0.5393308",
"0.53770924",
"0.52926594",
"0.51954895",
"0.5194696",
"0.5176172",
"0.5161372",
"0.5160033",
"0.5153835",
"0.51520497",
"0.5150874",
"0.51487976",
"0.5140575",
"0.5137067",
"0.5131639",
"0.51085854",
"0.50642526",
"0.5063219",
"0.506321... | 0.59997475 | 0 |
Kill all tasks that are currently running in the plan | def killall
scheduler_enabled = scheduler.enabled?
plan.permanent_tasks.clear
plan.permanent_events.clear
plan.missions.clear
plan.transactions.each do |trsc|
trsc.discard_transaction!
end
scheduler.enabled = false
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop()\n @tasks.each_value { |task| task.stop() }\n end",
"def clean\n # Each the tasks\n @tasks.each do |task|\n # Clean all of them\n task.clean\n end\n end",
"def shutdown_tasks\n self.tasks.select { |t| t.interval == :shutdown }\n end",
"def clear\n\t ... | [
"0.7147563",
"0.6726835",
"0.6674281",
"0.65361184",
"0.6417678",
"0.63376474",
"0.6292043",
"0.6249697",
"0.6237564",
"0.6162614",
"0.61384106",
"0.6035531",
"0.60116935",
"0.59767944",
"0.5952355",
"0.5920789",
"0.5899221",
"0.5899221",
"0.5872578",
"0.58685046",
"0.5854391... | 0.7406664 | 0 |
whether this engine should indiscriminately display all fatal exceptions | def display_exceptions?
!!@exception_display_handler
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fatal?\n false\n end",
"def fatal?\n exception.fatal?\n end",
"def fatal?\n @level <= 4\n end",
"def fatal?; end",
"def fatal?; end",
"def fatal?\n level == 3\n end",
"def show_detailed_exceptions?; end",
"def fatal?\n level >= ASL_LEVEL_CRIT\n... | [
"0.74382323",
"0.7037027",
"0.70174533",
"0.7000318",
"0.7000318",
"0.6981916",
"0.6901751",
"0.6750566",
"0.6688733",
"0.66800207",
"0.664589",
"0.6418616",
"0.6400375",
"0.63815975",
"0.63815975",
"0.6371764",
"0.63112056",
"0.63105595",
"0.62212795",
"0.6220486",
"0.607566... | 0.7627101 | 0 |
validates admin emails using the debatemate_email method | def check_admin_email
if admin? && !debatemate_email?
errors.add(:email, "must be hosted at debatemate.com for admin users")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin?\n email.eql? \"dev@partiu.de\"\n end",
"def admin?\n self.email == \"vinti.uiet@gmail.com\" || self.email == \"parryg@hotmail.com\"\n end",
"def admin_email(e=nil)\n return @admin_email unless e\n @admin_email = e\n end",
"def admin? \n \tself.email == 'meist@infoniqa.com'\n ... | [
"0.65886277",
"0.6549644",
"0.65067697",
"0.6469915",
"0.6455631",
"0.63757634",
"0.63718176",
"0.63718176",
"0.6294014",
"0.6289774",
"0.62070036",
"0.61886525",
"0.60710853",
"0.6054939",
"0.60504293",
"0.59884065",
"0.5968785",
"0.5953567",
"0.5951878",
"0.594336",
"0.5927... | 0.8538237 | 0 |
is this user's email hosted on debatemate.com? | def debatemate_email?
len = email.length
email[(len - 15)..(len)] == "@debatemate.com"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_uri?\n @url[0..6] == 'mailto:'\n end",
"def bot_user?\n !@email.nil?\n end",
"def for_testing?\n self.email.end_with?('sributest1289.com') and !Rails.env.production?\n end",
"def is_guest?\n email == GUEST_USER_EMAIL\n end",
"def do_not_email?\n false\n end",
... | [
"0.6740391",
"0.6721174",
"0.6713933",
"0.66684216",
"0.66629094",
"0.66501534",
"0.66378736",
"0.65991354",
"0.6587773",
"0.65626395",
"0.6548095",
"0.65369964",
"0.6530619",
"0.6508679",
"0.650645",
"0.6489848",
"0.6489663",
"0.64847684",
"0.6453402",
"0.642466",
"0.6421421... | 0.77220917 | 0 |
Filters files fin to fout All whitespace at end of line is replaced with '\n' Only one blank line allowed consecutively. Last nonempty line is terminated with '\n' No trailing additional lines in file. | def filter( fin, fout )
dropped_lines = 0
changed_lines = 0
tab_lines = 0
empty_lines = 0
total = 0
while( line = fin.gets )
total += 1
lstr = line.rstrip
changed_lines += 1 if ( line != ( lstr + "\n" ) )
if lstr.empty?
empty_lines += 1
else
if emp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_white_space\n @content.gsub!(/\\n{2,}/, \"\\n\")\n write_content_to_file\n end",
"def filter\n read = []\n @file.each do |line|\n line = line.strip\n if !line[0].nil? && (line[0] != '/') # if line is not comment or blank append to output\n line = line.split(' ')[0] #... | [
"0.5573536",
"0.5467695",
"0.54279095",
"0.5357583",
"0.5338687",
"0.5163187",
"0.51595134",
"0.51257044",
"0.51187146",
"0.50479555",
"0.50378704",
"0.5022677",
"0.50215673",
"0.5003632",
"0.49842948",
"0.49819526",
"0.49768144",
"0.49599504",
"0.49542663",
"0.49532124",
"0.... | 0.6747587 | 0 |
GET /project_events GET /project_events.xml | def index
if params[:project_id]
@project = Project.find(params[:project_id])
@project_events = @project.events
else
@project_events = ProjectEvent.paginate(:per_page => 10, :page => params[:page] || 1)
end
respond_to do |format|
format.json { render :action => "index" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def events(project_id, options = {})\n get \"projects/#{project_id}/events\", options\n end",
"def project_events(project_id, params = {})\n make_get_request(\"/projects/#{project_id}/events\", params)\n end",
"def show\n @project = @client.projects.find(params[:id])\n @events = @proj... | [
"0.7672333",
"0.7579017",
"0.7569928",
"0.73556554",
"0.6962833",
"0.6930751",
"0.6852027",
"0.6837337",
"0.6776541",
"0.6773165",
"0.67368305",
"0.67087036",
"0.66963077",
"0.6687281",
"0.6687281",
"0.6687281",
"0.6687281",
"0.66523284",
"0.66348016",
"0.6610239",
"0.6593037... | 0.7653819 | 1 |
Run the secondary debugger script that will update our trace | def load_debugger
pid = Process.fork do
STDOUT.close
STDERR.close
debug_loop = ENV["TM_BUNDLE_SUPPORT"] + "/lib/debug_loop.rb"
`ruby #{e_sh debug_loop} #{@output_swf} #{e_sh @flex_sdk_bin} &> /dev/null &`
end
Process.detach pid
sleep 0.6 # Give the debugger a moment to load
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manual_debug_code(program)\n print(\"[Starting a Debug Session with @#{caller.first}]\\n\")\n write_temp_file(strip_line_num(program))\n remote_info = setup_unix_doman_socket_remote_debuggee\n\n while !File.exist?(remote_info.sock_path)\n sleep 0.1\n end\n\n DEBUGGER__::Cli... | [
"0.5917881",
"0.591675",
"0.5833747",
"0.58104247",
"0.57465565",
"0.5713932",
"0.5702953",
"0.5702953",
"0.569319",
"0.56880856",
"0.5642559",
"0.56131923",
"0.559124",
"0.5536959",
"0.5526645",
"0.5497734",
"0.54825497",
"0.54579574",
"0.5457516",
"0.5440869",
"0.5433235",
... | 0.61464167 | 0 |
GET /billed_calls GET /billed_calls.xml | def index
@bill = Bill.find(params[:bill_id])
@billed_calls = Kaminari.paginate_array(@bill.billed_calls).page(params[:subpage]).per(Source::Application.config.items_per_page)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @billed_calls }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @bill = Bill.find(params[:bill_id])\n @billed_call = @bill.billed_calls.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @billed_call }\n end\n end",
"def get_calls()\n @client.make_request(:get, @client.concat_user_path(\"#{BRIDGE_P... | [
"0.6460426",
"0.62100655",
"0.5903114",
"0.57789224",
"0.57789224",
"0.57789224",
"0.57789224",
"0.57474506",
"0.5741925",
"0.57373387",
"0.5726502",
"0.57118815",
"0.5691813",
"0.56817806",
"0.56720316",
"0.5659824",
"0.5650911",
"0.56321734",
"0.56287897",
"0.56278795",
"0.... | 0.6635523 | 0 |
GET /billed_calls/new GET /billed_calls/new.xml | def new
@bill = Bill.find(params[:bill_id])
@billed_call = @bill.billed_calls.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @billed_call }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @call = Call.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @call }\n end\n end",
"def new\n @call = Call.new\n @templates = Array.new\n Dir.new(\"app/views/calls/twiml\").entries.each do |entry|\n @templates.push(entry[0..(e... | [
"0.7310143",
"0.69126517",
"0.687078",
"0.6787944",
"0.67828673",
"0.6769994",
"0.6769994",
"0.67499816",
"0.67449516",
"0.67370856",
"0.67077935",
"0.66502666",
"0.6613403",
"0.6594202",
"0.6580012",
"0.65711445",
"0.6533067",
"0.652644",
"0.65048814",
"0.6493495",
"0.64224"... | 0.78853595 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.