query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102 values |
|---|---|---|---|---|---|---|
Get the username provided in the URI. | def username
@username ||= match[3]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_username_from_url\n URI.parse(url_from_attributes).path.split(\"/\")[1]\n rescue URI::BadURIError, URI::InvalidURIError\n nil\n end",
"def username\n @digest_parts['username']\n end",
"def username\n @username ||= match[3]\n end",
"def username\n ... | [
"0.7776727",
"0.7617545",
"0.7286664",
"0.718011",
"0.7151728",
"0.7074652",
"0.70054626",
"0.6962541",
"0.69530493",
"0.69175553",
"0.6866879",
"0.6862728",
"0.6860857",
"0.6801869",
"0.6796414",
"0.6782567",
"0.67703384",
"0.67552054",
"0.67439604",
"0.6690375",
"0.66720414... | 0.7334211 | 2 |
def search_property_for_rent value end | def select_filter_drop_downs search_filter , value
case search_filter
when 'filter_type'
select_from_drop_down 's:swfield', value
when 'filter_category'
select_from_drop_down 'rc:swfield', value
when 'filter_sub_category'
select_from_drop_down 'c1:swfield', value
when 'bathroom minimum'
select_from_drop_down 'bathrooms__gte:swfield', value
when 'item sorting'
select_from_drop_down 'id_sort_by', value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(input, property, value); end",
"def where(input, property, value); end",
"def search_property(name) \n name = name.to_sym\n \n if properties[name]\n properties[name]\n elsif superclass.respond_to?(:search_property)\n superclass.search_property(name)... | [
"0.6911654",
"0.6543509",
"0.63734984",
"0.6230323",
"0.6139207",
"0.6085541",
"0.6072958",
"0.60677445",
"0.60495543",
"0.5943662",
"0.59184605",
"0.58887976",
"0.58388466",
"0.58353114",
"0.5832827",
"0.58316654",
"0.58226824",
"0.5811934",
"0.58055544",
"0.5797646",
"0.577... | 0.0 | -1 |
Test parsing of an arff file. | def test_arff_parse
in_file = './test_arff.arff'
rel = Rarff::Relation.new
rel.parse(File.open(in_file).read)
assert_equal(rel.instances[2][1], 3.2)
assert_equal(rel.instances[7][4], 'Iris-setosa')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sparse_arff_parse\n in_file = './test_sparse_arff.arff'\n rel = Rarff::Relation.new\n rel.parse(File.open(in_file).read)\n\n assert_equal(rel.instances[0].size, 13)\n assert_equal(rel.instances[0][1], 0)\n assert_equal(rel.instances[0][3], 7)\n assert_equal(rel.instances[1][1], 2.4)\n... | [
"0.69032866",
"0.62026334",
"0.61271423",
"0.61271423",
"0.6104418",
"0.60373396",
"0.59516",
"0.59054756",
"0.5867618",
"0.5751365",
"0.5680206",
"0.56800294",
"0.56449044",
"0.5518196",
"0.54999965",
"0.5462532",
"0.5443845",
"0.54411185",
"0.54323924",
"0.54307836",
"0.542... | 0.78511137 | 0 |
Test parsing of sparse ARFF format | def test_sparse_arff_parse
in_file = './test_sparse_arff.arff'
rel = Rarff::Relation.new
rel.parse(File.open(in_file).read)
assert_equal(rel.instances[0].size, 13)
assert_equal(rel.instances[0][1], 0)
assert_equal(rel.instances[0][3], 7)
assert_equal(rel.instances[1][1], 2.4)
assert_equal(rel.instances[1][2], 0)
assert_equal(rel.instances[1][12], 19)
assert_equal(rel.instances[2][6], 6)
assert_equal(rel.instances[3][12], 0)
# puts "\n\nARFF: (\n#{rel.to_arff}\n)"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_arff_parse\n in_file = './test_arff.arff'\n rel = Rarff::Relation.new\n rel.parse(File.open(in_file).read)\n\n assert_equal(rel.instances[2][1], 3.2)\n assert_equal(rel.instances[7][4], 'Iris-setosa')\n end",
"def test_sparse_instance\r\n assert_respond_to(@fh, :sparse=)\r\n end",... | [
"0.63681835",
"0.58841234",
"0.55813587",
"0.54093826",
"0.52492565",
"0.5143739",
"0.5109253",
"0.51087564",
"0.5083014",
"0.5083014",
"0.5058494",
"0.50479925",
"0.50372946",
"0.5031179",
"0.5008505",
"0.49728936",
"0.49392366",
"0.49359176",
"0.49343103",
"0.49063396",
"0.... | 0.79872435 | 0 |
def time_of(field) fields.assoc(field).last / $clk_tck end | def summarize()
fields.each do |name, metric|
params = {}
params[:service] = "process;#{pid};#{name}"
params[:description] = name
params[:pname] = comm
if name == "State"
params[:state] = riemann_statemap(metric)
params[:value] = metric
# elsif name.end_with?("time")
# params[:metric] = time_of(name)
elsif metric.is_a?(Numeric)
params[:metric] = metric
else
params[:value] = metric
end
yield(params)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_field field = nil\n @time_field = field if field\n @time_field\n end",
"def total_time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def cstime(*... | [
"0.6849097",
"0.66389394",
"0.65627354",
"0.65627354",
"0.65627354",
"0.65627354",
"0.65627354",
"0.65627354",
"0.65627354",
"0.65627354",
"0.65627354",
"0.6547542",
"0.6532159",
"0.63097024",
"0.63015753",
"0.62553525",
"0.62550867",
"0.6207529",
"0.6148193",
"0.61444145",
"... | 0.0 | -1 |
GET /ratings/review GET /ratings/review.js | def review
learnables =
current_user
.rated_learnables
.for_review
.limit(MAX_NUMBER_OF_RATINGS_PER_REQUEST)
@status = status
@learnables_serializer =
ActiveModel::Serializer::CollectionSerializer.new(learnables, {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\t\t@review = Review.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html {}\n\t\t\tformat.json {}\n\t\t\tformat.js\n\t\tend\n\tend",
"def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end",
"def show\n @review = Review.find(params[:id])\n render json: @review\n ... | [
"0.70864373",
"0.70565295",
"0.6992418",
"0.6946423",
"0.6936426",
"0.6900358",
"0.6854574",
"0.6854574",
"0.6854574",
"0.6840133",
"0.6840133",
"0.6840133",
"0.6840133",
"0.6840133",
"0.68022764",
"0.6769466",
"0.6747345",
"0.6730223",
"0.6696571",
"0.6684836",
"0.6679735",
... | 0.0 | -1 |
Note: You'll need to update the subcollections separately. | def update(opts={})
on RequisitionPage do |page|
edit_fields opts, page, :description, :payment_request_positive_approval_required,
:delivery_phone_number, :requestor_phone, :vendor_notes, :delivery_instructions
end
update_options(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_sub_collection\n @sub_collection = SubCollection.find(params[:id])\n end",
"def subcollections\n respond_to?(:collectionHasSubcollection) ? collectionHasSubcollection : []\n end",
"def rebuild_document_collection()\n end",
"def collection_updated(object, result)\n ... | [
"0.6812275",
"0.66981405",
"0.6618699",
"0.6447076",
"0.64146817",
"0.6362932",
"0.6354235",
"0.63188154",
"0.62588114",
"0.6258283",
"0.62110347",
"0.62103885",
"0.61770964",
"0.615962",
"0.6149062",
"0.61482984",
"0.61018896",
"0.6099695",
"0.60635835",
"0.6061285",
"0.6003... | 0.0 | -1 |
Reverses a string in place in O(n) time and O(1) space. | def reverse_string(string)
string_array = string.split('')
i = 0
j = string_array.length-1
while i < j do
tmp = string_array[i]
string_array[i] = string_array[j]
string_array[j] = tmp
i += 1
j -= 1
end
return string_array.join('')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_string(s)\n raise ArgumentError if s.empty?\n i = 0\n j = s.length - 1\n while( i < j)\n temp = s[j]\n s[j] = s[i]\n s[i] = temp\n i += 1\n j -= 1\n end\nend",
"def string_reverse(my_string)\r\n return nil if my_string.nil?\r\n n = my_string.length\r\n i = 0\r\n j = n-i-1\r\n\... | [
"0.80685633",
"0.798248",
"0.793213",
"0.78694314",
"0.7826339",
"0.7820272",
"0.77312744",
"0.77225614",
"0.77225614",
"0.77225614",
"0.771341",
"0.7688909",
"0.7663564",
"0.7663519",
"0.76568234",
"0.7647296",
"0.7639554",
"0.76348966",
"0.76328516",
"0.7617348",
"0.7590769... | 0.7584498 | 21 |
Overrides the as_json function to include a type keyvalue. | def as_json(options)
super().merge!(type: "subject")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_json(options=nil)\n json = super\n json.merge({\"type\"=>self.type.to_s})\n end",
"def as_json(options={})\n super(methods: :type)\n end",
"def as_json(options={})\n super(options.merge({:methods => :type}))\n end",
"def as_json(options={})\n super(options.merge({:methods => :type}))... | [
"0.8155591",
"0.7754095",
"0.7529929",
"0.7529929",
"0.7529929",
"0.7407277",
"0.71669644",
"0.70282674",
"0.69277054",
"0.6874024",
"0.68116117",
"0.680964",
"0.67633367",
"0.6738264",
"0.6573845",
"0.65496486",
"0.6534308",
"0.6534308",
"0.6530293",
"0.6512795",
"0.6496342"... | 0.59730107 | 65 |
1.0 , add a list of namespaces to the node the namespaces formal parameter is a hash with "prefix" and "prefix_uri" as key, value pairs prefix for the default namespace is "default" | def add_namespaces( node, namespaces )
#pass nil as the prefix to create a default node
default = namespaces.delete( "default" )
node.namespaces.namespace = XML::Namespace.new( node, nil, default )
namespaces.each do |prefix, prefix_uri|
XML::Namespace.new( node, prefix, prefix_uri )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_namespaces node\n raw.root.namespace_definitions.each do |ns|\n node.add_namespace_definition ns.prefix, ns.href if ns.href != NS\n end\n end",
"def register_namespace(name_and_href)\n (@default_namespaces ||= []) <<name_and_href\n end",
"def register_namespace(name_and_href)\n ... | [
"0.8027203",
"0.75288486",
"0.75288486",
"0.72623944",
"0.72623944",
"0.7260259",
"0.72384226",
"0.70586175",
"0.6968521",
"0.69241494",
"0.69057626",
"0.681566",
"0.67876494",
"0.67321074",
"0.67321074",
"0.6718111",
"0.6698467",
"0.66770726",
"0.6654058",
"0.6616366",
"0.65... | 0.84406596 | 0 |
add a list of attributes to the node the attributes formal parameter is a hash with "name" and "value" as key, value pairs | def add_propertys( node, attributes )
attributes.each do |name, value|
XML::Attr.new( node, name, value )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_attributes(node, attributes)\n attributes.each do |attribute|\n node.attributes[attribute[0]] = attribute[1]\n end\n\n node\n end",
"def add_attributes(attributes)\n Attributes.parse(attributes) { | n, v | add_attribute(n, v) }\n end",
"def add_attribute(name,... | [
"0.7717851",
"0.72665393",
"0.70054674",
"0.698003",
"0.69797015",
"0.68010086",
"0.6765293",
"0.6571196",
"0.6564921",
"0.65453833",
"0.6489338",
"0.6483273",
"0.644604",
"0.6387318",
"0.6353431",
"0.6322972",
"0.63118976",
"0.63079107",
"0.6294074",
"0.6254452",
"0.62484944... | 0.76575625 | 1 |
create a node with name and a hash of namespaces or attributes passed to options | def create_node( name, options )
node = XML::Node.new( name )
namespaces = options.delete( :namespaces )
add_namespaces( node, namespaces ) if namespaces
attributes = options.delete( :attributes )
add_propertys( node, attributes ) if attributes
node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_node(node, tag=nil)\n end",
"def initialize(node_name, options)\n @node_name = node_name\n @options = options\n end",
"def to_node(options={})\n options[:doc] ||= Nokogiri::XML::Document.new\n\n tag_name = options[:binding] && options[:binding].from\n root_tag = options[... | [
"0.66677094",
"0.6436466",
"0.6430052",
"0.63782036",
"0.63421035",
"0.6243989",
"0.61664647",
"0.61263067",
"0.6099774",
"0.6086351",
"0.6076297",
"0.6011779",
"0.5970208",
"0.5960545",
"0.5935067",
"0.5935067",
"0.5929265",
"0.5926563",
"0.59115535",
"0.5883397",
"0.5859406... | 0.8262067 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_panel_project
@panel_project = ::Project.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def panel_project_params
params.fetch(:project, {}).permit(:author, :name, :human_name, :identity,
:status, :source_code, :description, :today_recommend, :given_name,
:category_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Set the basic collection to sessions from browsers. | def basic_collection
::Gricer.config.session_model.browsers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sessions=(value)\n @sessions = value\n end",
"def all_sessions\n self.test_sessions\n end",
"def set_session\n \n end",
"def sessions\n Thread.current[:sessions] ||= {}\n end",
"def setup\n @current_session = new_session\n end",
"def session... | [
"0.64168805",
"0.6180096",
"0.60936016",
"0.6048786",
"0.6019108",
"0.59429014",
"0.58194256",
"0.58005023",
"0.5774661",
"0.5726785",
"0.5722286",
"0.57192034",
"0.5696373",
"0.5685883",
"0.5685883",
"0.56427616",
"0.5636192",
"0.56148326",
"0.5599852",
"0.5596372",
"0.55963... | 0.6951001 | 0 |
Offer links to further details on some attributes | def further_details
{
'agent.name' => 'agent.major_version',
'agent.os' => 'agent.name',
'agent.major_version' => 'agent.full_version',
'agent.engine_name' => 'agent.engine_version',
'silverlight_major_version' => 'silverlight_version',
'flash_major_version' => 'flash_version',
'country' => 'city',
'requested_locale_major' => 'requested_locale_minor',
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_all_links_attributes\n # Interface method\n end",
"def display_link_attributes(link)\n # Interface method\n end",
"def link_attributes\n [:accesskey, :charset, :coords, :hreflang, :id, :lang, :name, :onblur,\n :onclick, :ondblclick, :onfocus, :onkeydown, :onkeypress, :onke... | [
"0.7560308",
"0.7477011",
"0.69372046",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6753768",
"0.6753768",
"0.6645861",
"0.66313994",
"0.6492452",
"0.643893",
"0.64353955",
... | 0.0 | -1 |
POST /recalls POST /recalls.json | def create
@recall = Recall.new(params[:recall])
respond_to do |format|
if @recall.save
format.html { redirect_to edit_admin_recall_path(@recall), notice: 'Отзыв успешно добавлен.' }
format.json { render json: @recall, status: :created, location: @recall }
else
format.html { render action: "edit" }
format.json { render json: @recall.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_recurring_data(request, options)\r\n request.Set(RocketGate::GatewayRequest::REBILL_FREQUENCY, options[:rebill_frequency])\r\n request.Set(RocketGate::GatewayRequest::REBILL_AMOUNT, options[:rebill_amount])\r\n request.Set(RocketGate::GatewayRequest::REBILL_START, options[:rebill_start... | [
"0.567116",
"0.5559898",
"0.5416588",
"0.5378289",
"0.5366476",
"0.53353304",
"0.53180367",
"0.53179556",
"0.5256255",
"0.5251056",
"0.5249315",
"0.52386236",
"0.52283096",
"0.5218163",
"0.52126366",
"0.5175188",
"0.5168212",
"0.51576376",
"0.5143518",
"0.5136228",
"0.5133309... | 0.47937158 | 45 |
PUT /recalls/1 PUT /recalls/1.json | def update
@recall = Recall.find(params[:id])
respond_to do |format|
if @recall.update_attributes(params[:recall])
format.html { redirect_to [:edit,:admin,@recall], notice: 'Отзыв успешно обновлен.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @recall.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @call.client = ClientPhone.find_by(phone: @call.phone).client\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n ... | [
"0.60012275",
"0.5945652",
"0.5886734",
"0.58492035",
"0.58492035",
"0.58139426",
"0.5797379",
"0.5741457",
"0.5696734",
"0.5659583",
"0.56432074",
"0.5630631",
"0.56258947",
"0.5621301",
"0.5606647",
"0.5606647",
"0.559038",
"0.5585387",
"0.5549207",
"0.5549207",
"0.552842",... | 0.0 | -1 |
DELETE /recalls/1 DELETE /recalls/1.json | def destroy
@recall = Recall.find(params[:id])
@recall.destroy
respond_to do |format|
format.html { redirect_to [:admin,:recalls], notice: 'Отзыв удален.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @request_call = RequestCall.find(params[:id])\n @request_call.destroy\n\n respond_to do |format|\n format.html { redirect_to request_calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond... | [
"0.69294906",
"0.6786529",
"0.6786529",
"0.6786529",
"0.67413723",
"0.6641622",
"0.6641622",
"0.66406643",
"0.66374695",
"0.66075647",
"0.6605652",
"0.6561484",
"0.6560089",
"0.649253",
"0.64900935",
"0.6485749",
"0.6485749",
"0.64713156",
"0.646889",
"0.6465443",
"0.6465443"... | 0.66035855 | 11 |
Create a new comment in the issue rendering an external template. | def respond_external_template(template_file, locals={})
respond render_external_template(template_file, locals)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n load_issue\n @comment = @issue.comments.build(params[:comment]) do |c|\n c.user = current_user\n end\n @comment.save\n respond_with(@comment) do |format|\n format.pjax { render @comment }\n end\n end",
"def create_comment\n\t\tcomment = Comment.new\n\t\tcomment.body = @s... | [
"0.66911435",
"0.66892725",
"0.65592194",
"0.65112907",
"0.64636856",
"0.64276665",
"0.64146155",
"0.63820684",
"0.63687205",
"0.636255",
"0.6335078",
"0.6306947",
"0.6306947",
"0.62925935",
"0.625692",
"0.6249786",
"0.6249786",
"0.6249786",
"0.6236276",
"0.62303686",
"0.6181... | 0.0 | -1 |
Renders an external template using the passed locals | def render_external_template(template_file, locals={})
template = URI.parse(template_url(template_file)).read
apply_hash_to_template(template, locals)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_with(**locals)\n render_with_template(locals: locals)\n end",
"def render_template(view, template, layout_name, locals); end",
"def render_template(context, options); end",
"def render_template_with_locals(abs_name, locals = {})\r\n template = File.read(File.join( abs_name) )\r\n ERB... | [
"0.7993013",
"0.78877896",
"0.7568692",
"0.7486668",
"0.74562806",
"0.7332819",
"0.72803456",
"0.72803456",
"0.7265462",
"0.72120565",
"0.71934414",
"0.7192736",
"0.7023708",
"0.7020327",
"0.6989674",
"0.6969035",
"0.69488275",
"0.693119",
"0.68661773",
"0.68589234",
"0.68481... | 0.7670935 | 2 |
Where the templates are located. | def template_path
@template_path ||= @env[:templates_path] || default_settings[:templates_path]
Pathname.new @template_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def templates_path\n File.join(root, TEMPLATES)\n end",
"def templates_path\n File.join(File.dirname(__FILE__), '..', 'templates')\n end",
"def templates_path\n File.join((File.expand_path '..', File.dirname(__FILE__)), 'templates')\n end",
"def templates_dir\n return File.join(F... | [
"0.8190866",
"0.8016456",
"0.7964577",
"0.79030913",
"0.79030913",
"0.78334534",
"0.7812023",
"0.77700865",
"0.76474524",
"0.7588749",
"0.7524065",
"0.7512357",
"0.74945134",
"0.74911255",
"0.7487216",
"0.73903006",
"0.7385762",
"0.7365441",
"0.73364806",
"0.72795737",
"0.727... | 0.65910167 | 49 |
=> Load details from external services using custom API/gems. | def fetch_details
self.send("fetch_details_from_#{self.provider.downcase}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_services(extension, arg)\n extension += \"/#{arg}\"\n uri = URI.parse(API_URL + extension)\n response = connect(uri)\n puts response.body\n end",
"def get_data_from_api\n # address1 = address.parameterize('+')\n # state1 = state.parameterize('+')\n # city1 = city.parameterize('+'... | [
"0.65115446",
"0.63180023",
"0.61884654",
"0.60842127",
"0.6069616",
"0.6025443",
"0.59824175",
"0.59347755",
"0.590021",
"0.5885379",
"0.5833225",
"0.5820102",
"0.5788335",
"0.5760007",
"0.57578176",
"0.57538146",
"0.5749544",
"0.57312435",
"0.57312435",
"0.5730841",
"0.5720... | 0.5804918 | 12 |
=> Load user details from Facebook | def fetch_details_from_facebook
# graph = Koala::Facebook::API.new(self.token)
# facebook_data = graph.get_object("me")
# self.username = facebook_data['username']
# self.save
# self.user.username = facebook_data['username'] if self.user.username.blank?
# self.user.image = "http://graph.facebook.com/" + self.username + "/picture?type=large" if self.user.image.blank?
# self.user.location = facebook_data['location'] if self.user.location.blank?
# self.user.save
self.user.has_facebook = true
self.user.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grab_info(name)\n\n\n\n\n result = HTTParty.get(\"https://graph.facebook.com/#{name}\")\n\n user_fb = JSON.parse(result)\n\n# id = result[\"id\"]\n# name = result[\"name\"]\n# gender = result[\"gender\"]\n# locale = result[\"locale\"]\n# un = result[\"username\"]\n\nend",
"def fetch_details_from_facebook\n... | [
"0.76831484",
"0.7546079",
"0.73564833",
"0.71045524",
"0.70114267",
"0.69312406",
"0.6915979",
"0.68890977",
"0.68407327",
"0.68138766",
"0.672018",
"0.6714896",
"0.6701292",
"0.66346055",
"0.6629972",
"0.6614527",
"0.6599348",
"0.655154",
"0.6530955",
"0.65033776",
"0.64979... | 0.81430775 | 0 |
=> Load user details from Twitter | def fetch_details_from_twitter
# twitter_object = Twitter::Client.new(
# :oauth_token => self.token,
# :oauth_token_secret => self.secret
# )
# twitter_data = Twitter.user(self.uid.to_i)
# self.username = twitter_data.username
# self.save
# self.user.username = twitter_data.username if self.user.username.blank?
# self.user.image = twitter_data.profile_image_url if self.user.image.blank?
# self.user.location = twitter_data.location if self.user.location.blank?
# self.user.save(:validate => false)
self.user.has_twitter = true
self.user.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_twitter_informations\n unparsed_html = Nokogiri::HTML(open(twitter_profile_address))\n\n self.twitter_username = fetch_twitter_username(unparsed_html)\n self.twitter_description = fetch_twitter_description(unparsed_html)\n end",
"def get_user_from_twitter_as_hash(screen_name_or_... | [
"0.7662446",
"0.7433523",
"0.73351854",
"0.72257066",
"0.71667516",
"0.69871825",
"0.69676465",
"0.69667876",
"0.6830381",
"0.6820844",
"0.6804855",
"0.67905843",
"0.6788494",
"0.6784897",
"0.67757905",
"0.6775429",
"0.6746366",
"0.6729981",
"0.6714724",
"0.6700383",
"0.66995... | 0.81216633 | 0 |
=> Load user details from GitHub | def fetch_details_from_github
# To Do
self.user.has_github = true
self.user.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch!\n github_user = client.user(login)\n\n @name = (github_user['name'] || login) # Fall back to login if no name specified\n @company = github_user['company']\n @email = github_user['email']\n\n github_user\n end",
"def get_data_from_github(id)\n page = Nokog... | [
"0.76056373",
"0.7480208",
"0.71343416",
"0.7055339",
"0.7037423",
"0.7022615",
"0.70083565",
"0.6901157",
"0.67184645",
"0.6682671",
"0.6566647",
"0.6498335",
"0.64597327",
"0.64379394",
"0.63784355",
"0.6377838",
"0.6356296",
"0.63347274",
"0.63313055",
"0.6292231",
"0.6243... | 0.7561229 | 1 |
=> Load user details from LinkedIn | def fetch_details_from_linkedin
# To Do
self.user.has_linkedin = true
self.user.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linkedin_profile\n @network = current_user.network ||= Network.new\n (@network.linkedin.nil? || @network.linkedin.blank?) ? \"\" : @network.linkedin\n end",
"def linkedin\n\t\tprocess_callback\n\t\tauth = request.env[\"omniauth.auth\"]\n session[:signed_in_with] = auth.provider\n\t\tsession[:lin_im... | [
"0.67560947",
"0.66138816",
"0.65369385",
"0.64132136",
"0.6403929",
"0.6319666",
"0.62905455",
"0.621263",
"0.6146846",
"0.6117176",
"0.6046655",
"0.6034665",
"0.6028541",
"0.6027692",
"0.59839314",
"0.5970962",
"0.59577286",
"0.59471494",
"0.5943806",
"0.59388626",
"0.59231... | 0.75067633 | 0 |
=> Load user details from Google Plus | def fetch_details_from_google_oauth2
# To Do
self.user.has_google = true
self.user.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_profile_from_google\n # forthcoming\n end",
"def load_profile(token)\n profile = GoogleService.user_info(token)\n email_field = profile[\"emails\"].select do |email| \n email[\"type\"] == \"account\"\n end\n\n email = email_field[0][\"value\"] if email_field && email_fiel... | [
"0.6828771",
"0.67022216",
"0.65017575",
"0.6485825",
"0.64524746",
"0.64483804",
"0.6256732",
"0.6215875",
"0.6110562",
"0.6103185",
"0.60896564",
"0.6038388",
"0.6015874",
"0.59792376",
"0.59506166",
"0.5949301",
"0.5949201",
"0.59103143",
"0.58790207",
"0.583589",
"0.58295... | 0.7196885 | 0 |
=> Load user details from Dropbox | def fetch_details_from_dropbox_oauth2
# To Do
self.user.has_dropbox = true
self.user.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user(name)\n file = \"#{@@path_to_user_plists}/#{name}.plist\"\n user = NSMutableDictionary.dictionaryWithContentsOfFile(file)\n end",
"def get_user(name)\n @file = \"/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/users/#{name}.plist\"\n NSMutableDictionary.dictionaryWithContentsO... | [
"0.64396983",
"0.64052385",
"0.62990063",
"0.62772024",
"0.6214347",
"0.6188702",
"0.6170385",
"0.6167212",
"0.60668814",
"0.6053577",
"0.60343385",
"0.6020621",
"0.6017606",
"0.6017606",
"0.60033715",
"0.59921306",
"0.5926278",
"0.5887276",
"0.5865386",
"0.58601135",
"0.5859... | 0.7398452 | 0 |
Covers 0.10.8 and earlier | def initialize(*args)
super
@action = :save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def version_mismatch_detected\n end",
"def patch_version; end",
"def target_version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end... | [
"0.67081916",
"0.6101657",
"0.5883818",
"0.5869871",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
... | 0.0 | -1 |
GET /app_environment_credentials GET /app_environment_credentials.json def index | def edit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def environment_credentials\n {\n url: ENV['ONEVIEW_URL'],\n ssl_enabled: ENV['ONEVIEW_SSL_ENABLED'],\n log_level: ENV['ONEVIEW_LOG_LEVEL'] || 'info',\n api_version: ENV['ONEVIEW_API_VERSION'] || 200,\n token: ENV['ONEVIEW_... | [
"0.6691507",
"0.6611046",
"0.64386696",
"0.638843",
"0.62616646",
"0.62159",
"0.6132317",
"0.61314076",
"0.61109257",
"0.60936415",
"0.60778624",
"0.6034152",
"0.603328",
"0.60293156",
"0.60293156",
"0.60202426",
"0.60202426",
"0.60202426",
"0.60202426",
"0.60202426",
"0.6003... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_app_environment_credential
@app_environment_credential = AppEnvironmentCredential.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def app_environment_credential_params
params.require(:app_environment_credential).permit(:credential_id, :app_environment_id, :encrypted_value, :text_value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Login account actions. The ! methods are 'just get the job done'. It's true, they do some testing of their own thus unDRY'ing tests that do and should live in the user account stories but the repetition is ultimately important so that a faulty test setup fails early. | def log_out
get '/sessions/destroy'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n make_login_call\n end",
"def login; end",
"def action_login!()\n @action = TAC_PLUS_AUTHEN_LOGIN\n\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end"... | [
"0.71258557",
"0.71202743",
"0.7120012",
"0.711287",
"0.711287",
"0.711287",
"0.711287",
"0.711287",
"0.711287",
"0.711287",
"0.711287",
"0.711287",
"0.70233953",
"0.7018653",
"0.7018653",
"0.6917435",
"0.6854989",
"0.6783446",
"0.6781806",
"0.67470473",
"0.67378354",
"0.67... | 0.0 | -1 |
I worked on this challenge [by myself]. shortest_string is a method that takes an array of strings as its input and returns the shortest string +list_of_words+ is an array of strings shortest_string(array) should return the shortest string in the +list_of_words+ If +list_of_words+ is empty the method should return nil Your Solution Below | def shortest_string(list_of_words)
if list_of_words[0].nil?
return nil
else
string_length = Hash.new
sorted = Hash.new
list_of_words.each do |words|
string_length[words] = words.length
end
sorted = string_length.sort_by{|x, y| y}
return sorted.first.first
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortest_string(list_of_words)\n if list_of_words.empty?\n return nil\n else\n shortest = list_of_words[0]\n list_of_words.each.to_s do |x|\n if list_of_words.length < shortest\n shortest = x\n end\n end\n end\n return shortest\nend",
"def shortest_string(list_of_words)\n\n#I... | [
"0.8888499",
"0.88468236",
"0.8824444",
"0.88168263",
"0.8797715",
"0.87475526",
"0.8725633",
"0.8715202",
"0.8693984",
"0.8693899",
"0.8674872",
"0.86344963",
"0.8620828",
"0.8613896",
"0.85997814",
"0.85821843",
"0.8577634",
"0.85773295",
"0.8566398",
"0.8507879",
"0.844844... | 0.8006971 | 40 |
AC Accession number (1 per entry) AC T00001 in the case of FACTOR AC M00001 in the case of MATRIX AC R00001 in the case of SITE AC G000001 in the case of GENE AC C00001 in the case of CLASS AC 00001 in the case of CELL | def ac
unless @data['AC']
@data['AC'] = fetch('AC')
end
@data['AC']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aliphatic_index\n aa_map = aa_comp_map\n @aliphatic_index ||= round(aa_map[:A] +\n 2.9 * aa_map[:V] +\n (3.9 * (aa_map[:I] + aa_map[:L])), 2)\n end",
"def amino_acid (bases)\n case bases\n when /^TT[TCY]$/\n ... | [
"0.61729413",
"0.60010636",
"0.59769976",
"0.57690585",
"0.57093006",
"0.570085",
"0.5603868",
"0.557024",
"0.55517805",
"0.5512673",
"0.54792017",
"0.5424732",
"0.54194164",
"0.5395567",
"0.5365008",
"0.5357663",
"0.5346508",
"0.5346019",
"0.5343276",
"0.531822",
"0.5261729"... | 0.61634475 | 1 |
DT Date (1 per entry) DT DD.MM.YYYY (created); ewi. DT DD.MM.YYYY (updated); mpr. | def dt
field_fetch('DT')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date; end",
"def date; end",
"def date; end",
"def date; end",
"def add_date\n @bib.date.each do |d|\n case d.type\n when \"published\"\n @item.year = d.on :year\n month = d.on :month\n @item.month = month if month\n when \"accessed\" t... | [
"0.64901584",
"0.64901584",
"0.64901584",
"0.64901584",
"0.6408105",
"0.6398278",
"0.6334681",
"0.62907463",
"0.6274645",
"0.6241588",
"0.6197172",
"0.6131131",
"0.6110888",
"0.61002123",
"0.6071945",
"0.6035028",
"0.60025036",
"0.59964055",
"0.5996035",
"0.59764814",
"0.5951... | 0.6169319 | 11 |
NA Name of the binding factor | def na
field_fetch('NA')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nilBinding; ProcFactory.new.create.binding end",
"def nonexisting_name\n\t\t\t\treturn self unless self.may_exist?\n\t\t\t\tnew_name(Proc.new {|f| !f.may_exist?}) do |old_name, ind|\n\t\t\t\t\told_name.append_name(\"%02d\" % ind)\n\t\t\t\tend\n\t\t\tend",
"def name\n \"dummy\"\n end",
"def name\n... | [
"0.5598792",
"0.5574257",
"0.5553878",
"0.5454623",
"0.54373753",
"0.5409184",
"0.5382266",
"0.5378362",
"0.536445",
"0.53516304",
"0.534592",
"0.5294941",
"0.5284641",
"0.5239776",
"0.5176041",
"0.5160207",
"0.5159699",
"0.5142772",
"0.51082367",
"0.5091374",
"0.5082392",
... | 0.5278881 | 13 |
DE Short factor description | def de
field_fetch('DE')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def descr_short\n descr = self[:descr].to_s.gsub(\"\\n\", \" \").gsub(/\\s{2,}/, \" \")\n descr = Knj::Strings.shorten(descr, 20)\n #descr = \"[#{_(\"no description\")}]\" if descr.to_s.strip.length <= 0\n return descr\n end",
"def long_description\n return 'invalid' unless self.is_valid?\n ... | [
"0.69538736",
"0.663123",
"0.6589655",
"0.6577291",
"0.65237695",
"0.6517052",
"0.64537776",
"0.6377532",
"0.63733166",
"0.6351722",
"0.6322169",
"0.62699974",
"0.6263901",
"0.6259049",
"0.6247018",
"0.6243944",
"0.62421817",
"0.6206465",
"0.61988264",
"0.6196216",
"0.619103"... | 0.0 | -1 |
BF List of linked factor entries | def bf
field_fetch('bf')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bfs\n\n\n end",
"def bfs\n\n end",
"def factors\n k = 1\n max = Math.sqrt(self).ceil\n lofacs = []\n hifacs = []\n while k <= max.ceil\n if (self.to_f/k) == (self.to_i/k)\n lofacs << k\n hifacs << self/k unless self/k == k\n end\n k += 1\n end\n lofacs ... | [
"0.5981058",
"0.58847076",
"0.55191183",
"0.55093557",
"0.55093557",
"0.55093557",
"0.55093557",
"0.54690695",
"0.544137",
"0.5430159",
"0.5427889",
"0.53939795",
"0.5389247",
"0.5237021",
"0.52076745",
"0.5186634",
"0.5186143",
"0.51566356",
"0.512871",
"0.51270884",
"0.5088... | 0.0 | -1 |
DR Crossreferences to other databases (>=0 per entry) | def dr
field_fetch('DR')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def referencing_databases\n ensure_service!\n\n @grpc.referencing_databases.map do |referencing_database|\n segments = referencing_database.split \"/\"\n database_grpc = service.get_database segments[3], segments[5]\n Database.from_grpc database_grpc, service\n ... | [
"0.6384657",
"0.5922631",
"0.5818222",
"0.5818222",
"0.5795421",
"0.57603663",
"0.572891",
"0.56636584",
"0.5658218",
"0.55373156",
"0.5443452",
"0.5430512",
"0.5425988",
"0.542276",
"0.5421809",
"0.5420887",
"0.53477037",
"0.5316272",
"0.5305135",
"0.5300155",
"0.52511823",
... | 0.0 | -1 |
DR Crossreferences to other databases (>=0 per entry) | def dr
field_fetch('DR')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def referencing_databases\n ensure_service!\n\n @grpc.referencing_databases.map do |referencing_database|\n segments = referencing_database.split \"/\"\n database_grpc = service.get_database segments[3], segments[5]\n Database.from_grpc database_grpc, service\n ... | [
"0.6384657",
"0.5922631",
"0.5818222",
"0.5818222",
"0.5795421",
"0.57603663",
"0.572891",
"0.56636584",
"0.5658218",
"0.55373156",
"0.5443452",
"0.5430512",
"0.5425988",
"0.542276",
"0.5421809",
"0.5420887",
"0.53477037",
"0.5316272",
"0.5305135",
"0.5300155",
"0.52511823",
... | 0.0 | -1 |
CL Classification (class accession no.; class identifier; decimal CL classification number.) | def cl
field_fetch('CL')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classification\n @line1[07]\n end",
"def classify cutoff\n if score >= cutoff\n @classification = :good\n else\n @classification = :bad\n end\n return @classification\n end",
"def classify(text)\n scores = classification_scores(text)\n if scores.any?... | [
"0.7657727",
"0.67104816",
"0.6587297",
"0.6568726",
"0.6568726",
"0.6554412",
"0.64724636",
"0.64724636",
"0.63105464",
"0.6252844",
"0.62512267",
"0.61822873",
"0.61709994",
"0.6152809",
"0.6138507",
"0.6090028",
"0.605185",
"0.6046962",
"0.5996158",
"0.59455645",
"0.594273... | 0.55707365 | 39 |
SZ Size (length (number of amino acids); calculated molecular mass SZ in kDa; experimental molecular mass (or range) in kDa SZ (experimental method) [Ref] | def sz
field_fetch('SZ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mass\n (detail[:area] * material.thickness * material.density / 1000).ceil\n end",
"def profile p_name, p_size\n ## Calculate cross section array from dimensions for PAR\n case p_name\n when \"PAR\"\n case @length_unit\n\t\t\t\twhen 0..1 ## Units are imperial (inches or feet)\n\t\t\t\... | [
"0.57878757",
"0.5575106",
"0.55321246",
"0.5473021",
"0.5440884",
"0.53712577",
"0.5332179",
"0.5320834",
"0.5291731",
"0.52892774",
"0.5284819",
"0.52709997",
"0.52469873",
"0.5224993",
"0.5202173",
"0.5190677",
"0.51842785",
"0.51529473",
"0.51502836",
"0.5143533",
"0.5136... | 0.55306536 | 3 |
SC Sequence comment, i. e. source of the protein sequence | def sc
field_fetch('SC')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_line; end",
"def comment\n cyc.comment(self.to_sym)\n end",
"def source_line=(_); end",
"def comment(string); end",
"def comment(string); end",
"def comment(string); end",
"def comment(string); end",
"def source_line\n @source_location[1]\n end",
"def diagn; \"; Src: #{@curre... | [
"0.64769065",
"0.61717236",
"0.60855395",
"0.6014314",
"0.6014314",
"0.6014314",
"0.6014314",
"0.5999302",
"0.5978063",
"0.58888775",
"0.58888775",
"0.58888775",
"0.58888775",
"0.58388036",
"0.58136594",
"0.57977796",
"0.57977796",
"0.57475305",
"0.57475305",
"0.5735703",
"0.... | 0.0 | -1 |
FT Feature table (1st position last position feature) | def ft
field_fetch('FT')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ft\n\tFancifyTable.new([[1,2],[3,4]])\nend",
"def calculate_feature_vector\n fd = current_domain.dictionary\n fd_ids = fd.keys.sort\n\n @feature_vector = fd_ids.map do |fd_id|\n feature = fd[fd_id]\n @feature_set.member?( feature ) ? 1 : 0 # TODO: TF-IDF here -- Thu Mar 1 19:2... | [
"0.61235964",
"0.5868039",
"0.57629263",
"0.56796837",
"0.5657534",
"0.56091475",
"0.5516785",
"0.5509059",
"0.54901123",
"0.5474284",
"0.5414695",
"0.5407043",
"0.540361",
"0.5379998",
"0.536345",
"0.53607684",
"0.53455347",
"0.53439337",
"0.5325341",
"0.53070337",
"0.530660... | 0.54810774 | 9 |
CP Cell specificity (positive) | def cp
field_fetch('CP')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def x_in_cell?\n\n end",
"def o_in_cell?\n\n end",
"def can_take_value(cell_r,cell_c,num)\n\treturn num_in_row(cell_r, num) && num_in_col(cell_c, num) && num_in_region(cell_r - (cell_r % $n), cell_c - (cell_c % $n), num)\nend",
"def evaluate_cell(board)\n\t\tfind_neighbors(board)\n\t\tunder_population(boar... | [
"0.57638335",
"0.56965137",
"0.5602215",
"0.55586374",
"0.54644156",
"0.54150444",
"0.53387165",
"0.5316762",
"0.53050476",
"0.5286818",
"0.5269541",
"0.52595824",
"0.522739",
"0.5225966",
"0.52237",
"0.51916325",
"0.51887417",
"0.51882714",
"0.5166894",
"0.51664805",
"0.5155... | 0.0 | -1 |
CN Cell specificity (negative) | def cn
field_fetch('CN')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_negative?\n @colt_property.isNonNegative(@colt_matrix)\n end",
"def celebrity; end",
"def celebrity; end",
"def unlabeled?() @positive.nil? end",
"def number_empty_cells_in_own_cube_column\n return 1\n end",
"def valid_nbors board, dims, pos\n nbors( pos, dims ).reject {|i| is_wall(bo... | [
"0.60779554",
"0.5708832",
"0.5708832",
"0.5673291",
"0.56141615",
"0.5582083",
"0.53284425",
"0.5319189",
"0.5275769",
"0.5272517",
"0.5267791",
"0.5251485",
"0.52413523",
"0.52410424",
"0.52369595",
"0.5232148",
"0.52172387",
"0.52024025",
"0.5173192",
"0.5159704",
"0.51532... | 0.0 | -1 |
IN Interacting factors (factor accession no.; factor name; IN biological species.) | def in
field_fetch('IN')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concept_influences\n find_related_frbr_objects( :is_influenced_by, :which_concepts?) \n end",
"def concept_influences\n find_related_frbr_objects( :is_influenced_by, :which_concepts?) \n end",
"def incode\n sector && unit && [sector, unit].join\n end",
"def int_in\n ... | [
"0.53414404",
"0.53414404",
"0.5323444",
"0.530009",
"0.52645695",
"0.52645695",
"0.5184923",
"0.50860536",
"0.50489855",
"0.50379145",
"0.49221203",
"0.4906715",
"0.48363715",
"0.48269582",
"0.4817923",
"0.4801826",
"0.47944573",
"0.47849238",
"0.47837734",
"0.47837734",
"0.... | 0.47195792 | 26 |
MX Matrix (matrix accession no.; matrix identifier) | def mx
field_fetch('MX')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matrix\n end",
"def set_matrix\n @matrix = Matrix.find(params[:id])\n end",
"def set_matrix\n @matrix = Matrix.find(params[:id])\n end",
"def matz; end",
"def get_matrix\n matrix = SnekMath::Matrix.new(area[0].length, area.length, 'empty')\n area.each_with_index do |row, y|\n ro... | [
"0.65508616",
"0.6291915",
"0.62186897",
"0.61988",
"0.61667347",
"0.60984546",
"0.603009",
"0.600114",
"0.59912866",
"0.59662324",
"0.59286",
"0.5911337",
"0.58295506",
"0.5821453",
"0.58063203",
"0.57757026",
"0.5773396",
"0.56515896",
"0.56438845",
"0.56037647",
"0.5546456... | 0.6148335 | 5 |
BS Bound sites (site accession no.; site ID; quality: N; biological BS species) | def bs
field_fetch('BS')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sites; end",
"def sites; end",
"def sites; end",
"def sites; end",
"def sites; end",
"def all_site_details\r\n @nsc.sites\r\n end",
"def bs\n \"#{fetch_sample(BS_PRE)} #{fetch_sample(BS_MID)} #{fetch_sample(BS_POS)}\"\n end",
"def find_protein_binding_sites!(genes)\n if gen... | [
"0.5791628",
"0.5791628",
"0.5791628",
"0.5791628",
"0.5791628",
"0.54099673",
"0.5388314",
"0.53193897",
"0.52722645",
"0.5260862",
"0.5202046",
"0.5182359",
"0.51044023",
"0.50617635",
"0.501173",
"0.501117",
"0.49988052",
"0.49902472",
"0.49749443",
"0.49455792",
"0.493943... | 0.5742659 | 5 |
BF Factors belonging to this class | def bf
field_fetch('BF')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bf\n field_fetch('bf')\n end",
"def bfs\n\n end",
"def faction; end",
"def faction; end",
"def faction; end",
"def bfs\n\n\n end",
"def * f\n result = Factorization.new(@factorbase)\n @factors.each do |b,e|\n result.add(b,e)\n end\n f.factors.each do |b,e|\n result... | [
"0.61245716",
"0.5847045",
"0.5842221",
"0.5842221",
"0.5842221",
"0.5749514",
"0.5730077",
"0.5612473",
"0.5602094",
"0.55718267",
"0.5518438",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53... | 0.62236863 | 0 |
DR PROSITE accession numbers | def dr
field_fetch('DR')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def south_african_trust_registration_number; end",
"def south_african_listed_company_registration_number; end",
"def social_security\n @num = 12345\n end",
"def south_african_pty_ltd_registration_number; end",
"def generate_accessCode\n return ((0..9).to_a + (\"a\"..\"z\").to_a).shuffle[0..5].... | [
"0.6247935",
"0.5839503",
"0.57684594",
"0.5742776",
"0.55309343",
"0.5496852",
"0.54824",
"0.5463048",
"0.5459243",
"0.5455945",
"0.54446405",
"0.54314387",
"0.54140896",
"0.539779",
"0.5333654",
"0.5308027",
"0.5291795",
"0.52478707",
"0.52414477",
"0.5237498",
"0.5215116",... | 0.0 | -1 |
SD Short description/name of the gene | def sd
field_fetch('SD')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def short_description\n description\n end",
"def description\n @sg.description\n end",
"def description\n @sg.description\n end",
"def shortdesc\n @obj['shortdesc']\n end",
"def shortname\n attributes['shortName']\n end",
"def shortdesc\n ... | [
"0.6871859",
"0.67059684",
"0.67059684",
"0.66508013",
"0.6635181",
"0.65627384",
"0.6555399",
"0.65425926",
"0.6536048",
"0.65080106",
"0.65027714",
"0.64793545",
"0.6476851",
"0.6422271",
"0.6399634",
"0.63917613",
"0.6390918",
"0.6358564",
"0.635655",
"0.635655",
"0.635502... | 0.0 | -1 |
BS TRANSFAC SITE positions and accession numbers | def bs
field_fetch('BS')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swedish_organisation_number; end",
"def spanish_citizen_number; end",
"def all_site_details\r\n @nsc.sites\r\n end",
"def site_data; end",
"def st_members \n @st_members = SiteText.second\n end",
"def snv_position_in_site_1_pwm\n if orientation_1 == :direct\n - pos_1\n ... | [
"0.55317426",
"0.5526681",
"0.55208826",
"0.5506148",
"0.5449337",
"0.54483455",
"0.54230267",
"0.54230267",
"0.54230267",
"0.54230267",
"0.54230267",
"0.5302657",
"0.5225737",
"0.52257025",
"0.5176966",
"0.5107558",
"0.510054",
"0.510054",
"0.510054",
"0.50657296",
"0.505006... | 0.0 | -1 |
CO COMPEL accession number | def co
field_fetch('CO')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def an_numeric_component\n @record.eds_accession_number.split('.').last\n end",
"def south_african_close_corporation_registration_number; end",
"def disc_number\n @ole.DiscNumber\n end",
"def company_number\n 1\n end",
"def south_african_listed_company_registration_number; end",
"def ... | [
"0.6884209",
"0.63327724",
"0.6220748",
"0.6083833",
"0.60711426",
"0.6032158",
"0.5969113",
"0.59678364",
"0.5965524",
"0.5863042",
"0.5821906",
"0.57863045",
"0.5776457",
"0.5750504",
"0.5748248",
"0.5744068",
"0.5702035",
"0.56996685",
"0.569783",
"0.56902415",
"0.5679606"... | 0.59875953 | 6 |
TR TRRD accession number | def tr
field_fetch('TR')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rid\n \"rId#{ndx + 1}\"\n end",
"def south_african_pty_ltd_registration_number; end",
"def rnat\n self[:rnat]\n end",
"def rnat\n self[:rnat]\n end",
"def get_trans_id()\n return @RESPONSE_HASH['RRNO']\n end",
"def pty_ltd_registration_number; end",
"def ... | [
"0.607118",
"0.58838135",
"0.56551355",
"0.56551355",
"0.5647259",
"0.563468",
"0.5621219",
"0.5621219",
"0.55628616",
"0.55144817",
"0.5452194",
"0.53832716",
"0.53777003",
"0.53289396",
"0.5310879",
"0.5304047",
"0.52479553",
"0.5246209",
"0.5241327",
"0.5230625",
"0.519171... | 0.0 | -1 |
GET /displays GET /displays.json | def index
@displays = Display.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @display = Display.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @display }\n end\n end",
"def show\n @displays = Display.all\n @names=[]\n @displays.each do |display|\n @names.push display.name\n end\n ... | [
"0.68759215",
"0.65153104",
"0.6434051",
"0.642243",
"0.640952",
"0.634131",
"0.62547076",
"0.6244456",
"0.62403166",
"0.62333804",
"0.62201595",
"0.6198984",
"0.6198984",
"0.61810094",
"0.61743945",
"0.6168888",
"0.6162346",
"0.6162151",
"0.61588985",
"0.6157689",
"0.6157689... | 0.76689947 | 0 |
GET /displays/1 GET /displays/1.json | def show
@templates = SkinTemplate.where(active: true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @displays = Display.all\n end",
"def show\n @display = Display.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @display }\n end\n end",
"def show\n @hardware = Hardware.find(params[:id])\n\n respond_to do |form... | [
"0.7406387",
"0.7049758",
"0.67018",
"0.65529764",
"0.6539569",
"0.6536577",
"0.6519089",
"0.6515544",
"0.64929235",
"0.6418445",
"0.64058226",
"0.64058226",
"0.6384856",
"0.63755006",
"0.637004",
"0.6350795",
"0.63322103",
"0.6331071",
"0.6294739",
"0.6294739",
"0.62918437",... | 0.0 | -1 |
POST /displays POST /displays.json | def create
@display = Display.new(display_params)
screens_num = params[:split_in];
# creamos las screens necesarias
saved = @display.save
create_screens(screens_num)
respond_to do |format|
if saved
format.html {
flash[:success]= 'Display was successfully created.'
redirect_to displays_path
}
format.json { render :show, status: :created, location: @display }
else
format.html { render :new }
format.json { render json: @display.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @displays = Display.all\n end",
"def create\n @display = Display.new(display_params)\n\n respond_to do |format|\n if @display.save\n format.html { redirect_to @display, notice: 'Display was successfully created.' }\n format.json { render :show, status: :created, location:... | [
"0.68363756",
"0.6692318",
"0.6659832",
"0.6213844",
"0.6070459",
"0.606196",
"0.6028984",
"0.5990749",
"0.5957427",
"0.5944486",
"0.58046305",
"0.57835656",
"0.57029563",
"0.56858665",
"0.5659081",
"0.5645538",
"0.5641492",
"0.5513693",
"0.54994106",
"0.5495769",
"0.54893327... | 0.6619302 | 3 |
PATCH/PUT /displays/1 PATCH/PUT /displays/1.json | def update
respond_to do |format|
if @display.update(display_params)
format.html {
flash[:success]= 'Display was successfully updated.'
redirect_to displays_path
}
format.json { render :show, status: :ok, location: @display }
else
format.html { render :edit }
format.json { render json: @display.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @display = Display.find(params[:id])\n\n respond_to do |format|\n if @display.update_attributes(params[:display])\n format.html { redirect_to @display, :notice => 'Display was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render... | [
"0.6690989",
"0.6496534",
"0.6292571",
"0.6181971",
"0.6115013",
"0.60987264",
"0.6069684",
"0.60292166",
"0.602119",
"0.5978606",
"0.59749645",
"0.59725356",
"0.5967943",
"0.5943815",
"0.5939818",
"0.5937225",
"0.5930951",
"0.59201676",
"0.5919893",
"0.591337",
"0.5903632",
... | 0.6203021 | 3 |
DELETE /displays/1 DELETE /displays/1.json | def destroy
@display.destroy
respond_to do |format|
format.html {
redirect_to displays_url
flash[:warning]= 'Display was successfully destroyed.'
}
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @display = Display.find(params[:id])\n @display.destroy\n\n respond_to do |format|\n format.html { redirect_to displays_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @display = Display.find(params[:id])\n @display.destroy\n\n respond_to do |fo... | [
"0.748138",
"0.7295277",
"0.7247227",
"0.6883154",
"0.68739027",
"0.68485904",
"0.6832466",
"0.68199867",
"0.67659575",
"0.67593324",
"0.66454387",
"0.66435814",
"0.66037893",
"0.66037893",
"0.6603657",
"0.66025704",
"0.66011417",
"0.6591571",
"0.65859663",
"0.654852",
"0.654... | 0.68277794 | 7 |
Use callbacks to share common setup or constraints between actions. | def set_display
@display = Display.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def display_params
params.require(:display).permit(:name, :active, :order, :resolution)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69811666",
"0.6782836",
"0.6747644",
"0.6742015",
"0.6735273",
"0.6593917",
"0.65037674",
"0.6498627",
"0.6482372",
"0.64795715",
"0.64566946",
"0.6439213",
"0.6380714",
"0.6378147",
"0.63657266",
"0.63206697",
"0.6300169",
"0.62992156",
"0.6295538",
"0.62943023",
"0.62915... | 0.0 | -1 |
Create a new dispatcher. Must be initialized with an Acoustic::Router object. | def initialize(router)
@router = router
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @router = Router.new(ROUTES)\n end",
"def initialize(dispatcher = Dispatcher.new)\n @dispatcher = dispatcher\n\n yield self if block_given?\n end",
"def setup_router\n self.router = Fastr::Router.new(self)\n self.router.load\n end",
"def initialize(router)\n ... | [
"0.6645551",
"0.6325097",
"0.61795986",
"0.6178408",
"0.6123979",
"0.60822535",
"0.5996235",
"0.5900043",
"0.5629779",
"0.5618047",
"0.5517224",
"0.5487449",
"0.54611844",
"0.54611075",
"0.537196",
"0.53694046",
"0.5297103",
"0.5288517",
"0.5249094",
"0.5211732",
"0.51907396"... | 0.6211882 | 2 |
Service a request and response. Use the router to extract the params from the URL, create the appropriate controller, and had control over to the controller. | def service(request, response)
params = @router.resolve_uri(request.request_uri)
controller = Acoustic::Controller.from_symbol(params[:controller])
action = params[:action]
controller.process(action, params, request, response)
rescue Acoustic::UnresolvableUri, Acoustic::ControllerNameError
raise Acoustic::NotFound.new(request.request_uri)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(req, res)\n # The #run method will figure out what URL was requested, match it to\n # the path regex of one Route object, and finally ask the Route to\n # instantiate the appropriate controller, and call the appropriate method.\n end",
"def run(req, res)\n route_params = self.make_match_hash... | [
"0.7021056",
"0.6921165",
"0.6833926",
"0.6778968",
"0.6777807",
"0.670508",
"0.66774523",
"0.66507787",
"0.6649419",
"0.65485454",
"0.64955187",
"0.6422547",
"0.64106125",
"0.6249101",
"0.62411064",
"0.62276566",
"0.6211158",
"0.6192104",
"0.6154475",
"0.613387",
"0.6078911"... | 0.73800755 | 0 |
Opens container, if possible. Takes care of notifying the player of the result. | def open(event)
player = event[:player]
if @locked
player.output("The #{@generic} is locked.")
elsif @open
player.output("The #{@generic} is already open, silly.")
else
@open = true
room = $manager.find(player.room, nil)
if @name.empty?
player.output "You open #@article #@generic."
room.output "#{player.name} opens #@article #@generic.", player
else
player.output "You open #@name."
room.output "#{player.name} opens #@name.", player
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open\n Common.contain( self )\n self\n end",
"def other_side_opened\n room = $manager.find @container\n @open = true\n room.output \"The #{@generic} opens.\"\n end",
"def open\n @is_running = true\n run_interpreter\n end",
"def run_container\n # find devic... | [
"0.6011619",
"0.5924011",
"0.5833936",
"0.57958317",
"0.564251",
"0.55786717",
"0.55647635",
"0.5563498",
"0.5541097",
"0.55401075",
"0.5494131",
"0.5468679",
"0.5403339",
"0.5397162",
"0.53943634",
"0.53896",
"0.5373252",
"0.536076",
"0.53584313",
"0.5353028",
"0.5353028",
... | 0.48137245 | 80 |
Closes container, if possible. Takes care of notifying the player of the result. | def close(event)
player = event[:player]
if not @open
player.output("The #{@generic} is already closed, silly.")
else
@open = false
room = $manager.find(player.room, nil)
if @name.empty?
player.output "You close #@article #@generic."
room.output "#{player.name} closes #@article #@generic.", player
else
player.output "You close #@name."
room.output "#{player.name} closes #@name.", player
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n\n # nothing to do here.\n end",
"def close\n # no-op\n end",
"def close\n # ..\n end",
"def close\n # NOOP\n end",
"def close\n # NOOP\n end",
"def close\n\t\t\t\t@wrappers.each(&:close)\n\t\t\t\t@wrappers.clear\n\t\t\tend",
"def close\n tagged_r... | [
"0.6503784",
"0.6471342",
"0.6456059",
"0.644419",
"0.644419",
"0.6443244",
"0.643075",
"0.6373326",
"0.63388807",
"0.63354105",
"0.6258919",
"0.6245982",
"0.6232022",
"0.6229963",
"0.62106025",
"0.6206791",
"0.61939436",
"0.61889815",
"0.6179985",
"0.6160607",
"0.61581725",
... | 0.0 | -1 |
Locks the object with the key. Returns true if successful, false otherwise. In this case the key is the GOID of a key. | def lock(key, admin = false)
if @lockable and not @locked and (@keys.include? key or admin)
@locked = true
if self.can? :connected_to
other = $manager.find self.connected_to
other.lock(key, admin) if other.can? :lock
end
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locked? key\n ! ! data(key, LOCKED)\n end",
"def lock(key)\n raise NotImplementedError\n end",
"def lock(group_id) \n synchronize do\n if @@lock_table[group_id].nil?\n @@lock_table[group_id] = group_id\n return true\n end\n false\n end\n end",
"... | [
"0.72280157",
"0.713438",
"0.68065655",
"0.67863727",
"0.67599803",
"0.6741938",
"0.6718068",
"0.6611296",
"0.6575373",
"0.6571031",
"0.6421851",
"0.63809466",
"0.63685924",
"0.6362767",
"0.6344252",
"0.63328576",
"0.6300605",
"0.62975717",
"0.62889814",
"0.62740326",
"0.6262... | 0.6914182 | 2 |
Unlocks the object with the key. Returns true if successful, false otherwise. In this case the key is the GOID of a key. | def unlock(key, admin = false)
if @lockable and @locked and (@keys.include? key or admin)
@locked = false
if self.can? :connected_to
other = $manager.find self.connected_to
other.unlock(key, admin) if other.can? :lock
end
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unlock( actor, silent = false, override = false )\n\t\tif not @locked\n\t\t\tactor.output \"It isn't locked.\" unless silent\n\t\t\treturn false\n\t\telsif actor.items.map(&:id).include?(@key_id) || override\n @reset.activate if @reset\n\t\t\tunless silent\n\t\t\t\tactor.output \"Click.\"\n ... | [
"0.6448773",
"0.6419712",
"0.6261727",
"0.62215286",
"0.6189919",
"0.61527914",
"0.59902537",
"0.59011996",
"0.5878205",
"0.5818054",
"0.58128023",
"0.58097506",
"0.579645",
"0.57958484",
"0.5789584",
"0.576218",
"0.57618964",
"0.5724139",
"0.5675453",
"0.5636322",
"0.5599738... | 0.6755727 | 0 |
This is kind of a retarded method. Always returns true. | def openable?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def semact?; false; end",
"def sharded?; false; end",
"def delicious?\n\t\treturn true\n\tend",
"def success?() end",
"def sharded?; true; end",
"def result?\n false\n end",
"def ordinary?\n raise \"Not implemented yet\"\n end",
"def check ; true ; end",
"def fair?\n !cro... | [
"0.72013676",
"0.7129007",
"0.7043102",
"0.70008",
"0.6931859",
"0.6853353",
"0.6819442",
"0.6819057",
"0.68055046",
"0.68021303",
"0.6704324",
"0.6692726",
"0.6678859",
"0.6655605",
"0.6653647",
"0.66482705",
"0.6647624",
"0.663442",
"0.6616701",
"0.6615145",
"0.659815",
"... | 0.0 | -1 |
True if the object can be locked. | def lockable?
@lockable
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_lock?\n SpaceRequestPolicy.can_lock?(current_user, object)\n end",
"def locked?\n fetch_lock_info\n\n obj_exists_and_is_not_type? obj: @lock_info, type: []\n end",
"def locked?\n end",
"def is_locked?\n locked\n end",
"def locked?\n self.is_locked\n end",
"def locked?\n ... | [
"0.8220008",
"0.80163366",
"0.7982346",
"0.7933893",
"0.7930157",
"0.79217315",
"0.79217315",
"0.79217315",
"0.79217315",
"0.7908445",
"0.78519136",
"0.78116924",
"0.7808527",
"0.7783475",
"0.77413106",
"0.7655804",
"0.7645491",
"0.763787",
"0.7633938",
"0.76041156",
"0.76025... | 0.80853903 | 1 |
True if the object is locked. | def locked?
@locked
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locked?\n fetch_lock_info\n\n obj_exists_and_is_not_type? obj: @lock_info, type: []\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end... | [
"0.8681678",
"0.8646511",
"0.8646511",
"0.8646511",
"0.8646511",
"0.8595943",
"0.85850555",
"0.8562264",
"0.85332197",
"0.8527973",
"0.85113525",
"0.84889686",
"0.8464462",
"0.84326",
"0.8425701",
"0.8419555",
"0.8385267",
"0.8319554",
"0.828247",
"0.82602847",
"0.82023853",
... | 0.85334843 | 8 |
True if the object is open. | def open?
@open
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open?\n @open\n end",
"def open?\n @open\n end",
"def open?\n @open\n end",
"def is_open?\n @open\n end",
"def open?\n @open || true\n end",
"def open?\n @opened\n end",
"def open?\n state == :open\n end",
"def is_open?\n\t\tretu... | [
"0.8794455",
"0.8794455",
"0.8791962",
"0.87609553",
"0.8680179",
"0.86681664",
"0.865297",
"0.86026293",
"0.8579993",
"0.8566668",
"0.85399306",
"0.8437693",
"0.8436428",
"0.83275044",
"0.82854164",
"0.82777876",
"0.820139",
"0.816344",
"0.8130581",
"0.80510694",
"0.8028425"... | 0.8544327 | 10 |
True if the object is closed. | def closed?
not @open
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closed?\n closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n ... | [
"0.86673087",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.86170816",
"0.85870165",
"0.85775566",
"0.8576711",
"0.8567919",
"0.8562257",
"0.85545254"... | 0.7927463 | 48 |
TODO learn best practice with adding assocations | def subcategory_params
params.require(:subcategory).permit(:name, :category_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def associations; end",
"def assoc_options\n # Wait to implement this in Phase IVa. Modify `belongs_to`, too.\n @assoc_options ||= {}\n @assoc_options\n end",
"def setup_associations; end",
"def association(association_name); end",
"def assoc(name)\n associations[name].()\n end",
"d... | [
"0.6769806",
"0.65899664",
"0.6431001",
"0.6397871",
"0.62700313",
"0.6152481",
"0.6142582",
"0.606077",
"0.60355943",
"0.59915054",
"0.596306",
"0.58740455",
"0.58586794",
"0.58487254",
"0.58365333",
"0.58115447",
"0.5730784",
"0.5706652",
"0.5671419",
"0.56619495",
"0.56568... | 0.0 | -1 |
Compares two objects by key. | def <=>(object)
return @key <=> object.key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n key == other.key\n end",
"def ==(other)\n key == other.key\n end",
"def eql?(other)\n key == other.key\n end",
"def eql_when_keys_compared? other\n return true if self.object_id == other.object_id\n return false unless self.class == other.class\n ... | [
"0.70024794",
"0.70024794",
"0.67879623",
"0.6643736",
"0.6495879",
"0.6418652",
"0.6255551",
"0.62264323",
"0.6196548",
"0.6191487",
"0.6180526",
"0.60967046",
"0.6050241",
"0.60467124",
"0.6034101",
"0.60284454",
"0.60017973",
"0.5981955",
"0.59668577",
"0.59129316",
"0.590... | 0.5848417 | 22 |
Gets this object's value. When called with a block, yields the value in chunks as it is read in from the socket. | def value
key_escaped = Object.escape_key(@key)
if block_given?
@s3.request_get("/#{@bucket.name}/#{key_escaped}") do |response|
@s3.error?(response)
response.read_body {|chunk| yield chunk }
end
else
response = @s3.request_get("/#{@bucket.name}/#{key_escaped}")
@s3.error?(response)
return response.body
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read()\n data = @sock.recv(8192)\n return data\n end",
"def value\n @value ||= @block.call\n end",
"def get\n @mutex.synchronize { @value }\n end",
"def value\n return @value if done?\n raise LightIO::Error, 'already used' if @light_fiber\n @light_f... | [
"0.6449273",
"0.633103",
"0.62878954",
"0.626846",
"0.61927986",
"0.61580235",
"0.6120366",
"0.6109555",
"0.60485584",
"0.60113615",
"0.5997681",
"0.59940094",
"0.59673584",
"0.5937367",
"0.5932679",
"0.5902808",
"0.5899798",
"0.58922327",
"0.585376",
"0.5828703",
"0.57225746... | 0.5741931 | 20 |
Sets this object's value. If +new_value+ is an open IO stream, the value will be read from the stream. | def value=(new_value)
key_escaped = Object.escape_key(@key)
response = @s3.request_put("/#{@bucket.name}/" +
"#{key_escaped}", new_value)
@s3.error?(response)
return new_value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value=(new_value)\n validate(new_value)\n @value = parse_value(new_value)\n end",
"def value=(new_value)\n validate(new_value)\n @value = parse_value(new_value)\n end",
"def value=(new_value)\n @value = self.lazy_proc?(new_value) ? new_value : self.coerce(new_valu... | [
"0.73805296",
"0.73805296",
"0.7058884",
"0.69475746",
"0.6752625",
"0.6737067",
"0.6736774",
"0.6735831",
"0.6639714",
"0.64914864",
"0.64288485",
"0.6365661",
"0.6263758",
"0.623329",
"0.623329",
"0.622448",
"0.6152938",
"0.61500716",
"0.61470246",
"0.6119601",
"0.61061615"... | 0.60299474 | 24 |
Returns custom DOM ID | def dom_id
['article', id].join('-')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dom_id\n \"_#{self.object_id}\"\n end",
"def dom_id\n \"#{self.class.name.gsub(/:+/,\"_\")}_#{self.object_id}\"\n end",
"def dom_id\n node['id']\n end",
"def dom_id\n node['id']\n end",
"def dom_id\n node['id']\n end",
"def dom_id\n\t\tnode['id']\n\tend",
"def do... | [
"0.80329716",
"0.796256",
"0.7962211",
"0.7962211",
"0.7850982",
"0.78440744",
"0.7729735",
"0.7729735",
"0.7729735",
"0.7729735",
"0.7686059",
"0.759315",
"0.7581771",
"0.74917203",
"0.7451999",
"0.73669267",
"0.7260476",
"0.72356546",
"0.7172572",
"0.7124794",
"0.71100366",... | 0.69046843 | 26 |
strip to include white space | def cold_shoulder? remark
'' == remark.strip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip(s)\n s.gsub(/^\\s+/, '').gsub(/\\s+$/, '')\n end",
"def strip() end",
"def strip\n lambda do |rec, acc|\n acc.collect! do |v|\n # unicode whitespace class aware\n v.sub(/\\A[[:space:]]+/,'').sub(/[[:space:]]+\\Z/, '')\n end\n end\n ... | [
"0.8197625",
"0.8144433",
"0.8090801",
"0.800083",
"0.7794926",
"0.77044857",
"0.77021885",
"0.76656526",
"0.76491493",
"0.7618722",
"0.7596349",
"0.75830305",
"0.7576805",
"0.7576669",
"0.75612",
"0.75612",
"0.7557862",
"0.746632",
"0.74662894",
"0.7427292",
"0.73818725",
... | 0.0 | -1 |
def user_is_admin? return false if current_user.nil? return true if current_user.has_role?('admin') end | def user_is_track_owner?(track)
return false if current_user.nil?
return true if current_user.has_role?('admin')
current_user.is_track_owner?(track)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin?\n current_user.role.eql?(\"admin\")\n end",
"def admin?\n current_user && current_user.role?(\"admin\")\n end",
"def is_admin\n return current_user.role == User::ADMIN\n end",
"def is_admin?\n current_user && current_user.admin?\n end",
"def is_admin?\n current_user &... | [
"0.9451987",
"0.9422624",
"0.9343366",
"0.934293",
"0.93067676",
"0.9298518",
"0.9260927",
"0.9259483",
"0.9259443",
"0.9252591",
"0.9252501",
"0.92288095",
"0.9227162",
"0.92150295",
"0.9199699",
"0.91962487",
"0.91683704",
"0.91683704",
"0.9167297",
"0.9167297",
"0.9167297"... | 0.0 | -1 |
functions defined after this section are direct ================ Direct Functions START ================ | def index
self.merchants_index_preliminary_actions
self.set_vendor_products
self.set_flash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def internal; end",
"def private; end",
"def probers; end",
"def isolated; end",
"def isolated; end",
"def custom; end",
"def custom; end",
"def functions\n\n end",
"def operations; end",
"def operations; end",
"def who_we_are\r\n end",
"def wrapper; end",
"def external; end",
"def webe... | [
"0.6908098",
"0.6833622",
"0.6710157",
"0.65541476",
"0.65541476",
"0.6428371",
"0.6428371",
"0.639278",
"0.63871497",
"0.63871497",
"0.63785154",
"0.62970275",
"0.6290221",
"0.6262175",
"0.6236859",
"0.62321687",
"0.62071174",
"0.62058884",
"0.6180638",
"0.6180638",
"0.61546... | 0.0 | -1 |
================ Direct Functions END ================ functions defined after this section are auxillary ================ Auxillary Functions START ================ | def merchants_index_preliminary_actions
# This variable is set to make the tab highlighted when its clicked.
@from = "pricelist"
# This method is called from application_controller, this will set the logged_in_login_name instance variable which will always hold the login_name using which the merchant authenticated.
set_logged_in_merchant
if (params[:vendor_id].nil?)
#This method is called from the same file to set the type, vendor and vendor_id instance variables from the current_merchant method called from application_controller which creates a current_merchant instance variable based on the vendor_id mapped to the current login_name and password.
set_type_vendor_vendor_id
else
#This method is called from the same file to set the type, vendor and vendor_id instance variables from the vendor_id chosen by a default vendor from the select drop down menu.
set_type_vendor_vendor_id(params[:vendor_id].to_i)
end
# This method is called from the same file to set the branches select drop down which will display the list of branches for the current vendor.
set_branches(@vendor.first.vendor_name)
# The model_name instance variable will be set by this method from the current_merchant instance variable
self.set_model_name
if(!session[:notifications_count].nil?)
title = "CrawlFish - Merchant Login - Price List"
get_vendor_coupons_count(@vendor_id.to_i,title)
else
@meta_merchant_login_title = 'CrawlFish - Merchant Login - Price List'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def internal; end",
"def custom; end",
"def custom; end",
"def private; end",
"def extra; end",
"def probers; end",
"def external; end",
"def extended(*) end",
"def isolated; end",
"def isolated; end",
"def trd; end",
"def operations; end",
"def operations; end",
"def berlioz; end",
"de... | [
"0.6465548",
"0.6427167",
"0.6427167",
"0.6295827",
"0.6267347",
"0.625292",
"0.62055826",
"0.613279",
"0.6004328",
"0.6004328",
"0.59019345",
"0.5856988",
"0.5856988",
"0.58116364",
"0.578667",
"0.57703054",
"0.5767531",
"0.5765681",
"0.5701749",
"0.5687361",
"0.56785667",
... | 0.0 | -1 |
Updates the updated_at column on all the variants associated with this option value. | def touch_all_variants
variants.find_each(&:touch)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_updated_at\n if able_to_set_updated_at?\n self.updated_at = Time.configured.now unless updated_at_changed?\n end\n\n clear_timeless_option\n end",
"def set_updated!\n @updated_at = Time.now\n end",
"def _update_timestamps\n if self.respond_to?('updated_... | [
"0.65122306",
"0.63043356",
"0.6237301",
"0.6066347",
"0.6012204",
"0.6001508",
"0.6001508",
"0.5990792",
"0.5951579",
"0.59422266",
"0.58961415",
"0.5848873",
"0.56863946",
"0.5604782",
"0.56018734",
"0.5587947",
"0.55159944",
"0.5379126",
"0.5367201",
"0.5360474",
"0.534884... | 0.5068947 | 38 |
defines methods x, y, x=, y= | def initialize(x,y)
@x = x
@y = y
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize x, y\n\t\t@x = x\n\t\t@y = y\n\tend",
"def initialize(x,y) # defines an instance method for the class\n @x, @y = x, y # Take the two parameters passed, => assign them to instance variables @x @y\n end",
"def set_x_y(x,y)\r\n @x=x\r\n @y=y\r\n self\r\n end",
... | [
"0.6847129",
"0.6746982",
"0.67251253",
"0.6682827",
"0.6637733",
"0.66010237",
"0.65911776",
"0.6588873",
"0.6579011",
"0.6572358",
"0.6572358",
"0.6553997",
"0.6515704",
"0.65123075",
"0.6511823",
"0.6495369",
"0.6493831",
"0.644357",
"0.6440991",
"0.6440991",
"0.6440991",
... | 0.63205796 | 35 |
defines methods color, color= | def initialize(x,y,c="clear")
super(x,y) # keyword super calls same method in superclass
@color = c
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_methods; end",
"def color; end",
"def color; end",
"def color; end",
"def colors; end",
"def color(color); end",
"def color_methods\n colors.each do |key|\n next if key == :default\n\n define_method key do\n colorize(:color => key)\n end\n\n define_me... | [
"0.8357488",
"0.83423615",
"0.83423615",
"0.83423615",
"0.81691134",
"0.80981016",
"0.77449095",
"0.7569002",
"0.7503601",
"0.7503601",
"0.74650836",
"0.74402696",
"0.74153674",
"0.74153674",
"0.7304448",
"0.72640103",
"0.72640103",
"0.72636724",
"0.7251018",
"0.72441584",
"0... | 0.0 | -1 |
Creates a new task with name +name+. | def initialize(name)
@name = name
@options = {}
yield self if block_given?
define
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(_obj, args, _ctx)\n Task.create!(\n name: args[:name],\n description: args[:description]\n )\n end",
"def task name, options={}, &block\n task = Task.new name, options, &block\n TodoRunner.registry[name] = task\n end",
"def create_task name, url, cron, enabled = nil, time... | [
"0.7285603",
"0.7219194",
"0.7155665",
"0.70825505",
"0.69806194",
"0.6889819",
"0.68816435",
"0.68630683",
"0.6848598",
"0.67115927",
"0.6694039",
"0.66352665",
"0.66230094",
"0.6620601",
"0.6573416",
"0.65412354",
"0.653079",
"0.65093917",
"0.65093917",
"0.6495483",
"0.6484... | 0.0 | -1 |
fibonacci series: 0 1 1 2 3 5 8 13 21 ... e.g. 0th fibonacci number is 0 e.g. 1st fibonacci number is 1 .... e.g. 6th fibonacci number is 8 | def fibonacci(n)
return 0 if n == 0
if n == nil
raise ArgumentError.new("Nil object is not an integer")
end
if n < 0
raise ArgumentError.new("Negative input")
end
return 1 if n == 1
k = 0
j = 1
i = 2
result = 0
while i <= n
result = k + j
k = j
j = result
i += 1
end
return j
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fibinacci(number)\n fibinacci_series = [1,1]\n index = 2\n while index <= (number-1)\n fibinacci_series[index] = fibinacci_series[index - 1] + fibinacci_series[index - 2]\n index = index + 1\n end\n return fibinacci_series\nend",
"def fibonacci(how_many_numbers)\n fibonacci_sequence = []\n count... | [
"0.82578814",
"0.817861",
"0.8171225",
"0.81679255",
"0.8152787",
"0.8117557",
"0.8115754",
"0.8089277",
"0.80868137",
"0.806834",
"0.8060022",
"0.8044851",
"0.80428267",
"0.80332655",
"0.8028445",
"0.7977023",
"0.795287",
"0.793297",
"0.79304934",
"0.79237646",
"0.79113305",... | 0.0 | -1 |
identify if document is flagged to be encrypted | def mustBeEncrypted?
return false if @conf["gpg::encrypt"].nil? or @conf["gpg::encrypt"] != TRUE
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypted?\r\n if @encrypted\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def signed_or_encrypted; end",
"def xml_authorized?\n self.documento.digital == true\n end",
"def authorized?(encrypted_string)\n\n \tend",
"def is_encrypted\n ... | [
"0.63967687",
"0.63851815",
"0.63544494",
"0.6336276",
"0.6270608",
"0.6244641",
"0.602539",
"0.59576845",
"0.5910024",
"0.590356",
"0.5861356",
"0.5803271",
"0.5757316",
"0.57561487",
"0.57331526",
"0.5727445",
"0.57183105",
"0.57073677",
"0.56989354",
"0.5691105",
"0.560858... | 0.0 | -1 |
Read optional file parameters | def ReadConfig()
# Deep copy
puts "Reading global config file #{$conf[:globalConfFile]}" if $verbose
conf = Marshal.load( Marshal.dump($conf) )
optfile = @ConfFile
conf["conffile"] = optfile
conf["filename"] = @filename
conf["dir"] = @dir
if File.exists?(optfile)
begin
puts "Reading specific config file #{optfile}" if $verbose
c = YAML.load_file(optfile)
raise "Invalid yaml file" if not c
# surcharge d'options
$sections.each {|s|
next if c[s].nil?
if c[s].class == Array
if $sections_uniq.include?(s)
# remove then add option
c[s].each {|o|
o2 = o.gsub(/=.*/, "=")
conf[s].delete_if {|o3| o3.start_with?(o2)}
conf[s].push o
}
else
c[s].each {|o|
if o[0] == "!"
# delete option
conf[s].delete o[1..-1]
else
# just add option
conf[s].push o
end
}
end
else
conf[s] = c[s]
end
}
rescue
puts "Error loading #{optfile}"
end
else
puts "Skip loading unknown specific config file #{optfile}" if $verbose
end
conf.each {|k,v|
if v.class == Array
conf[k].each_index {|i|
conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String
conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String
conf[k][i].gsub!(/%D/, @dir) if conf[k][i].class == String
}
else
conf[k].gsub!(/%B/, $basedir) if conf[k].class == String
conf[k].gsub!(/%b/, $confdir) if conf[k].class == String
conf[k].gsub!(/%D/, @dir) if conf[k].class == String
end
}
return conf
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_read_opts=(_arg0); end",
"def file_read_opts(context); end",
"def file_read_opts; end",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_f... | [
"0.7366005",
"0.7128029",
"0.70349675",
"0.68255615",
"0.68255615",
"0.68255615",
"0.6507255",
"0.6485177",
"0.6241533",
"0.6130209",
"0.6129557",
"0.6106181",
"0.60776764",
"0.6007821",
"0.59721625",
"0.59683573",
"0.5957129",
"0.5916238",
"0.5912605",
"0.59120184",
"0.58973... | 0.0 | -1 |
Need to regenerate output file ? | def convertNeed?
# List of dependences
srcfiles = [ "-revhistory.xml" ]
return true if not File.exists?(@outfile)
if @doc.encrypted?
filename = @doc.filename_ori
else
filename = @doc.filename
end
return true if File.mtime(filename) > File.mtime(@outfile)
return true if File.exists?($conf[:globalConfFile]) and File.mtime($conf[:globalConfFile]) > File.mtime(@outfile)
return true if File.exists?(@ConfFile) and File.mtime(@ConfFile) > File.mtime(@outfile)
srcfiles.each {|s|
f = @doc.filename.gsub(@doc.extname, s)
return true if File.exists?(f) and File.mtime(f) > File.mtime(@outfile)
}
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_path; end",
"def regenerate\n generate\n end",
"def generate; end",
"def generate; end",
"def write_file\n \n # if dirty?\n generate\n \n delete_file\n File.open(absolute_path.gsub(/\\.txt$/, \"\"), 'w+') do |f| \n f.write(generated_header)\n f.wri... | [
"0.68445474",
"0.6728632",
"0.6603393",
"0.6603393",
"0.65471137",
"0.6546071",
"0.6490662",
"0.6461581",
"0.6439944",
"0.6383751",
"0.63793933",
"0.6372324",
"0.6332653",
"0.63266903",
"0.63127595",
"0.63036895",
"0.63002634",
"0.63002634",
"0.62623596",
"0.62588036",
"0.623... | 0.0 | -1 |
Convert using a2x tool | def ConvertA2X
# a2x options
if not @FullOpts.nil?
opts = @FullOpts + " "
else
opts = self.getOptionsA2X()
end
opts += @Opts + " " if not @Opts.nil?
opts += "-v " if $debug2
# Execute pre actions
self.ExecuteAction(:pre)
cmd = "a2x -D #{@outdir} #{opts} #{@doc.filename}"
puts "Generating (#{@Type}) #{@outfile}\n"
puts "Executing : #{cmd}" if $verbose
res = %x[#{cmd}]
puts res if res != ""
if $? == 0
# Execute post actions
self.ExecuteAction(:post)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert\n end",
"def convert\n end",
"def convert_one(*args)\n raise \"x2t file is not found in #{@bin_path} path\" unless x2t_exist?\n output_file_path = \"#{@convert_to}/#{File.basename(args.first[:input_file], '.*')}.\" + args.first[:format_to]\n convert_file(args.first[:input_file], outp... | [
"0.6633204",
"0.6633204",
"0.6587361",
"0.62261814",
"0.61679804",
"0.6020692",
"0.59798896",
"0.59233826",
"0.5895836",
"0.5842984",
"0.57885265",
"0.57435685",
"0.56970567",
"0.56860423",
"0.5643551",
"0.56189805",
"0.5618606",
"0.5618606",
"0.5618606",
"0.55961764",
"0.559... | 0.8192635 | 0 |
Convert using asciidoc tool | def ConvertASCIIDOC
# asciidoc options
if not @FullOpts.nil?
opts = @FullOpts + " "
else
opts = self.getOptionsAsciidoc()
end
opts += @Opts + " " if not @Opts.nil?
opts += "-v " if $debug2
# Execute pre actions
self.ExecuteAction(:pre)
cmd = "asciidoc -o #{@outfile} #{opts} #{@doc.filename}"
puts "Generating (#{@Type}) #{@outfile}\n"
puts "Executing : #{cmd}" if $verbose
res = %x[#{cmd}]
puts res if res != ""
if $? == 0
# Execute post actions
self.ExecuteAction(:post)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_markup_asciidoc(text); end",
"def asciidoc(src, target, *args)\n attributes =\n if args.last.is_a?(Hash)\n args.pop\n else\n {}\n end\n attributes = { :linkcss => '' }.merge(attributes)\n doing :adoc, target\n args = %W[asciidoc --unsafe -o #{target}] + args +\n attributes... | [
"0.75268734",
"0.65174544",
"0.6423313",
"0.64173126",
"0.6245098",
"0.62437594",
"0.61786664",
"0.6177511",
"0.6145682",
"0.6139285",
"0.61370325",
"0.61037457",
"0.6053269",
"0.60519683",
"0.6040036",
"0.6006332",
"0.60004133",
"0.59812474",
"0.597234",
"0.5968544",
"0.5938... | 0.81373525 | 0 |
Read optional file parameters | def ReadConfig()
# Deep copy
puts "Reading global config file #{$conf[:globalConfFile]}" if $verbose
conf = Marshal.load( Marshal.dump($conf) )
if @ConfFile.nil?
return conf
end
optfile = @ConfFile
optfile = optfile.gsub(/%f/, @doc.filename)
optfile = optfile.gsub(/%F/, @doc.file)
optfile = optfile.gsub(/%D/, @doc.dir)
optfile = optfile.gsub(/%E/, @doc.extname)
optfile = optfile.gsub(/%R/, @doc.dir + "/" + @doc.file.gsub(@doc.extname, ""))
optfile = optfile.gsub(/%r/, @doc.file.gsub(@doc.extname, ""))
optfile = optfile.gsub(/%t/, @Type)
optfile = optfile.gsub(/%B/, $basedir)
optfile = optfile.gsub(/%b/, $confdir)
conf["conffile"] = optfile
conf["filename"] = @doc.filename
conf["dir"] = @doc.dir
if File.exists?(optfile)
begin
puts "Reading specific config file #{optfile}" if $verbose
c = YAML.load_file(optfile)
raise "Invalid yaml file" if not c
# surcharge d'options
$sections.each {|s|
next if c[s].nil?
if c[s].class == Array
if $sections_uniq.include?(s)
# remove then add option
c[s].each {|o|
o2 = o.gsub(/=.*/, "=")
conf[s].delete_if {|o3| o3.start_with?(o2)}
conf[s].push o
}
else
c[s].each {|o|
if o[0] == "!"
# delete option
conf[s].delete o[1..-1]
else
# just add option
conf[s].push o
end
}
end
else
conf[s] = c[s]
end
}
rescue
puts "Error loading #{optfile}"
end
else
puts "Skip loading unknown specific config file #{optfile}" if $verbose
end
conf.each {|k,v|
if v.class == Array
conf[k].each_index {|i|
conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String
conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String
conf[k][i].gsub!(/%D/, @doc.dir) if conf[k][i].class == String
}
else
conf[k].gsub!(/%B/, $basedir) if conf[k].class == String
conf[k].gsub!(/%b/, $confdir) if conf[k].class == String
conf[k].gsub!(/%D/, @doc.dir) if conf[k].class == String
end
}
return conf
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_read_opts=(_arg0); end",
"def file_read_opts(context); end",
"def file_read_opts; end",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_f... | [
"0.7366005",
"0.7128029",
"0.70349675",
"0.68255615",
"0.68255615",
"0.68255615",
"0.6507255",
"0.6485177",
"0.6241533",
"0.6130209",
"0.6129557",
"0.6106181",
"0.60776764",
"0.6007821",
"0.59721625",
"0.59683573",
"0.5957129",
"0.5916238",
"0.5912605",
"0.59120184",
"0.58973... | 0.0 | -1 |
Read optional file parameters | def ReadGlobalConfig()
# Load config file
begin
conf = YAML.load_file("#{$confdir}/#{$globalConfFile}")
rescue
puts "Unable to locate #{$confdir}/#{$globalConfFile}"
conf = {}
end
Dir.glob("#{$confdir}/#{$globalConfDir}/*.yaml") {|f|
begin
conf.merge!(YAML.load_file(f))
rescue
puts "Unable to locate #{f}"
conf = {}
end
}
$sections.each {|o|
conf[o] = [] if conf[o].nil?
}
conf[:globalConfFile] = "#{$confdir}/#{$globalConfFile}"
conf[:globalConfDir] = "#{$confdir}/#{$globalConfDir}"
altConfFile = "#{$curdir}/.rake/#{$globalConfFile}"
if File.exists?(altConfFile)
begin
puts "Reading local config file #{altConfFile}" if $verbose
c = YAML.load_file(altConfFile)
raise "Invalid yaml file" if not c
# surcharge d'options
$sections.each {|s|
next if c[s].nil?
if $sections_uniq.include?(s)
# remove then add option
c[s].each {|o|
o2 = o.gsub(/=.*/, "=")
conf[s].delete_if {|o3| o3.start_with?(o2)}
conf[s].push o
}
else
c[s].each {|o|
if o[0] == "!"
# delete option
conf[s].delete o[1..-1]
else
# just add option
conf[s].push o
end
}
end
}
rescue
puts "Error loading #{altConfFile}"
end
end
conf.each {|k,v|
if v.class == Array
conf[k].each_index {|i|
conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String
conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String
}
else
conf[k].gsub!(/%B/, $basedir) if conf[k].class == String
conf[k].gsub!(/%b/, $confdir) if conf[k].class == String
end
}
return conf
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_read_opts=(_arg0); end",
"def file_read_opts(context); end",
"def file_read_opts; end",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_f... | [
"0.7366005",
"0.7128029",
"0.70349675",
"0.68255615",
"0.68255615",
"0.68255615",
"0.6507255",
"0.6485177",
"0.6241533",
"0.6130209",
"0.6129557",
"0.6106181",
"0.60776764",
"0.6007821",
"0.59721625",
"0.59683573",
"0.5957129",
"0.5916238",
"0.5912605",
"0.59120184",
"0.58973... | 0.0 | -1 |
def missing_number(section) if possibilites(section) == 1 numbers.each do |number| if row.include?(number) == false fill_cell(number) end end end end def fill_cell(number, index) end | def row(dash_index)
row = []
@board_array.each_with_index do |number, index|
if index % 9 == dash_index
row << number
end
end
row
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_number_into_each_blank\n SudokuUtils.LoopPuzzle do |row, col|\n if self[row, col].is_a? Element\n if self[row, col].possibleNumbers.count == 1\n insert_number_into_blank(row, col, self[row, col].possibleNumbers[0])\n elsif self[row, col].relativeNumbers.count == 1\n ... | [
"0.6944222",
"0.64589316",
"0.6368105",
"0.6282497",
"0.6252968",
"0.6201066",
"0.6073232",
"0.6051671",
"0.6030695",
"0.6020522",
"0.60204893",
"0.6014079",
"0.60006046",
"0.5987056",
"0.5949613",
"0.590761",
"0.5903598",
"0.589869",
"0.58715475",
"0.58403075",
"0.5808087",
... | 0.0 | -1 |
def video_title video.title end Todo: Fixme: It should use the average value Virtual attribute for activerecord model | def rating
# review = Review.where(user_id: user.id, video_id: video.id).first
#review = Review.find_by(user_id: user.id, video_id: video.id)
review.rating if review
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def video_title\n if video\n video.title\n end\n end",
"def title\n \tobject.movie_name\n end",
"def episode_title; end",
"def movie_name\n self.movie.name\n \n end",
"def to_s\n movie_title\n end",
"def title\n if @title == nil\n \"Movie not found!\"\n e... | [
"0.7161962",
"0.6542916",
"0.6377608",
"0.6122962",
"0.6107751",
"0.60009605",
"0.5999953",
"0.59255517",
"0.59152013",
"0.58809936",
"0.5854644",
"0.58347714",
"0.5828151",
"0.5817354",
"0.5801279",
"0.5801279",
"0.5789752",
"0.5788244",
"0.5781102",
"0.57787293",
"0.5769678... | 0.0 | -1 |
Virtual attribute for activerecord model | def rating=(new_rating)
#review = Review.find_by(user_id: user.id, video_id: video.id)
if review
# In Rails4 update_columns is preffered than update_column
# update_columns will bypass the validation
review.update_columns(rating: new_rating)
#review.update(rating: new_rating)
else
review = Review.new(user: user, video: video, rating: new_rating)
review.save(validate: false)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_for_attribute(name)\n if self.class._has_virtual_column?(name)\n return VirtualColumnWrapper.new(singleton_class._virtual_column(name))\n else\n super\n end\n end",
"def virtual; end",
"def has_attribute?(name)\n return true if self.class._has_virtual_column?(name)\n return... | [
"0.68646145",
"0.66638243",
"0.65532595",
"0.64089715",
"0.63227123",
"0.63227123",
"0.63227123",
"0.63227123",
"0.63227123",
"0.63227123",
"0.63227123",
"0.6206445",
"0.6155087",
"0.60419816",
"0.6022984",
"0.6018529",
"0.5959158",
"0.59561074",
"0.5950973",
"0.5938468",
"0.... | 0.0 | -1 |
existing auth with this provider found by Authorization.find_from_oauth; so we just update. | def update_tokens(oauth_params)
# binding.pry
self.oauth_token = oauth_params.credentials.token
# facebook, google provide this; twitter, linkedin don't
self.oauth_expires_at = Time.at(oauth_params.credentials.expires_at) if oauth_params.credentials.expires_at
# twitter
self.oauth_secret = oauth_params.credentials.secret if oauth_params.credentials.secret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @auth_provider = args[:auth_provider] if args.key?(:auth_provider)\n end",
"def update_from_auth_hash(auth_hash)\n update_account_info auth_hash['info']\n update_oauth_credentials auth_hash['credentials']\n self\n end",
"def update_from_provider!(auth)\n last_... | [
"0.7412766",
"0.6756025",
"0.6505242",
"0.6399501",
"0.6388465",
"0.6273595",
"0.6273595",
"0.6235391",
"0.6221958",
"0.6156656",
"0.60747486",
"0.60666245",
"0.59963024",
"0.5971927",
"0.5961947",
"0.59553516",
"0.5939227",
"0.59244466",
"0.589061",
"0.5885361",
"0.58574307"... | 0.5777884 | 25 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.