query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Get tags for a learnerId Returns the tags for the learner. | def get_learner_tags(learner_id, opts = {})
data, _status_code, _headers = get_learner_tags_with_http_info(learner_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_learner_tags_with_http_info(learner_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LearnerApi.get_learner_tags ...'\n end\n # verify the required parameter 'learner_id' is set\n if learner_id.nil?\n fail ArgumentError, \"Mi... | [
"0.69842875",
"0.6062941",
"0.57755655",
"0.5678672",
"0.56636274",
"0.5564169",
"0.5475757",
"0.5461756",
"0.5364569",
"0.53527546",
"0.5330336",
"0.5308702",
"0.52873755",
"0.5258057",
"0.51945895",
"0.51871836",
"0.5174344",
"0.5173385",
"0.5168488",
"0.51611286",
"0.51400... | 0.77817595 | 0 |
Get tags for a learnerId Returns the tags for the learner. | def get_learner_tags_with_http_info(learner_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: LearnerApi.get_learner_tags ...'
end
# verify the required parameter 'learner_id' is set
if learner_id.nil?
fail ArgumentError, "Missing the re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_learner_tags(learner_id, opts = {})\n data, _status_code, _headers = get_learner_tags_with_http_info(learner_id, opts)\n data\n end",
"def tags(id)\n wf_event_id?(id)\n api.get([id, 'tag'].uri_concat)\n end",
"def get_tags() tag_ids.inject([]) { |l, tag_id| l << get_tag_from_i... | [
"0.7780954",
"0.6063932",
"0.57759875",
"0.5679213",
"0.56640935",
"0.55624074",
"0.54744405",
"0.54619765",
"0.5362401",
"0.53517246",
"0.53289205",
"0.53091896",
"0.5286628",
"0.5259362",
"0.51934767",
"0.51869255",
"0.5173127",
"0.51716137",
"0.5168834",
"0.5159145",
"0.51... | 0.6983886 | 1 |
Add tags to a learnerId Applies the provided tags to the learner. Tags are used to easily identify resources. Adding tags can enable more refined searches when working with Reportage. | def put_learner_tags_with_http_info(learner_id, tags, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: LearnerApi.put_learner_tags ...'
end
# verify the required parameter 'learner_id' is set
if learner_id.nil?
fail ArgumentError, "Missing ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag_set(id, tags)\n wf_event_id?(id)\n tags = Array(tags)\n tags.each { |t| wf_string?(t) }\n api.post([id, 'tag'].uri_concat, tags, 'application/json')\n end",
"def add_tags(identifier, body, opts = {})\n data, _status_code, _headers = add_tags_with_http_info(identifier, body, op... | [
"0.6189396",
"0.616149",
"0.61430943",
"0.61398804",
"0.6074406",
"0.6052473",
"0.60377675",
"0.59927666",
"0.5913662",
"0.5911392",
"0.5891772",
"0.5817213",
"0.57640666",
"0.5760433",
"0.5760182",
"0.5739501",
"0.57312053",
"0.5716421",
"0.568512",
"0.5667906",
"0.56672174"... | 0.6756875 | 0 |
It's important to regularly remove devices that Apple reports as stale. If you continue to try to notify stale devices, Apple may revoke your access to APNS! | def deactivate_stale_devices!
device_tokens = client.devices
Rails.logger.info "Found #{device_tokens.length} stale devices."
device_tokens.each do |device_token|
Rails.logger.debug("deactivating device with token: #{device_token}")
devices = Device.where(notification_token: device_token)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_missing\n sync do\n devices.delete_if do |dev|\n pdev = ct.group.devices.get(dev)\n pdev.nil? || !pdev.mode.compatible?(dev.mode)\n end\n end\n end",
"def unregister\n puts \"APN::Device.unregister\"\n http_delete(\"/api/device_tokens/#{self.token}\")... | [
"0.6417499",
"0.63291705",
"0.62556666",
"0.6030259",
"0.59357595",
"0.57524586",
"0.5739295",
"0.5736351",
"0.5708673",
"0.5685973",
"0.5676474",
"0.5599496",
"0.557151",
"0.5534465",
"0.55253124",
"0.55242914",
"0.549664",
"0.5493139",
"0.54486626",
"0.54191595",
"0.5409406... | 0.6870319 | 0 |
GET /categorias/1 GET /categorias/1.json | def show
render json: @categoria
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @categoria }\n end\n end",
"def show\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ... | [
"0.77424973",
"0.7667131",
"0.75771433",
"0.7529609",
"0.7493106",
"0.74652046",
"0.72957826",
"0.72778887",
"0.72754854",
"0.70459354",
"0.6998477",
"0.69755214",
"0.6969114",
"0.6952852",
"0.69030017",
"0.68909496",
"0.6877623",
"0.68637633",
"0.6814066",
"0.6797523",
"0.67... | 0.7887554 | 0 |
POST /categorias POST /categorias.json | def create
@categoria = Categoria.new(categoria_params)
if @categoria.save
render json: @categoria
else
render json: @categoria.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n if params[:categoria_producto]\n p = Producto.find(params[:producto_id])\n c = Categoria.find(params[:categoria_id])\n\n if p.categorias << c\n render json: c, status: :created\n else\n render json: {:errors => {categoria: [\"No se ha podido agregar categoria\"]}},... | [
"0.74540937",
"0.73545885",
"0.71821916",
"0.7063484",
"0.70269084",
"0.6978074",
"0.6972654",
"0.6964912",
"0.6888522",
"0.6874212",
"0.6766149",
"0.6739463",
"0.6730424",
"0.6675526",
"0.66747445",
"0.6671698",
"0.66611403",
"0.6654375",
"0.66212916",
"0.6536164",
"0.653145... | 0.7745614 | 0 |
PATCH/PUT /categorias/1 PATCH/PUT /categorias/1.json | def update
if @categoria.update(categoria_params)
render json: @categoria
else
render json: @categoria.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n if @categoria.update_attributes(params[:categoria])\n format.html { redirect_to [:admin, @categoria], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.h... | [
"0.6960239",
"0.69292897",
"0.69081634",
"0.6875341",
"0.6843645",
"0.6822764",
"0.6810402",
"0.67256373",
"0.6724895",
"0.6723475",
"0.6630628",
"0.65831226",
"0.64941436",
"0.6484316",
"0.6408087",
"0.64013296",
"0.63994426",
"0.6397613",
"0.6388647",
"0.6386823",
"0.637302... | 0.71914697 | 0 |
A functional group of related transaction sets, within the scope of X12 standards, consists of a collection of similar transaction sets enclosed by a functional group header and a functional group trailer | def functional_group_loop
[functional_group_header, transactions, functional_group_trailer(@batch.id)].compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def functional_group_loop\n segments = []\n segments << functional_group_header\n segments << transactions\n segments << functional_group_trailer(nil)\n segments = segments.compact\n segments\n end",
"def functional_group_loop\n segments = []\n batchids.each do |batch_id|\n Output83... | [
"0.70272624",
"0.6431121",
"0.5928883",
"0.58905935",
"0.5791267",
"0.57008934",
"0.5653576",
"0.5243517",
"0.51896995",
"0.51050967",
"0.5100749",
"0.5083472",
"0.5073232",
"0.5055131",
"0.49966165",
"0.49822393",
"0.49718705",
"0.4963298",
"0.4963298",
"0.4963298",
"0.49457... | 0.68605167 | 1 |
Generating check level segments | def generate_check
Output835.log.info "\n\nCheck number : #{@check.check_number} undergoing processing"
transaction_segments =[ transaction_set_header, financial_info, reassociation_trace]
transaction_segments << ref_ev_loop if @facility_output_config.details[:ref_ev_batchid]
transaction_segments += [r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transactions\n segments = []\n batch_based_index = 0\n\n check_klass = Output835.class_for(\"Check\", facility)\n Output835.log.info \"Applying class #{check_klass}\"\n check_op = check_klass.new(nil, facility, 0, @element_seperator, @check_eob_hash)\n check_op.instance_variable_set(\"@plb_ex... | [
"0.6078815",
"0.554194",
"0.5534386",
"0.5471448",
"0.5446783",
"0.543605",
"0.53607666",
"0.5295136",
"0.5241401",
"0.5231374",
"0.5218446",
"0.5162566",
"0.51621455",
"0.51324904",
"0.5104028",
"0.5066837",
"0.505797",
"0.50529706",
"0.50168824",
"0.50092334",
"0.4997686",
... | 0.66065955 | 0 |
The TRN segment is used to uniquely identify a claim payment and advice. | def reassociation_trace
simple_client_array_for_1000000009 = ["NAVICURE", "ASCEND CLINICAL LLC"]
trn_elements = ['TRN', '1', ref_number]
if simple_client_array_for_1000000009.include? (@client_name)
trn_elements << '1000000009'
elsif @check_amount.to_f > 0 && @check.payment_method == "EFT"
t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reassociation_trace\n trn_elements = ['TRN', '1', ref_number]\n if @check_amount.to_f > 0 && @check.payment_method == \"EFT\"\n trn_elements << '1' + @facility.facility_tin if @facility.facility_tin.present?\n else\n trn_elements << '1999999999'\n end\n trn_elements.join(@element_sep... | [
"0.52943814",
"0.52118546",
"0.5184797",
"0.5149168",
"0.51062495",
"0.50990087",
"0.4833568",
"0.4832205",
"0.48219177",
"0.48013112",
"0.4788337",
"0.4769391",
"0.47535005",
"0.47455162",
"0.47307733",
"0.47184253",
"0.46480992",
"0.463094",
"0.46116254",
"0.46116254",
"0.4... | 0.53947395 | 0 |
The N1 loop allows for name/address information for the payee which would be utilized to address remittance(s) for delivery. | def payee_identification_loop(repeat = 1)
payee = get_facility
if payee
if ( payee.name.blank? || payee.address_one.blank? || payee.city.blank? || payee.state.blank? || payee.zip_code.blank?)
@claim = payee.clone
payee = @facility #if any of the billing provider address details is missing ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def payee_identification_loop(repeat = 1)\n payee = get_facility\n if payee\n if ( payee.name.blank? || payee.address_one.blank? || payee.city.blank? || payee.state.blank? || payee.zip_code.blank?)\n @claim = payee.clone\n payee = @facility #if any of the billing provider address details i... | [
"0.66184485",
"0.5846712",
"0.5586201",
"0.5276382",
"0.5198368",
"0.51736844",
"0.51698524",
"0.5129587",
"0.51131934",
"0.5043477",
"0.50116915",
"0.49954066",
"0.49906054",
"0.49784195",
"0.49771616",
"0.49560034",
"0.49462622",
"0.4942801",
"0.49199936",
"0.49190298",
"0.... | 0.6586868 | 1 |
Generating Eob level segments | def generate_eobs
Output835.log.info "\n\nPatient account number : #{@eob.patient_account_number}"
Output835.log.info "This EOB has #{@services.length} service lines"
Output835.log.info "This is a CLAIM LEVEL EOB" if @is_claim_eob
claim_segments = [claim_payment_loop, include_claim_dates]
claim_seg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def segments; end",
"def Segment\n A = 1\n B = 2\n C = 4\n D = 8\n E = 16\n F = 32\n G = 64\n H = 128\n J = 256\n K = 512\n M = 1024\n N = 2048\n P = 4096\n\n def initialize(segments=0)\n @segments = segments\n end\n\n def s(seg=Segment.new)\n Segment.new seg.segments + SOUTH\n end\nend",
... | [
"0.616536",
"0.6050643",
"0.55417985",
"0.54690576",
"0.5385677",
"0.5382693",
"0.52583516",
"0.5247545",
"0.51739496",
"0.5157609",
"0.51527894",
"0.5112163",
"0.51003504",
"0.51003504",
"0.5086204",
"0.50796926",
"0.50705373",
"0.50653744",
"0.50653744",
"0.5037154",
"0.502... | 0.65999275 | 0 |
Get claim_number for payer_group not of type 'PatPay' | def claim_number
@eob.claim_number.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def claim_number\n str = eob.check_information.check_number.to_s if eob.check_information\n (str += '_' + eob.claim_number) if !eob.claim_number.blank?\n str\n end",
"def payer_id\n payer = @first_check.payer\n payer_type = payer.payer_type if payer\n output_config = @facility.output_config(pa... | [
"0.6027029",
"0.5782901",
"0.5726156",
"0.5623404",
"0.5597491",
"0.5535263",
"0.5491672",
"0.5445134",
"0.5441101",
"0.53247625",
"0.5308545",
"0.5238663",
"0.5188976",
"0.5179709",
"0.51416236",
"0.5135443",
"0.5132143",
"0.5131256",
"0.5125264",
"0.5125264",
"0.5116556",
... | 0.6047227 | 0 |
Used when additional reference numbers specific to the claim in the CLP segment are provided to identify information used in the process of adjudicating this claim | def other_claim_related_id
if @eob.insurance_policy_number.present?
elem = ['REF','IG', @eob.insurance_policy_number].trim_segment.join(@element_seperator)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def other_claim_related_id\n elem = []\n if !eob.insurance_policy_number.blank?\n elem << 'REF'\n elem << 'IG'\n elem << eob.insurance_policy_number\n elem = Output835.trim_segment(elem)\n elem.join(@element_seperator)\n end\n end",
"def other_claim_related_id\n end",
"def r... | [
"0.6337421",
"0.6014893",
"0.5780814",
"0.57280505",
"0.57280505",
"0.5722685",
"0.5638677",
"0.56098926",
"0.5599693",
"0.5578289",
"0.5568588",
"0.5564096",
"0.5562551",
"0.55386055",
"0.55197716",
"0.5482172",
"0.54294103",
"0.54200155",
"0.5399013",
"0.5376572",
"0.536161... | 0.62510943 | 1 |
generating service level segments | def generate_services
is_adjustment_line = @service.adjustment_line_is?
service_segments = []
service_segments << service_payment_information unless is_adjustment_line
service_segments << service_date_reference
unless is_adjustment_line
cas_segments, pr_amount, crosswalked_codes = Output835.ca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def segments; end",
"def segments\n response = get 'segments'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def get_segments\n return make_request(\"#{self.endpoint}/list/segments\")\n end",
"def segments=(_arg0); end",
"def lists_and_segments\n response = get \... | [
"0.75312275",
"0.6523971",
"0.64782524",
"0.64646417",
"0.6244528",
"0.6126322",
"0.60918397",
"0.60620755",
"0.605204",
"0.60224414",
"0.5968079",
"0.5942922",
"0.5928583",
"0.59226626",
"0.5916483",
"0.58785135",
"0.57835704",
"0.57679874",
"0.5737053",
"0.570221",
"0.56883... | 0.70039004 | 1 |
supplies payment and control information to a provider for a particular service | def service_payment_information(eob = nil,service = nil,check = nil,is_claim_eob = nil,payer = nil)
@service = @service.nil?? service : @service
['SVC', composite_med_proc_id, @service.amount('service_procedure_charge_amount'), @service.amount('service_paid_amount'),
svc_revenue_code, @service.service_qu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_payment_info_loop\n end",
"def service_payment_information(eob = nil,service = nil,check = nil,is_claim_eob = nil,payer = nil)\n @eob = @eob.nil?? eob : @eob\n @service = @service.nil?? service : @service\n ['SVC', \"RX:#{captured_or_blank_patient_account_number(@eob.patient_account_numbe... | [
"0.6717453",
"0.66556394",
"0.657145",
"0.6368526",
"0.628441",
"0.6251136",
"0.6223648",
"0.6137595",
"0.6131912",
"0.6091232",
"0.6087689",
"0.6041838",
"0.60333484",
"0.6015361",
"0.60099614",
"0.59612507",
"0.59304965",
"0.59289956",
"0.59230745",
"0.5921717",
"0.5869013"... | 0.67547005 | 0 |
The DTM segment in the SVC loop is to be used to express dates and date ranges specifically related to the service identified in the SVC segment If service from and to dates are same, only print one segment with qual 472 Else print one segment each for the two dates | def service_date_reference
svc_date_segments = []
from_date = @service.date_of_service_from.strftime("%Y%m%d") unless @service.date_of_service_from.blank?
to_date = @service.date_of_service_to.strftime("%Y%m%d") unless @service.date_of_service_to.blank?
from_eqls_to_date = (from_date == to_date)
is_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_date_reference\n service_date_elements, svc_date_segments = [], []\n from_date = service.date_of_service_from.strftime(\"%Y%m%d\") unless service.date_of_service_from.blank?\n to_date = service.date_of_service_to.strftime(\"%Y%m%d\") unless service.date_of_service_to.blank? \n if from_dat... | [
"0.6629668",
"0.59278655",
"0.5803223",
"0.565906",
"0.5452688",
"0.54257756",
"0.52251405",
"0.5195947",
"0.5170736",
"0.51558065",
"0.5110476",
"0.5109761",
"0.5103426",
"0.50876486",
"0.5058007",
"0.5046841",
"0.5042525",
"0.50308174",
"0.5021806",
"0.5013138",
"0.49822974... | 0.7368086 | 0 |
Identifies the orionvm cloud === Return true:: If the orionvm cloud can be identified false:: Otherwise | def looks_like_orionvm?
hint?('orionvm') || looks_like_orionvm_v2? || looks_like_orionvm_v3?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manage_ip?\n case type.hotspot\n when 'hsv1-mem' then true\n when 'hsv2-bam' then false\n else false\n end\n end",
"def cloud?(node)\n node.key?('cloud')\n end",
"def cloud?(node = __getnode)\n # cloud is always present, but nil if not on a cloud\n !node[\"cloud\"]... | [
"0.6731178",
"0.65344596",
"0.64719707",
"0.6430523",
"0.63247144",
"0.6225154",
"0.61882967",
"0.61516964",
"0.6135572",
"0.6129361",
"0.61072576",
"0.6083947",
"0.6081457",
"0.6072907",
"0.6061748",
"0.60019016",
"0.5980817",
"0.59437996",
"0.5930491",
"0.5917122",
"0.59110... | 0.6617936 | 1 |
Determines whether IP address is private (reserved) === Parameters address:: IP address to test (ie '192.168.0.1') | def is_private?(address)
[
IPAddr.new('10.0.0.0/8'),
IPAddr.new('172.16.0.0/12'),
IPAddr.new('192.168.0.0/16'),
].any? do |i|
i.include? address
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_private(ip)\n\t\tpriv = FALSE\n\t\tif (ip_int(\"10.0.0.0\")..ip_int(\"10.255.255.255\")) === ip_int(ip)\n\t\t\tpriv = TRUE\n\t\telsif (ip_int(\"172.16.0.0\")..ip_int(\"172.31.255.255\")) === ip_int(ip)\n\t\t\tpriv = TRUE\n\t\telsif (ip_int(\"192.168.0.0\")..ip_int(\"192.168.255.255\")) === ip_int(ip)\n\t\t\... | [
"0.77885616",
"0.77885616",
"0.7283692",
"0.6809676",
"0.67911214",
"0.6775022",
"0.65426326",
"0.6536171",
"0.64874506",
"0.648404",
"0.63889843",
"0.6378189",
"0.63750863",
"0.6357704",
"0.6354815",
"0.6349172",
"0.6349172",
"0.632853",
"0.6323603",
"0.6319336",
"0.63138056... | 0.829832 | 0 |
Override to disable heartbeat | def run
unless @heartbeat_type == :none
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shutdown\n\t\tself.stop_heartbeat\n\t\tsuper\n\tend",
"def stop_heartbeat\n\t\tself.reactor.remove_timer( @heartbeat_timer )\n\tend",
"def restart\n\t\tself.stop_heartbeat\n\t\tsuper\n\t\tself.start_heartbeat\n\tend",
"def heartbeat\n end",
"def cancel_heartbeat(&blk)\n raise 'This API endpoint c... | [
"0.7354459",
"0.7045265",
"0.6943713",
"0.6819915",
"0.68168664",
"0.67524",
"0.67507195",
"0.63720876",
"0.6358187",
"0.6228595",
"0.62069905",
"0.61533964",
"0.61050314",
"0.6088258",
"0.60571915",
"0.6044343",
"0.60402095",
"0.60318863",
"0.59869087",
"0.5922061",
"0.59107... | 0.7274086 | 1 |
Helper method that will give you a joined pods/metrics query proxy. | def metrics
pods.outer_join(:github_pod_metrics).on(:id => :pod_id).join(:cocoadocs_pod_metrics).on(:id => :pod_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pods\n\nend",
"def joined\n meta(joined: true)\n end",
"def joins\n @joins\n end",
"def joins(args={})\n # If showing pending, do not joins question responses\n return args[:show_pending] ? nil : :question_responses\n end",
"def query(metric_name, options={})\n key = build... | [
"0.5139953",
"0.48673347",
"0.48086137",
"0.48034048",
"0.47497684",
"0.47373617",
"0.46751404",
"0.46732417",
"0.46656635",
"0.46642977",
"0.4595197",
"0.4592289",
"0.45597503",
"0.45221573",
"0.45056468",
"0.44869015",
"0.44813332",
"0.44614044",
"0.4454043",
"0.4454043",
"... | 0.7241363 | 0 |
Look up an array of the first count tag IDs with the specified batch URN. Output parameters tagIds (array of string, `E12345678912345678`) ... Array of RFID tag identifiers | def get_query_tags(batch_urn,
count = 100000)
# prepare query url
_query_builder = Configuration.base_uri.dup
_query_builder << '/rest/tag/queryTags'
_query_builder = APIHelper.append_url_with_query_parameters _query_builder, {
'batchUrn' => batch_urn,
'c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_tag_return_IDs(tag)\n # Split and strip the tags\n tags = tag.split(\",\").collect{|x| x.strip}\n i = 0\n iDs = []\n while i < tags.count do\n # Check if tag exist, if not - add it\n if Teg.find_by_teg(tags[i]).nil?\n\tTeg.new(:teg => tags[i]).save\n end\n # Insert into... | [
"0.56860304",
"0.5434679",
"0.5181921",
"0.50575536",
"0.5054888",
"0.5050918",
"0.49435166",
"0.49434254",
"0.48474193",
"0.48370224",
"0.48253968",
"0.4819892",
"0.48113188",
"0.47977632",
"0.4770586",
"0.47623456",
"0.47452334",
"0.47428283",
"0.47323185",
"0.47195017",
"0... | 0.55195796 | 1 |
Get a message to a single numeric tag code. Idempotent Behaviour This endpoint is idempotent and will respond with an appropriate HTTP status code to indicate the actual result 200 OK message available 400 BAD_REQUEST problem occurred, check message parameter for detailed information 401 UNAUTHORIZED user not authorize... | def create_get_single_tag_code_message(body)
# prepare query url
_query_builder = Configuration.base_uri.dup
_query_builder << '/rest/tag/message'
_query_url = APIHelper.clean_url _query_builder
# prepare headers
_headers = {
'accept' => 'application/json',
'content... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_tag_infos(tag, language_code)\n if tag.nil?\n render :status => 400, :json => { :error => { :message => 'Tag not found', :code => 'InvalidRequest' }}\n else\n tag_infos = create_tag_infos(tag, language_code)\n\n render :status => 200, :json => { :tags => [tag_infos] }\n end\n en... | [
"0.60959977",
"0.57663137",
"0.5558536",
"0.5535623",
"0.5480762",
"0.54005903",
"0.5275106",
"0.5274505",
"0.5243674",
"0.52152926",
"0.51961714",
"0.5186899",
"0.51346874",
"0.51182544",
"0.5117271",
"0.50756985",
"0.5074947",
"0.5067514",
"0.50588506",
"0.5043754",
"0.5035... | 0.6652409 | 0 |
Get application data from tags, which returns data encoded on the tags. This function also returns the lock state of the application data. Idempotent Behaviour This endpoint is idempotent and will respond with an appropriate HTTP status code to indicate the actual result 200 OK tags found and result available (also ret... | def create_get_application_data_from_tags(body)
# prepare query url
_query_builder = Configuration.base_uri.dup
_query_builder << '/rest/tag/value'
_query_url = APIHelper.clean_url _query_builder
# prepare headers
_headers = {
'accept' => 'application/json',
'conten... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read\n return unless locks\n\n result = locks.find(data_bag_id)\n\n result.to_hash if result\n end",
"def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.editable_by(@context).\n eager_load(:app, user: :org, analysis: :workflow).\n incl... | [
"0.55413246",
"0.5264963",
"0.5183926",
"0.5049842",
"0.49332815",
"0.48925203",
"0.48829582",
"0.48625067",
"0.48625067",
"0.48252925",
"0.48252925",
"0.48252925",
"0.48252925",
"0.48252925",
"0.48176304",
"0.47612125",
"0.4760161",
"0.46976382",
"0.46687907",
"0.46677804",
... | 0.60995173 | 0 |
Look up an array of the first count batchUrns with the specified customer PO. NOTE: Only one customerPO can be specified. Output parameters batchUrns (array of string, `urn:uuid:smartracgroup:batch:99990001`) ... Array of batch URNs | def get_query_batches(customer_po,
count = 100000)
# prepare query url
_query_builder = Configuration.base_uri.dup
_query_builder << '/rest/tag/queryBatches'
_query_builder = APIHelper.append_url_with_query_parameters _query_builder, {
'customerPO' => customer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_path\n if @discovery_document['batchPath']\n return @batch_path ||= (\n self.document_base.join(Addressable::URI.parse('/' +\n @discovery_document['batchPath']))\n ).normalize\n else\n return nil\n end\n end",
"def send_batc... | [
"0.5252995",
"0.506197",
"0.49939978",
"0.4865306",
"0.47606206",
"0.47280714",
"0.47027403",
"0.47027403",
"0.4661356",
"0.46523502",
"0.4650074",
"0.46288314",
"0.4604309",
"0.4570969",
"0.45338106",
"0.44704163",
"0.4467058",
"0.44465417",
"0.44348732",
"0.44220415",
"0.44... | 0.61496884 | 0 |
Get authentication keys for encoded tags, which can be used to access the tag memory. The key names, content and access rules need to be defined when ordering the tags. It is possible to have several applications with their corresponding keys on a tag. Idempotent Behaviour This endpoint is idempotent and will respond w... | def create_get_keys_used_for_tag_authentication(body)
# prepare query url
_query_builder = Configuration.base_uri.dup
_query_builder << '/rest/tag/key'
_query_url = APIHelper.clean_url _query_builder
# prepare headers
_headers = {
'accept' => 'application/json',
'co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authentication_keys\n @authentication_keys ||= [mapping.to.token_authentication_key]\n end",
"def keys\n @tags.nil? ? [] : @tags.keys\n end",
"def fetch_signing_keys\n response = JSON.parse(Net::HTTP.get(URI(signing_keys_url)))\n response['keys']\n rescue JSON::Parser... | [
"0.58994526",
"0.57494795",
"0.566004",
"0.5653021",
"0.5609994",
"0.560411",
"0.5559515",
"0.5545213",
"0.54951394",
"0.5490269",
"0.54600674",
"0.54600674",
"0.54400295",
"0.53958005",
"0.5394449",
"0.53844446",
"0.53773034",
"0.53699875",
"0.53424716",
"0.531775",
"0.53154... | 0.71602386 | 0 |
Create a new key value entry inside a dictionary with the specified name at the root of this database. Successful completion means the named dictionary will contain one more entry than it need even if it did not previously exist. | def create_entry( dictionary_name, key_name, value )
KeyError.not_new( dictionary_name, self )
KeyError.not_new( key_name, self )
KeyError.not_new( value, self )
self[ dictionary_name ] = {} unless self.has_key?( dictionary_name )
self[ dictionary_name ][ key_name ] = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(name, key)\n issueKey_test(key)\n fetch({:method => :post, :body => name, :body_override => true, :parent => parent_name, :parent_key => key})\n end",
"def add_to_hash(storage_hash, name, new_name)\r\n storage_hash[name] = new_name\r\nend",
"def add_a_key_value_pair\n new_has... | [
"0.62424123",
"0.62326896",
"0.6038395",
"0.6015353",
"0.58742636",
"0.58257085",
"0.5825289",
"0.57322586",
"0.57258356",
"0.57099384",
"0.5690248",
"0.5648871",
"0.56229466",
"0.5587205",
"0.55508864",
"0.5550361",
"0.54747695",
"0.5461193",
"0.544079",
"0.5432273",
"0.5416... | 0.7587017 | 0 |
Delete an existing key value entry inside the dictionary with the specified name at the root of this database. Successful completion means the named dictionary will contain one less entry if that key existed. | def delete_entry( dictionary_name, key_name )
KeyError.not_new( dictionary_name, self )
KeyError.not_new( key_name, self )
self[ dictionary_name ].delete( key_name )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(name)\r\n key = convert_key(name)\r\n return false unless has(key)\r\n @p.delete(key)\r\n true\r\n end",
"def delete(name)\n name = name.to_sym\n if @values.key? name\n delete_name name\n @values.delete name\n end\n end",
"def delete_key_pair(key_name)\n return if... | [
"0.69060516",
"0.66039443",
"0.63256794",
"0.6323323",
"0.62871385",
"0.6269157",
"0.6244237",
"0.6190668",
"0.6190668",
"0.6121008",
"0.6113571",
"0.6081636",
"0.6077545",
"0.6021239",
"0.59702116",
"0.59452933",
"0.59302396",
"0.5922024",
"0.58857733",
"0.5864068",
"0.58592... | 0.7690513 | 0 |
edit item in the json file and save | def edit(class_name, object)
begin
@data = get_all()
# go through all items in the file
@data[class_name].map!{|item|
if item["id"] == object["id"]
object
else
item
end
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n require 'ruby-debug'; debugger\n if storage.respond_to?(\"json_file\")\n output \"#{cyan(\"Boom!\")} #{Platform.edit(storage.json_file)}\"\n else\n output \"This storage backend #{red storage.class} does not store #{cyan(\"Boom!\")} data on your computer\"\n ... | [
"0.6637274",
"0.6297716",
"0.628253",
"0.6248859",
"0.6248859",
"0.61671454",
"0.61314636",
"0.61131",
"0.6110778",
"0.60771143",
"0.6028917",
"0.6001276",
"0.59909153",
"0.59732217",
"0.5968674",
"0.59677356",
"0.5940953",
"0.5914207",
"0.5912161",
"0.59079623",
"0.5871321",... | 0.6591906 | 1 |
get from json file class data | def get_data(class_name)
return JSON.parse(File.read(@database_file))[class_name]
# error handling
rescue Errno::ENOENT
File.open(@database_file, 'w+')
File.write(@database_file, [])
retry
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data\n json_file = Egd::Builder.new(File.read(@file)).to_json\n data = JSON.parse(json_file)\n end",
"def parse json; return JSON.parse File.read json end",
"def parse json; return JSON.parse File.read json end",
"def load_json(filename); end",
"def extract_datas_from_json(path)\n ... | [
"0.66772264",
"0.6600513",
"0.6600513",
"0.6553418",
"0.6527646",
"0.64734405",
"0.6402046",
"0.63097805",
"0.62799823",
"0.6276879",
"0.6248767",
"0.62441224",
"0.6220357",
"0.62017393",
"0.6178706",
"0.61314386",
"0.6080928",
"0.6075665",
"0.60620433",
"0.60620433",
"0.6060... | 0.67145586 | 0 |
get pets client from json using client id and returning it | def get_pet_list_by_client_id(client_id)
pet_list = []
for pet in get_data("pets")
if client_id == pet["client_id"]
pet_list.push(pet)
end
end
return pet_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_client_by_id client_id\n @clients[client_id]\n end",
"def client\n query[\"client_id\"]\n end",
"def details\n response = CreateSend.get \"/clients/#{client_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def clientid\n @obj['clientid']\n end",
"def get_cli... | [
"0.7090033",
"0.6448273",
"0.64082104",
"0.63319725",
"0.6240005",
"0.6225158",
"0.61930263",
"0.61827374",
"0.612321",
"0.60829383",
"0.6053361",
"0.60049856",
"0.597459",
"0.5973641",
"0.5966523",
"0.5965348",
"0.5952586",
"0.593579",
"0.59046054",
"0.589576",
"0.5886216",
... | 0.6550511 | 1 |
get tasks list of the jobs from json using job id and returning it | def get_task_list_by_job_id(job_id)
list_tasks = []
for task in get_data("tasks")
if job_id == task["job_id"]
list_tasks.push(task)
end
end
return list_tasks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_job(id)\n conn = @client.get do |req|\n req.url \"/api/v2/job/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end",
"def get_task_list(id)\n response = request(\n :expects => 200,\n :idempotent => true,\n ... | [
"0.70621973",
"0.70516574",
"0.7019634",
"0.6913135",
"0.6864184",
"0.68169725",
"0.6705907",
"0.6658707",
"0.660234",
"0.65161216",
"0.6499095",
"0.6459582",
"0.6438981",
"0.64238316",
"0.640044",
"0.6377937",
"0.63242865",
"0.63006",
"0.6291554",
"0.62880915",
"0.6284512",
... | 0.8324479 | 0 |
get jobs from json using difference of job date and local date now returning jobs for next 7 days | def get_jobs_last_7_days()
@data = get_all()
now = Time.now.to_date
jobs = []
for job in @data["jobs"]
parsed_date = Date.strptime(job["date"], "%d/%m/%Y")
days_difference = (parsed_date - now).to_i
if days_difference <= 7 && days_difference >= 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_jobs(from, to)\n\n job_info = get_job_info(from)\n total_page = job_info[:x_total_pages].to_i\n new_to = (to == nil || to < total_page) ? to : total_page\n puts \">> total page : \" + total_page.to_s\n\n jobs = []\n (from..new_to).each do |page|\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/... | [
"0.6125629",
"0.60991776",
"0.59484947",
"0.5701662",
"0.56686306",
"0.56597656",
"0.55676115",
"0.5542194",
"0.5455431",
"0.5447028",
"0.5437113",
"0.54125005",
"0.5384319",
"0.53822505",
"0.5379135",
"0.5376243",
"0.5372504",
"0.52999395",
"0.5286573",
"0.5278726",
"0.52742... | 0.7609672 | 0 |
get jobs list from json using client id and returning it | def get_jobs_by_client_id(client_id)
jobs = []
for job in get_data("jobs")
if client_id == job["client_id"]
jobs.push(job)
end
end
return jobs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end",
"def get_jobs_sample(client)\n response = client['jobs'].get\n\n p ''\n... | [
"0.75944084",
"0.7242146",
"0.7060586",
"0.7045959",
"0.697496",
"0.6934144",
"0.687525",
"0.687062",
"0.68623453",
"0.68386525",
"0.68298477",
"0.6782991",
"0.66781485",
"0.6672076",
"0.66154945",
"0.65406626",
"0.64549214",
"0.6443678",
"0.64298946",
"0.63978434",
"0.639107... | 0.81782615 | 0 |
In production this route kicks in, and in dev we load /assets/modejson.js from the /app/assets/javascripts/modejson.js location.. | def mode_json
path = 'node_modules/ace-builds/src-min-noconflict/mode-json.js'
file_contents = File.read(path)
render js: file_contents, content_type: Mime::Type.lookup('application/javascript')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_js\n [\n src_config_path.join('routes.js').to_s,\n src_config_path.join('router.js').to_s,\n src_config_path.join('app.js').to_s\n ]\n end",
"def request_debug_assets?; end",
"def request_debug_assets?; end",
"def ext\n respond_to do |fo... | [
"0.6038718",
"0.5915775",
"0.5915775",
"0.5853893",
"0.58435315",
"0.57701534",
"0.57312936",
"0.56733334",
"0.566905",
"0.56350577",
"0.55973816",
"0.55973816",
"0.55973816",
"0.5539291",
"0.55279535",
"0.5499255",
"0.5488297",
"0.5468895",
"0.54674774",
"0.54142076",
"0.534... | 0.6993085 | 0 |
Creates a static route in EOS. May add or overwrite an existing route. ===Commands ip route [router_ip] [distance] [tag ] [name ] | def create(destination, nexthop, opts = {})
cmd = "ip route #{destination} #{nexthop}"
cmd << " #{opts[:router_ip]}" if opts[:router_ip]
cmd << " #{opts[:distance]}" if opts[:distance]
cmd << " tag #{opts[:tag]}" if opts[:tag]
cmd << " name #{opts[:name]}" if opts[:name]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aws_subnet_route_table_route_to_nat_create(opts)\n AWS::EC2.new.subnets[opts[:subnet_id]].route_table.create_route(\"0.0.0.0/0\", { instance: opts[:instance_id] } )\n end",
"def route(*args)\n Route.new(self, *args)\n end",
"def add_route(station, line)\n Neo4j::Transaction.run do\n rel = N... | [
"0.6502786",
"0.6321983",
"0.61906475",
"0.6159985",
"0.61007744",
"0.5989231",
"0.5970386",
"0.59586877",
"0.58476424",
"0.5817613",
"0.5803689",
"0.57613295",
"0.57404864",
"0.573992",
"0.57376033",
"0.56921756",
"0.5672304",
"0.5646193",
"0.5639679",
"0.5638072",
"0.562105... | 0.7125344 | 0 |
Validates that role exists in config file | def role_valid
if (APP_CONFIG["user_roles"]+SYSTEM_DATA["user_roles"]).select{|role| role["name"] == self.role}.empty?
errors.add(:role, "Role does not exist in config")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(role, _environments, cookbooks, roles) # rubocop:disable CyclomaticComplexity\n # validate the role passed in match the name of either the .rb or .json\n file = %W{roles/#{role}.rb roles/#{role}.json}.find { |f| File.exist?(f) }\n role = role.split(\"/\").last if role =~ /\\// # pull ou... | [
"0.71491146",
"0.6838999",
"0.66361266",
"0.652407",
"0.6522044",
"0.6417222",
"0.6404501",
"0.64042354",
"0.6400524",
"0.6400524",
"0.6331413",
"0.6306299",
"0.6306245",
"0.62876153",
"0.628089",
"0.6269485",
"0.62663954",
"0.624251",
"0.6239899",
"0.6208354",
"0.62056535",
... | 0.8173761 | 0 |
Clear all tokens that have expired | def clear_expired_tokens
access_tokens.where("token_expire < ?", Time.now).destroy_all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expire_tokens!\n update_tokens(nil)\n end",
"def purge_old_tokens\n auth_tokens.desc(:last_used_at).offset(20).destroy_all\n end",
"def delete_all_expired_for(time)\n expired_for(time).delete_all\n end",
"def revoke!\n return if revoked?\n update(revoked_at: Time.now... | [
"0.8014729",
"0.7826364",
"0.72858053",
"0.7003844",
"0.6984809",
"0.6972976",
"0.6952847",
"0.6942722",
"0.6909779",
"0.6869758",
"0.6833584",
"0.6825665",
"0.6772656",
"0.6762896",
"0.6756962",
"0.67244494",
"0.6688539",
"0.66881764",
"0.6640788",
"0.6582605",
"0.65643376",... | 0.88821876 | 0 |
create new FantasyStat load_tournament_list load_tournament_game_data create_leagues load_player_data | def load_fantasy_stats
load_tournament_list
load_tournament_game_data
create_leagues
load_player_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @game = Game.new(params[:game])\n\t\n #First update the players table to indicate who is playing this game\n set_player_availability(params)\n \n #Create a team to hold the home team players\n home_team = Team.new\n home_team.name = params[:home_team_name]\n home_team.save\n ... | [
"0.67178106",
"0.6679277",
"0.6521614",
"0.6490447",
"0.64522433",
"0.6435048",
"0.6409999",
"0.6368255",
"0.63620615",
"0.6346649",
"0.63338155",
"0.63176423",
"0.62978214",
"0.62587976",
"0.62456095",
"0.62323886",
"0.621037",
"0.61967593",
"0.6187602",
"0.6168517",
"0.6140... | 0.758154 | 0 |
A pull request has been closed | def process_closed_pull_request(pull_request)
pr_name = pull_request['base']['repo']['full_name'].to_s
pr_number = pull_request['number'].to_s
pr_key = pr_name + ":" + pr_number
current_commit_hash = pull_request['head']['sha'].to_s
# Delete the PR from the redis store
@redis.del(pr_key)
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_closed_pull_request(pull_request)\n pr_name = pull_request['base']['repo']['full_name'].to_s\n pr_number = pull_request['number'].to_s\n current_commit_hash = pull_request['head']['sha'].to_s\n\n # Delete the PR from the redis store\n @redis.del(pr_name + \":\" + pr_number)\n return 2... | [
"0.7414636",
"0.7151129",
"0.68429697",
"0.66125697",
"0.6273422",
"0.6244567",
"0.62148625",
"0.60994726",
"0.6068718",
"0.60340863",
"0.60178643",
"0.5998116",
"0.5937435",
"0.5903284",
"0.58645415",
"0.58507925",
"0.58493114",
"0.58197975",
"0.5797524",
"0.57844937",
"0.57... | 0.74483526 | 0 |
A PR review has been reported | def process_created_review(review_payload)
pr_name = review_payload['repository']['full_name'].to_s
pr_number = review_payload['pull_request']['number'].to_s
comment_user = review_payload['review']['user']['id'].to_s
approvals = evaluate_review_state(review_payload['review']['state'])
current_commit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply(pr, pull_request_hash)\n if !previously_applied?(pr) && matches?(pull_request_hash)\n add_reviewer(pr)\n end\n end",
"def review\n end",
"def review; end",
"def develop_pr_check\n\n result = CheckResult.new(\"Develop PR Check Result\")\n\n ## PR should be sent from a branch that ... | [
"0.66692436",
"0.66381574",
"0.6536634",
"0.65272343",
"0.63813394",
"0.6380718",
"0.6373571",
"0.6368497",
"0.6365946",
"0.6359939",
"0.6359239",
"0.63352484",
"0.62968254",
"0.62817",
"0.62776655",
"0.626592",
"0.6251442",
"0.6240455",
"0.6236603",
"0.6208171",
"0.61667466"... | 0.69937253 | 0 |
Evaluates and submits a status for the commodus review | def submit_status(pr_name, pr_number, current_commit_hash, comment_user, approvals)
pr_key = pr_name + ":" + pr_number
# Grab the stored payload
stored_payload_value = @redis.hget(pr_key, current_commit_hash)
# Ensure that a key actually exists
if !stored_payload_value.nil?
stored_payload = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluation\n @api_v1_reservation.evaluate(evaluation_params[:comment], evaluation_params[:rating].to_i) unless @api_v1_reservation.evaluation\n render json: { success: true }, status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end",
"def process_created... | [
"0.6502814",
"0.64420223",
"0.6370287",
"0.6361855",
"0.63438636",
"0.62839556",
"0.6064108",
"0.59603673",
"0.5960339",
"0.5909844",
"0.5909808",
"0.5893468",
"0.58838636",
"0.5882186",
"0.5855061",
"0.5848491",
"0.58448297",
"0.5834676",
"0.5825427",
"0.58159834",
"0.579943... | 0.6651151 | 0 |
Evaluates the PR review state | def evaluate_review_state(state)
net_pluses = 0
if state == "approved"
net_pluses = 1
elsif state == "changes_requested"
net_pluses = -1
end
return net_pluses
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reviewed?\n @status == :reviewed\n end",
"def check_plagiarism_state(auto_metareview, count_copies, rev_array, scores)\n if count_copies > 0 #resetting review_array only when plagiarism was found\n auto_metareview.review_array = rev_array\n\n\n if count_copies == scores.length\n return AL... | [
"0.65369254",
"0.6394565",
"0.6209691",
"0.6142017",
"0.61167043",
"0.6020812",
"0.60189486",
"0.59366703",
"0.59245205",
"0.58845884",
"0.5877376",
"0.5865738",
"0.58540964",
"0.5825794",
"0.5823771",
"0.5814638",
"0.5794821",
"0.5783649",
"0.575532",
"0.571283",
"0.57127154... | 0.7546724 | 0 |
Get the view_model class for the given model instance. Note: ViewModels are usually of class ViewModels::. (As returned by default_view_model_class_for) Override specific_mapping if you'd like to install your own. OR: Override default_view_model_class_for(model) if you'd like to change the default. | def view_model_class_for model
specific_view_model_class_for(model) || default_view_model_class_for(model)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_class\n @model_class ||= mapping.to\n end",
"def process_params_model_view(params, options)\n model_view = options[:model_name].constantize if options[:model_name]\n model_view ||= model_string_to_constant(params[:model_name]) if params[:model_name]\n model_view ||= model_from_ac... | [
"0.6332937",
"0.619373",
"0.618355",
"0.61675394",
"0.61671686",
"0.6132349",
"0.5820911",
"0.5811959",
"0.569339",
"0.56078196",
"0.5593443",
"0.5486177",
"0.54407644",
"0.5343196",
"0.53384167",
"0.52666116",
"0.5245672",
"0.5213166",
"0.5201457",
"0.518938",
"0.51862705",
... | 0.8219892 | 0 |
Sets self.hotness according to the idea's age, upvotes/downvotes, and whether or not the idea has 'preferred' status. Hotness is used to determine where in the list the idea will appear. We've used the same algorithm as reddit does for sorting its contents. At present, having posting an idea later gives more hotness to... | def set_hotness!
preferred_weight = self.preferred ? PREFERRED_MAGNITUDE : 0
vote_weight = vote_tally + preferred_weight
newness = self.created_at.to_f || Time.now.to_f
sign = vote_weight < 0 ? -1 : 1
upvote_magnitude = [ vote_weight.abs, 1.1 ].max... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_hot_score\n points = upvotes - downvotes\n time_ago_in_hours = ((Time.now - created_at) / 3600).round\n score = hot_score(points, time_ago_in_hours)\n\n update_attributes(points: points, hot_score: score)\n end",
"def check_upvote(idea)\n if idea.quality == 'genius'\n elsif idea.q... | [
"0.6177182",
"0.608297",
"0.5409675",
"0.533342",
"0.5126721",
"0.50411904",
"0.50343305",
"0.50012684",
"0.49902043",
"0.49870187",
"0.49532056",
"0.49509266",
"0.49352682",
"0.4889389",
"0.48779643",
"0.48779643",
"0.4865043",
"0.4858861",
"0.4848723",
"0.48413908",
"0.4829... | 0.81946987 | 0 |
sets the idea's vote_tally field to be equal to the number upvotes minus the number of downvotes it has | def set_vote_tally!
self.vote_tally = self.get_upvotes.size - self.get_downvotes.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tally\n up_votes - down_votes\n end",
"def calculate_tallied_votes\n self.tallied_votes = upvotes - downvotes\n self.save\n end",
"def get_vote_tally\n return self.get_upvotes.size - self.get_downvotes.size\n end",
"def votes\n up_votes - down_votes\n end",
"def total_votes\n ... | [
"0.8010913",
"0.77478546",
"0.7299664",
"0.7065575",
"0.6974259",
"0.696491",
"0.6810292",
"0.680439",
"0.6783879",
"0.6761954",
"0.6729899",
"0.6714184",
"0.67135954",
"0.6641259",
"0.66187316",
"0.6618066",
"0.65903974",
"0.65903974",
"0.65258914",
"0.65258914",
"0.6440316"... | 0.84108794 | 0 |
Adds a downvote to the idea and then saves it, causing the idea's hotness to update | def downvote_and_update(user)
self.disliked_by user
self.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upvote\n self.votes += 1\n save\n end",
"def upvote_and_update(user)\n self.liked_by user\n self.save #trigger set_hotness!\n end",
"def vote_up\n update_votes(1)\n end",
"def vote up\n end",
"def upvote\n @vote[:direction] = true\n @vote.save!\n redirect_to :back\... | [
"0.740997",
"0.70796835",
"0.6971138",
"0.67812055",
"0.6657157",
"0.6638231",
"0.6620038",
"0.6583766",
"0.65543056",
"0.6543678",
"0.64985836",
"0.6495554",
"0.6468844",
"0.6468204",
"0.6464484",
"0.64422995",
"0.6414893",
"0.6409731",
"0.6394838",
"0.6369945",
"0.63282824"... | 0.71247953 | 1 |
Returns the tally of votes for the idea (upvotes downvotes) | def get_vote_tally
return self.get_upvotes.size - self.get_downvotes.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tally\n up_votes - down_votes\n end",
"def votes_count\n upvotes + downvotes\n end",
"def votes\n up_votes - down_votes\n end",
"def total_votes\n up_votes + down_votes\n end",
"def set_vote_tally!\n self.vote_tally = self.get_upvotes.size - self.get_downvotes.size\n end",
... | [
"0.89774925",
"0.7813947",
"0.76699346",
"0.7635027",
"0.7599955",
"0.75703746",
"0.7565523",
"0.7489117",
"0.7436106",
"0.7383439",
"0.7336825",
"0.72956616",
"0.72698736",
"0.7235209",
"0.7214073",
"0.7164372",
"0.71635085",
"0.71578735",
"0.7142531",
"0.7129869",
"0.709990... | 0.82861036 | 1 |
converts idea.youtube_link into the form needed to make the video embeddable | def embed_link
return nil if self.youtube_link.nil?
id_regex = /(?:http:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=)?(.+)/
youtube_id = self.youtube_link.match(id_regex)
return nil if youtube_id.nil?
return YOUTUBE_EMBED_PREFIX + youtube_id[1] + "?rel=0"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_youtube_embed_link\n self.video_url.gsub!(/(youtube.com\\/)(.)*v=([\\w\\-_]+)(.)*$/, '\\1embed/\\3')\n end",
"def youtube_embed_url\n VideoInfo.new(self.video_url).embed_url if self.video_url?\n end",
"def youtube_movie_embed\n str1 = \"http://www.youtube.com/v/\" \n str2 = mov... | [
"0.8498275",
"0.7565774",
"0.72716",
"0.7156959",
"0.70510364",
"0.70259106",
"0.6964769",
"0.69183433",
"0.6907878",
"0.68751764",
"0.687082",
"0.6832827",
"0.6831723",
"0.67978805",
"0.6791987",
"0.67915565",
"0.67915565",
"0.6769349",
"0.6703219",
"0.6690055",
"0.6651127",... | 0.77095395 | 1 |
Returns true if the idea has preferred status, false otherwise | def preferred?
self.preferred
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adoptable?\n adoption_status ? \"Adoptable\" : \"Pending Adoption\"\n end",
"def decided?\n return (self.status == STATUS_DENIED or self.status == STATUS_ACCEPTED)\n end",
"def awarded_by_interview_committee?\n application_interview_decision_type.nil? ? false : application_interview_decisi... | [
"0.70375925",
"0.69731855",
"0.6902406",
"0.689073",
"0.6802753",
"0.6778904",
"0.66817284",
"0.66621965",
"0.665633",
"0.66336936",
"0.6611703",
"0.659836",
"0.6592191",
"0.65733737",
"0.654889",
"0.6472812",
"0.6462",
"0.64433473",
"0.64391756",
"0.64391756",
"0.64386946",
... | 0.7120746 | 0 |
Convert an Excel serialformat date to a Ruby date object | def serial_to_date (s)
# round down and convert from string if need be
# zero day is actually "Jan 0" and indexing starts from 1, so subtract 2
s = s.to_i() - 2
# add to zero day
return JAN_1_1900 + s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value\n val = @value\n if format_as_date?(val)\n val = Xl::DateHelper.excel_to_ruby(val)\n end\n val\n end",
"def to_date\n Date.new(*to_a[0,3])\n end",
"def to_date(date)\n return date if date.is_a?(Date)\n Date.parse(date)\n end",
"def to_date()\n #This is a st... | [
"0.62069476",
"0.61393535",
"0.6094726",
"0.6068427",
"0.60031927",
"0.5970545",
"0.5916263",
"0.59061056",
"0.58625317",
"0.58551615",
"0.58055675",
"0.58047736",
"0.57916033",
"0.57813406",
"0.5780769",
"0.57712805",
"0.5759168",
"0.57471335",
"0.57381153",
"0.57181656",
"0... | 0.64726996 | 0 |
Converts the string form of a number to the bestfitting numeric type. | def str_to_number(s)
val_str = s.to_s()
if INT_REGEX.match(val_str)
return val_str.to_i()
elsif FLOAT_REGEX.match(val_str)
return val_str.to_f()
else
raise ArgumentError, "can't understand numeric format '#{s}'"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_string_to_number(str); end",
"def string_to_number(string)\n case string\n when /^\\d+$/\n string.to_i\n when /^\\d+.\\d$/\n string.to_f\n else \n string\n end\n end",
"def string_to_number(string)\n case string\n when /^\\d+$/\n string.to_i\n when /^\\d... | [
"0.72345346",
"0.692932",
"0.6904537",
"0.68334144",
"0.6781501",
"0.67192346",
"0.66544014",
"0.66154766",
"0.65227914",
"0.65227914",
"0.65227914",
"0.65227914",
"0.65222204",
"0.65026057",
"0.6499859",
"0.64872915",
"0.6395673",
"0.63723105",
"0.62653464",
"0.6240222",
"0.... | 0.70352906 | 1 |
returns array of strings to print out for syntax. | def syntax
t = @cmd_args
t = [[t]] if !t.is_a? Array
args = []
count = 0
t.each do |expected_array|
count += 1
if count == 1
str = "Syntax: #{@cmd_name}"
else
str = " #{@cmd_name}"
end
expected_array.each do |expected|
# each expe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printable\r\n list = @@words.to_a.sort.map {|word,definition| \"[#{word}] \\\"#{definition}\\\"\"}\r\n list.join(\"\\n\")\r\nend",
"def syntaxes\r\n playbook.syntaxes\r\n end",
"def syntax(tokens)\n tokens = expect(:\".syntax\", tokens)\n if id?(tokens[0])\n name = tokens[0]\n tok... | [
"0.61984724",
"0.6170192",
"0.60561275",
"0.5983776",
"0.58088243",
"0.58037555",
"0.5798638",
"0.57766515",
"0.57680833",
"0.5703316",
"0.5699007",
"0.56761307",
"0.5639792",
"0.56392",
"0.5638582",
"0.56160325",
"0.5596635",
"0.5581493",
"0.5562743",
"0.5552735",
"0.553896"... | 0.63633734 | 0 |
automatically creates new rooms and digs them out in a direction. if a room is supplied we use it unconditionally. | def buildwalk(dir, supplied=nil)
if supplied
if supplied.is_a?(Room)
found = {:room=>supplied}
else
view "Linking failed. Target was not a room." + ENDL
return nil
end
else
m = Automap.new(in_room, [(-1..1),(-1..1)], {:full_traverse=>true})
found = m.find(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_in_direction dir\n new_room = Room.create({:created_at=>Time.now, :x=>self.x, :y=>self.y, :z=>self.z})\n \n case dir\n when \"north\",:north, 0\n new_room.y += 1\n when \"east\", :east, 1\n new_room.x += 1\n when \"south\",:south, 2\n new_room.y -= 1\n when \"west\",:... | [
"0.6722861",
"0.668243",
"0.64884335",
"0.6439694",
"0.64079",
"0.6379113",
"0.63689756",
"0.63584304",
"0.63232124",
"0.6282554",
"0.6272412",
"0.6272412",
"0.6268909",
"0.62551105",
"0.6141466",
"0.6133677",
"0.6107761",
"0.6098927",
"0.6086022",
"0.60630333",
"0.6040975",
... | 0.67359287 | 0 |
continuously check for new messages | def start()
unread = notifications()['UnreadMessage'].to_i
@thread = Thread.new do
loop do
unread_messages = notifications()['UnreadMessage'].to_i
if unread_messages > unread then
@callback.call if @callback
unread = unread_messages
end
sleep ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def poll!\n find_and_process_next_available(messages)\n end",
"def check_for_new_messages\n messages = twitter.direct_messages(:since_id => last_message_retrieved)\n @num_messages = messages.length\n end",
"def work(message)\n if message.is_a?(Message)\n self.count = count + ... | [
"0.71887225",
"0.6921472",
"0.6517167",
"0.6386165",
"0.63390267",
"0.63080734",
"0.62383354",
"0.62111443",
"0.6200135",
"0.61960334",
"0.6171409",
"0.61618567",
"0.6056954",
"0.6051132",
"0.60491335",
"0.5997053",
"0.5992488",
"0.59821445",
"0.5977466",
"0.59728944",
"0.594... | 0.726368 | 0 |
Returns a byte array representing this command, appropriate for sending to the sign's serial port | def to_bytes
# set defaults
self.sender ||= :pc
self.receiver ||= 1
bytes = []
bytes.concat [0x00] * 5 # start of command
bytes.concat [0x01] # <SOH>
bytes.concat self.sender.to_bytes # Sender... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_payload_bytes\n raise MovingsignApi::NotImplementedError, \"Needs to be implemented in subclass.\"\n end",
"def to_s\n [0, 32, @device_token, @payload.length, @payload ].pack(\"CnH*na*\")\n end",
"def encode_to_array\n components = []\n components << [self.class.id... | [
"0.71810544",
"0.684708",
"0.64292467",
"0.6294991",
"0.6265461",
"0.62143046",
"0.6108205",
"0.6094925",
"0.6072377",
"0.60315466",
"0.6025726",
"0.60173786",
"0.60107833",
"0.5993043",
"0.59814286",
"0.5969958",
"0.5956447",
"0.59559375",
"0.5955196",
"0.5955189",
"0.595079... | 0.81100625 | 0 |
Returns command specific byte array payload | def command_payload_bytes
raise MovingsignApi::NotImplementedError, "Needs to be implemented in subclass."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_bytes\n # set defaults\n self.sender ||= :pc\n self.receiver ||= 1\n\n bytes = []\n\n bytes.concat [0x00] * 5 # start of command\n bytes.concat [0x01] # <SOH>\n bytes.concat self.sender.to_bytes ... | [
"0.7354474",
"0.6897268",
"0.65994895",
"0.656849",
"0.6477026",
"0.6334336",
"0.6322776",
"0.6318373",
"0.63126856",
"0.62323517",
"0.61747783",
"0.6171956",
"0.6127085",
"0.60994333",
"0.606661",
"0.60506225",
"0.60489255",
"0.60284024",
"0.5969242",
"0.59648865",
"0.596299... | 0.7982039 | 0 |
set definition and create events | def definition_attributes=(definition_attributes)
self.definition = ActivityDefinition::BaseActivityDefinition.from_attributes definition_attributes
self.create_events_from_definition
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_events\n end",
"def events=(_); end",
"def add_events(new_events); end",
"def create_event(&blk)\n setup_event(Event.new, &blk)\n end",
"def create_event(&blk)\n setup_event(Event.new, &blk)\n end",
"def events; end",
"def events; end",
"def events; end",
"def events; en... | [
"0.65046895",
"0.6180855",
"0.60372907",
"0.6009934",
"0.6009934",
"0.59186745",
"0.59186745",
"0.59186745",
"0.59186745",
"0.59186745",
"0.59186745",
"0.59186745",
"0.59186745",
"0.581807",
"0.57004666",
"0.5691634",
"0.56817555",
"0.56817555",
"0.56667155",
"0.5655269",
"0.... | 0.63819176 | 1 |
POST /users/:user_id/uploads Create an upload for the given user. Uploading the image happens behind the scenes in the Upload model. | def create
@upload = @user.uploads.build(upload_params)
authorize @upload
respond_to do |format|
if @upload.save
format.json { render json: @upload }
format.html { redirect_to user_uploads_path(@user) }
else
format.json { render json: @upload.errors }
format.json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n new_uploads = create_upload_params\n new_uploads[:user_id] = current_or_guest_user.id\n\n @upload = Upload.new(new_uploads)\n\n if @upload.save\n flash[:success] = 'File Upload Successfully!'\n else\n flash[:danger] = 'An error occurred. Please try again!'\n flash[:error]... | [
"0.6854255",
"0.68072104",
"0.67978126",
"0.6712927",
"0.66030765",
"0.65874016",
"0.65626276",
"0.65153074",
"0.6510397",
"0.65059996",
"0.64965415",
"0.64402765",
"0.63979477",
"0.6385475",
"0.63621604",
"0.6350831",
"0.6311413",
"0.62960654",
"0.6290963",
"0.6235186",
"0.6... | 0.7407673 | 0 |
DELETE /users/:user_id/uploads/:id Deletes the given user upload. | def destroy
@upload = @user.uploads.find(params[:id])
authorize @upload
@upload.destroy
redirect_to user_uploads_path(@user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @file_upload=@user.file_uploads.find(params[:id])\n @file_upload.destroy\n respond_to do |format|\n format.html { redirect_to user_file_uploads_path, notice: 'File was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @upload = Uplo... | [
"0.7641387",
"0.7635752",
"0.76138973",
"0.73477024",
"0.7314545",
"0.7190245",
"0.7156397",
"0.7029481",
"0.702683",
"0.69799244",
"0.68886316",
"0.68665975",
"0.6859507",
"0.685198",
"0.68346083",
"0.68346083",
"0.6814951",
"0.6813265",
"0.6793797",
"0.6789968",
"0.6758627"... | 0.79707444 | 0 |
create grants array define a method to search for duplicates search for grant number in grants array | def grant_search(grants, grant_number)
# set up location = nil
return if grant_number == nil
duplicate_index = nil
# search grant hash in the array and if find the duplicate, then set up index # location
grants.each_with_index do |grant, i|
if grant[:grant_number] == grant_number
duplicate_index = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assigned_investors(sale_rep)\n assigned_accounts = []\n @hash_row_array.each do |hash|\n if hash[\"SALES_REP\"] == sale_rep\n if assigned_accounts.include?(hash[\"INVESTOR\"]) == false\n assigned_accounts << hash[\"INVESTOR\"]\n end\n end\n end\n return assigned_accounts\nend",
"de... | [
"0.58155155",
"0.5802426",
"0.55156547",
"0.54996395",
"0.54796195",
"0.5476039",
"0.5366088",
"0.5213238",
"0.5207325",
"0.51864105",
"0.5143237",
"0.5137791",
"0.51286554",
"0.5114434",
"0.5107566",
"0.50922084",
"0.50830376",
"0.5073611",
"0.5055734",
"0.5043852",
"0.50418... | 0.8186372 | 0 |
GET /helps/1 GET /helps/1.json | def show
@help = Help.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @help }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @helps = Help.all\n end",
"def show\n @need_help = NeedHelp.find(params[:id])\n\n respond_to do |format|\n format.json {render json: @need_help}\n end\n end",
"def helps(id)\n helps_data(request(\"needs/helps/#{id}.xml\", :auth => true))\n end",
"def index\n info = A... | [
"0.6366669",
"0.6175718",
"0.6076555",
"0.6050109",
"0.5977681",
"0.5977681",
"0.5915773",
"0.58807933",
"0.58522004",
"0.5826026",
"0.57899225",
"0.57687604",
"0.57653326",
"0.57600844",
"0.5758985",
"0.5728377",
"0.57199764",
"0.5718206",
"0.5716527",
"0.5713024",
"0.570569... | 0.62706476 | 1 |
GET /helps/new GET /helps/new.json | def new
@help = Help.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @help }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end",
"def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end... | [
"0.7165176",
"0.69918215",
"0.6981385",
"0.69103944",
"0.68859935",
"0.68859935",
"0.68542784",
"0.6852886",
"0.6852886",
"0.6852886",
"0.6852886",
"0.6852886",
"0.68443394",
"0.6836141",
"0.6821455",
"0.6821455",
"0.6821455",
"0.6821455",
"0.6821455",
"0.68069977",
"0.679305... | 0.7155981 | 1 |
Takes a cache method, and expiry predicate fn and a on_miss fn and returns the value of the cache_method | def read(cache_method, expired_fn: self.class.default_expired_fn, on_miss: F.identity)
if cache.send(cache_method) && !expired_fn.(cache, cache_method) #not_expired?(cache_method)
log_cache_hit
get(cache_method)
else
log_cache_failure
write(cache_method, on_miss.(get(cache_method)))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_expiration(method, expiration=:_get_)\n if expiration == :_get_\n method_expirations[method]\n else\n method_expirations[method] = expiration\n end\n end",
"def get(cache_method)\n cache.send(cache_method)\n end",
"def cache_op(meth, ck)\n if @cache_ignor... | [
"0.7117594",
"0.6905418",
"0.6483995",
"0.6477455",
"0.62455016",
"0.62071514",
"0.61068696",
"0.60646814",
"0.60338104",
"0.6000186",
"0.5984448",
"0.58621997",
"0.5859986",
"0.5843369",
"0.5829759",
"0.58256847",
"0.58198595",
"0.58131707",
"0.57464564",
"0.5714605",
"0.562... | 0.7913722 | 0 |
Look up the generator class. Require its class file, find the class in ObjectSpace, tag it with this spec, and return. | def klass
unless @klass
require class_file
@klass = lookup_class
@klass.spec = self
end
@klass
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_class\r\n ObjectSpace.each_object(Class) do |obj|\r\n return obj if obj.ancestors.include?(Rails::Generator::Base) and\r\n obj.name.split('::').last == class_name\r\n end\r\n raise NameError, \"Missing #{class_name} class in #{class_file}\"\... | [
"0.71939576",
"0.6148053",
"0.582786",
"0.5793454",
"0.5735687",
"0.5721393",
"0.56409436",
"0.56309843",
"0.5584267",
"0.5560206",
"0.5419704",
"0.5403766",
"0.54036635",
"0.53656346",
"0.53545034",
"0.5330423",
"0.5326593",
"0.5313185",
"0.53128207",
"0.53042924",
"0.529268... | 0.6203847 | 1 |
Search for the first Class descending from Rails::Generator::Base whose name matches the requested class name. | def lookup_class
ObjectSpace.each_object(Class) do |obj|
return obj if obj.ancestors.include?(Rails::Generator::Base) and
obj.name.split('::').last == class_name
end
raise NameError, "Missing #{class_name} class in #{class_file}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_class_named name\n return self if full_name == name\n return self if @name == name\n\n @classes.values.find do |klass|\n next if klass == self\n klass.find_class_named name\n end\n end",
"def find_class_named name\n @classes_hash[name]\n end",
"def find_class_named_from name... | [
"0.7820382",
"0.71787",
"0.7123441",
"0.69329756",
"0.67919314",
"0.6738578",
"0.66702116",
"0.6610641",
"0.6608143",
"0.6594133",
"0.6537088",
"0.6501001",
"0.6501001",
"0.64628756",
"0.64341855",
"0.642436",
"0.6412617",
"0.6384348",
"0.63720065",
"0.6351229",
"0.6347497",
... | 0.7827669 | 0 |
Return the watch for the object, or a new watch if none found. The new watch should be active if the object is new, correspoding to the watch being on by default when the user creates a new CI or Outage. | def watched_by_or_new(user)
watched_by(user) || watches.build(user: user, active: !persisted?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def watching?; @@watching == $$; end",
"def watcher(name)\n watchers.find { |watcher| watcher.name == name }\n end",
"def watch()\n merge(watch: 'true')\n end",
"def watch()\n merge(watch: 'true')\n end",
"def set_watch\n @watch = Watch.find(params[:id])\n end",
"d... | [
"0.63779765",
"0.6354847",
"0.6266074",
"0.6266074",
"0.61898947",
"0.61334044",
"0.61307955",
"0.6052805",
"0.6015678",
"0.5926923",
"0.5763291",
"0.5758302",
"0.56348324",
"0.555375",
"0.5520806",
"0.54550105",
"0.54289323",
"0.53874636",
"0.53708756",
"0.535469",
"0.533846... | 0.65043986 | 0 |
GET /active_stats/new GET /active_stats/new.json | def new
@active_stat = ActiveStat.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @active_stat }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stat }\n end\n end",
... | [
"0.745848",
"0.7391077",
"0.7301487",
"0.7186264",
"0.706984",
"0.7018928",
"0.70008487",
"0.687276",
"0.68291694",
"0.68188906",
"0.6749778",
"0.6730057",
"0.6730057",
"0.6717459",
"0.6698824",
"0.66893834",
"0.66827387",
"0.6679885",
"0.6630864",
"0.6626687",
"0.66025054",
... | 0.78863364 | 0 |
POST /active_stats POST /active_stats.json | def create
@active_stat = ActiveStat.new(params[:active_stat])
respond_to do |format|
if @active_stat.save
format.html { redirect_to @active_stat, :notice => 'Active stat was successfully created.' }
format.json { render :json => @active_stat, :status => :created, :location => @active_sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_stats\n first_time = @prev_stat.empty?\n stats = build_request\n @stat.keys.each { |k| stats[k] = @stat[k] - @prev_stat[k] }\n @prev_stat.replace(@stat)\n # These should be reported as absolute values\n [:mt, :ma, :mc].each {|k| @prev_stat[k] = 0}\n return if first_time\... | [
"0.6232018",
"0.6167029",
"0.6167029",
"0.6077778",
"0.59208536",
"0.5870383",
"0.5791311",
"0.57828367",
"0.5781357",
"0.5757478",
"0.56984824",
"0.568131",
"0.56515783",
"0.56470543",
"0.5643813",
"0.56373495",
"0.5625128",
"0.5615462",
"0.5611067",
"0.556822",
"0.5540162",... | 0.65523034 | 0 |
PUT /active_stats/1 PUT /active_stats/1.json | def update
@active_stat = ActiveStat.find(params[:id])
respond_to do |format|
if @active_stat.update_attributes(params[:active_stat])
format.html { redirect_to @active_stat, :notice => 'Active stat was successfully updated.' }
format.json { head :ok }
else
format.html { rend... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_stats\n StatService.new(self).update_stats\n end",
"def update\n @stat = Stat.find(params[:id])\n\n if @stat.update(stat_params)\n head :no_content\n else\n render json: @stat.errors, status: :unprocessable_entity\n end\n end",
"def update\n logger.debug(\"Update of #... | [
"0.6262326",
"0.62043226",
"0.60624444",
"0.6019305",
"0.6009201",
"0.5922534",
"0.5922534",
"0.5922534",
"0.5922534",
"0.5922534",
"0.5922534",
"0.5922534",
"0.5922534",
"0.5922534",
"0.5922534",
"0.5922534",
"0.5922534",
"0.5847465",
"0.58171886",
"0.58094674",
"0.58012223"... | 0.6814571 | 0 |
DELETE /active_stats/1 DELETE /active_stats/1.json | def destroy
@active_stat = ActiveStat.find(params[:id])
@active_stat.destroy
respond_to do |format|
format.html { redirect_to active_stats_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @backend_stat = Backend::Stat.find(params[:id])\n @backend_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to backend_stats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @stat = Stat.find(params[:id])\n @stat.destroy\n\n respond_to do... | [
"0.7446071",
"0.73452574",
"0.7344989",
"0.7132254",
"0.7132254",
"0.7132254",
"0.7132254",
"0.7132254",
"0.71168864",
"0.70970297",
"0.7095509",
"0.7095509",
"0.7091904",
"0.7001243",
"0.69636625",
"0.6953723",
"0.6946767",
"0.6903175",
"0.6852545",
"0.6835242",
"0.6826405",... | 0.77944946 | 0 |
GET /active_stats/team/1 GET /active_stats/team/1.json | def team
@team = Team.where('team_id = ?', params[:id])
@active_stats = ActiveStat.where('team_id = ?', params[:id])
respond_to do |format|
format.html
format.json
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_team_stats()\n query_params = { }\n headers = {}\n body = nil\n\n path = \"/team/stats\"\n\n @client.request(\n method: :get,\n path: path,\n query: query_params,\n headers: headers,\n body: body)\n end",
"def team(id)\n get \"/teams/#... | [
"0.78863543",
"0.7038234",
"0.702839",
"0.70033634",
"0.69328886",
"0.68993145",
"0.68926066",
"0.68735665",
"0.6866543",
"0.6856083",
"0.6825968",
"0.68066007",
"0.67841077",
"0.6777518",
"0.6755418",
"0.6755418",
"0.6755418",
"0.6755418",
"0.6754665",
"0.67120904",
"0.67113... | 0.774616 | 1 |
The schema defines some tags that may not be empty. This method removes any such empty tags from the tree. | def delete_invalid_empty_tags!(node)
node.children.reject! do |child|
if child.is_a?(TagNode)
if child.children.empty? and !@schema.tag_may_be_empty?(child.tag_name)
true
else
delete_invalid_empty_tags!(child)
false
end
end
end
node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_empty_tags\n sorted_tags = Tag.all.sort_by { |tag| tag.articles.count }\n return if sorted_tags.first.articles.count > 0\n\n sorted_tags.each { |tag| tag.delete if tag.articles.count == 0 }\n end",
"def delete_all_tags\n delete_tags(self.tags)\n nil\n end",
"def clean_al... | [
"0.67088604",
"0.62291735",
"0.6200493",
"0.6150672",
"0.6046417",
"0.60385215",
"0.6020291",
"0.5999883",
"0.5942662",
"0.593657",
"0.5911939",
"0.577986",
"0.57653075",
"0.57636946",
"0.5727941",
"0.5725904",
"0.56874764",
"0.56865513",
"0.56790555",
"0.5589185",
"0.5579459... | 0.7883007 | 0 |
Whether Markdown implements the PHP Markdown extra syntax. Note: it is not guaranteed that if this is false, then no special features will be used. | def markdown_extra?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markdown?\n @use_markdown && markdown_processor\n end",
"def markdown?\n defined?(RDiscount) or defined?(BlueCloth)\n end",
"def markdown?\n defined?(RDiscount) or defined?(BlueCloth)\n end",
"def latex?\n false\n end",
"def tomdoc?\n @format == 'tomdoc'\n end",
"def f... | [
"0.73895484",
"0.7143385",
"0.7143385",
"0.6540442",
"0.6231355",
"0.6106636",
"0.6106636",
"0.6010146",
"0.5995598",
"0.59906477",
"0.58403295",
"0.5759053",
"0.5759053",
"0.57428753",
"0.56916255",
"0.56916255",
"0.5666334",
"0.5665314",
"0.5660993",
"0.5660993",
"0.5652745... | 0.8003012 | 0 |
a Rational Number (two ints reping the num and denom of a rat num) outputs: Array (an arr of denoms that are part of an Egyptian Fraction rep of the num) reqs: take a Rational Number rtn an arr reping an Egyptian Fraction rep of the num struct: Array (to hold denoms) algo: init the output arr to [] init a sum at 0 init... | def egyptian(rat_num)
arr = []
sum = 0
temp_sum = sum
denom = 1
while sum < rat_num && denom < 1_000_000
temp_sum += Rational(1, denom)
if temp_sum > rat_num # overshot
temp_sum = sum # reset
else
sum = temp_sum
arr << denom
end
# p "denom = #{denom}, sum = #{sum}, arr = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def egyptian(rational)\n array = []\n n = 1\n remaining = rational\n until remaining == 0\n if remaining - Rational(1, n) >= 0\n array << n\n remaining = remaining - Rational(1, n)\n end\n n += 1\n end\n array\nend",
"def unegyptian(arr)\n sum = 0\n arr.each { |denom| sum += Rational(1... | [
"0.6782674",
"0.661094",
"0.65043896",
"0.6374127",
"0.6353443",
"0.63053936",
"0.6232218",
"0.61102",
"0.60121995",
"0.5889361",
"0.5883006",
"0.5878256",
"0.5858755",
"0.5800308",
"0.5800201",
"0.57821065",
"0.57633317",
"0.57446957",
"0.5668355",
"0.5632723",
"0.5608964",
... | 0.7269487 | 0 |
> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 230, 57960] inputs: Array (an arr of denoms that are part of an Egyptian Fraction rep of the num) outputs: a Rational Number (two ints reping the num and denom of a rat num) reqs: take an arr reping an Egyptian Fraction rep of the num rtn a Rational Number struct: num (to hold sum ... | def unegyptian(arr)
sum = 0
arr.each { |denom| sum += Rational(1, denom) }
sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def egyptian(rat_num)\n arr = []\n sum = 0\n temp_sum = sum\n denom = 1\n while sum < rat_num && denom < 1_000_000\n temp_sum += Rational(1, denom)\n if temp_sum > rat_num # overshot\n temp_sum = sum # reset\n else\n sum = temp_sum\n arr << denom\n end\n # p \"denom = #{denom}, s... | [
"0.74681574",
"0.6929715",
"0.68888867",
"0.6696607",
"0.66484076",
"0.6642132",
"0.66127056",
"0.6460344",
"0.6410816",
"0.6185238",
"0.61802244",
"0.61361647",
"0.61204296",
"0.61168563",
"0.60516393",
"0.60494816",
"0.6002087",
"0.59625614",
"0.58969295",
"0.58181685",
"0.... | 0.7453417 | 1 |
Reload the balancer data from the API | def balancer_reload(balancer)
if balancer.persisted?
begin
load_balancer_data(balancer)
rescue Miasma::Error::ApiError::RequestError => e
if e.response_error_msg.include?("LoadBalancerNotFound")
balancer.state = :terminated
ba... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_reload\n api.balancer_reload(self)\n end",
"def reload_data\n self.class.new reinit_endpoint.do_get\n end",
"def reload!\n fetch_data!\n end",
"def reload\n reset\n fetch\n end",
"def reload\n reset\n fetch\n ... | [
"0.7836738",
"0.73334336",
"0.7310872",
"0.72407776",
"0.72407776",
"0.7109553",
"0.70301884",
"0.6807721",
"0.6807721",
"0.6764059",
"0.6615204",
"0.66087914",
"0.6599976",
"0.6550208",
"0.6515741",
"0.64577997",
"0.6422918",
"0.63764524",
"0.63609815",
"0.63409334",
"0.6323... | 0.7354195 | 1 |
Fetch balancers or update provided balancer data | def load_balancer_data(balancer = nil)
params = Smash.new("Action" => "DescribeLoadBalancers")
if balancer
params["LoadBalancerNames.member.1"] = balancer.id || balancer.name
end
result = all_result_pages(nil, :body,
"DescribeLoadBa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def balancer_reload(balancer)\n if balancer.persisted?\n begin\n load_balancer_data(balancer)\n rescue Miasma::Error::ApiError::RequestError => e\n if e.response_error_msg.include?(\"LoadBalancerNotFound\")\n balancer.state = :terminated\n ... | [
"0.6357205",
"0.62527823",
"0.624059",
"0.61288977",
"0.6002497",
"0.5981547",
"0.58979493",
"0.5869539",
"0.58688635",
"0.58554137",
"0.57318085",
"0.5725863",
"0.56905466",
"0.56279457",
"0.56279457",
"0.55349386",
"0.55104166",
"0.5417317",
"0.5413467",
"0.5406602",
"0.540... | 0.74368066 | 0 |
Return all load balancers | def balancer_all(options = {})
load_balancer_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cabinet_balancers = Balancer.all\n end",
"def describe_load_balancers(ids = [], options = {})\n ids = [*ids]\n params = {}\n params['Marker'] = options[:marker] if options[:marker]\n params['PageSize'] = options[:page_size] if options[:page_size]\n pa... | [
"0.7522266",
"0.71692187",
"0.69277346",
"0.69092095",
"0.6514731",
"0.646942",
"0.6340497",
"0.6328993",
"0.6328993",
"0.6321338",
"0.62811565",
"0.6130564",
"0.60530114",
"0.5987703",
"0.59585774",
"0.575374",
"0.5741722",
"0.56703496",
"0.5657753",
"0.55636954",
"0.5553757... | 0.78813696 | 0 |
Round 3 Write a function called toonify that takes two parameters, accent and sentence. If accent is the string "daffy", return a modified version of sentence with all "s" replaced with "th". If the accent is "elmer", replace all "r" with "w". Feel free to add your own accents as well! If the accent is not recognized, ... | def toonify(accent, sentence)
if accent == 'daffy'
return sentence.gsub('s', 'th')
elsif accent == 'elmer'
return sentence.gsub('r', 'w')
else
return sentence
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toonify (accent, sentence)\n if accent == 'daffy'\n return sentence.gsub('s','th')\n elsif accent =='elmer'\n return sentence.gsub('r','w')\n else\n return sentence\n end\n end",
"def toonify(accent, sentence)\n\tif accent == \"daffy\"\n\t\tre = /s/\n\t\tsentence = sentence.replac... | [
"0.90410376",
"0.8999232",
"0.89314",
"0.89139175",
"0.88607925",
"0.88350093",
"0.88226575",
"0.8660102",
"0.86111856",
"0.85057545",
"0.8347041",
"0.8024091",
"0.79702425",
"0.65046346",
"0.6374063",
"0.63612473",
"0.61297655",
"0.6120786",
"0.6080848",
"0.60139555",
"0.600... | 0.90243095 | 1 |
POST /generic_monographs POST /generic_monographs.json | def create
@generic_monograph = DisGenericMonograph.new(generic_monograph_params)
if @generic_monograph.save
flash[:notice] = "Task was successfully created."
respond_with(@generic_monograph)
else
flash[:notice] = "Task was not created."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @dis_generic_monograph = DisGenericMonograph.new(dis_generic_monograph_params)\n\n respond_to do |format|\n if @dis_generic_monograph.save\n format.html { redirect_to @dis_generic_monograph, notice: 'Dis generic monograph was successfully created.' }\n format.json { render :sh... | [
"0.725019",
"0.6527183",
"0.62853223",
"0.6051462",
"0.5998686",
"0.5963242",
"0.5876825",
"0.5857509",
"0.5605803",
"0.55473804",
"0.55417436",
"0.55203605",
"0.55190766",
"0.5468318",
"0.5466052",
"0.5458591",
"0.54275644",
"0.54235107",
"0.54086214",
"0.5407188",
"0.539408... | 0.6588582 | 1 |
PATCH/PUT /generic_monographs/1 PATCH/PUT /generic_monographs/1.json | def update
respond_to do |format|
if @generic_monograph.update(generic_monograph_params)
format.html { redirect_to @generic_monograph, notice: 'Combination dose was successfully updated.' }
format.json { render :show, status: :ok, location: @generic_monograph }
else
format.html {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @dis_generic_monograph.update(dis_generic_monograph_params)\n format.html { redirect_to @dis_generic_monograph, notice: 'Dis generic monograph was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_generic_monograph }\n ... | [
"0.6950538",
"0.6186512",
"0.5912196",
"0.5759126",
"0.57323134",
"0.56698924",
"0.5642399",
"0.5625147",
"0.5555262",
"0.5549455",
"0.5546836",
"0.55107045",
"0.5506319",
"0.54964685",
"0.54658",
"0.5457902",
"0.54573303",
"0.5448029",
"0.54310054",
"0.5422654",
"0.54156387"... | 0.68079054 | 1 |
DELETE /generic_monographs/1 DELETE /generic_monographs/1.json | def destroy
@generic_monograph.destroy
respond_to do |format|
format.html { redirect_to generic_monographs_url, notice: 'Combination dose was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @dis_generic_monograph.destroy\n respond_to do |format|\n format.html { redirect_to dis_generic_monographs_url, notice: 'Dis generic monograph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mystic.destroy\n respond_to do |fo... | [
"0.7748482",
"0.6723113",
"0.6656479",
"0.66391724",
"0.6604661",
"0.6599597",
"0.65903807",
"0.65793365",
"0.6562374",
"0.65418124",
"0.65210265",
"0.64999",
"0.6478176",
"0.646106",
"0.6444571",
"0.64402825",
"0.64353585",
"0.64325583",
"0.64264965",
"0.6423313",
"0.6421916... | 0.7340774 | 1 |
Searches through the instance variables of the class and creates a class method on the MetricFu module to read the value of the instance variable from the Configuration class. | def add_class_methods_to_metric_fu
instance_variables.each do |name|
method_name = name[1..-1].to_sym
method = <<-EOF
def self.#{method_name}
configuration.send(:#{method_name})
end
EOF
MetricFu.module_eval(method)
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_variables() end",
"def method_missing(name, *args, &block)\n if !method_name_info(name).special?\n instance_variable_name = :\"@#{name}\"\n instance_variable_value = config[name]\n instance_variable_set instance_variable_name, instance_variable_value\n \n ... | [
"0.6010917",
"0.5988616",
"0.588814",
"0.55677986",
"0.55481255",
"0.5540865",
"0.5516397",
"0.5500667",
"0.53810984",
"0.53671795",
"0.5331947",
"0.5318712",
"0.530026",
"0.52369976",
"0.5236403",
"0.5220656",
"0.52202934",
"0.5204634",
"0.51872814",
"0.51872814",
"0.5153804... | 0.6367096 | 0 |
Searches through the instance variables of the class and creates an attribute accessor on this instance of the Configuration class for each instance variable. | def add_attr_accessors_to_self
instance_variables.each do |name|
method_name = name[1..-1].to_sym
MetricFu::Configuration.send(:attr_accessor, method_name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n config_hash = Huey::Request.get('config')\n Huey::Bridge::ATTRIBUTES.each do |attribute|\n instance_variable_set(\"@#{attribute}\", config_hash[attribute.to_s])\n end\n end",
"def create_attr_hash\n data = {}\n self.instance_variables.each do |attr|\n value = ... | [
"0.6576774",
"0.6414039",
"0.6355501",
"0.63488764",
"0.62890494",
"0.6238604",
"0.6233555",
"0.6225353",
"0.622486",
"0.61891216",
"0.6187179",
"0.6180488",
"0.6176758",
"0.6106808",
"0.61013865",
"0.6083923",
"0.6072704",
"0.60709083",
"0.6061361",
"0.6050953",
"0.6044307",... | 0.71927756 | 0 |
Add the :stats task to the AVAILABLE_METRICS constant if we're running within rails. | def set_metrics
if rails?
@metrics = MetricFu::AVAILABLE_METRICS + [:stats, :rails_best_practices]
else
@metrics = MetricFu::AVAILABLE_METRICS
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def metrics\n with_stats_lock do\n @stats_hash.keys.map { |spec| spec.to_s }\n end\n end",
"def register_metrics!\n return if @registered\n @registered = true\n with_instance do |t|\n # Worker related\n t.add_gauge :dynflow_active_worke... | [
"0.61399865",
"0.61227494",
"0.60120887",
"0.6007641",
"0.6007641",
"0.6007641",
"0.59117913",
"0.5882685",
"0.58672464",
"0.58121765",
"0.5812006",
"0.5781224",
"0.5742837",
"0.5701485",
"0.5663753",
"0.5661679",
"0.5651341",
"0.5615447",
"0.56116164",
"0.55966264",
"0.55572... | 0.6685454 | 0 |
this method will count all of the a specific trip instance has had. I'm guessing I can use a previous method written. Trips method? will give me an integer back. | def trip_count
trips.count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_count\n trips.count\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n self.trips.c... | [
"0.87917596",
"0.8513187",
"0.85097307",
"0.8508809",
"0.8508809",
"0.8508809",
"0.8505742",
"0.83736634",
"0.8358884",
"0.8353926",
"0.8282063",
"0.8274554",
"0.8274554",
"0.8222465",
"0.72403204",
"0.70993584",
"0.68197274",
"0.6807867",
"0.67699116",
"0.67570895",
"0.67570... | 0.8787178 | 1 |
Specifies the answers to be referred to by the given labels. These labels must match the labels given to Machinesend. def process_answers ary1 = [] ary2 = [] answers.each do |a| ... end label group1: ary1 label group2: ary2 end Use this method inside a process block or inside a Machineprocess_answers method definition. | def label (hash)
@labeled_answers.merge! hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_labeling\n process_adding_labels\n process_removing_labels\n end",
"def parse_labels\n @labels.split.each do |lbl|\n vals = lbl.split(':')\n v = vals.first\n case v\n when \"form\"\n handle_form_label vals\n when \"instrument\"\n handle_instrument_labe... | [
"0.57750314",
"0.56825393",
"0.5591151",
"0.5340398",
"0.5337138",
"0.53257984",
"0.52031136",
"0.51922965",
"0.51735103",
"0.5139653",
"0.51356506",
"0.5129648",
"0.5112378",
"0.51086885",
"0.51034516",
"0.5101648",
"0.5101648",
"0.5092396",
"0.49782306",
"0.4971085",
"0.496... | 0.6176948 | 0 |
Returns a hash of the answers currently at this machine, keyed by language | def answers_keyed_by_language
hash = Hash.new {|h,k| h[k] = [] }
answers.each {|answer| hash[answer.language] << answer }
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def answers\n @answers ||= {}\n end",
"def keyword_hash(lang=@lang)\n LANGUAGES[lang]\n end",
"def user_languages_hash\n result = Hash.new\n\n I18n.available_locales.each do |locale|\n result[t(\"languages.#{locale.to_s}\")] = locale.to_s\n end\n \n return result\n ... | [
"0.6481944",
"0.62176263",
"0.5996037",
"0.5932177",
"0.5854237",
"0.5819696",
"0.5778338",
"0.57440966",
"0.5615111",
"0.5573738",
"0.54959536",
"0.54569966",
"0.54465926",
"0.54162484",
"0.5410884",
"0.5382513",
"0.53544545",
"0.5345392",
"0.5334789",
"0.52785355",
"0.52781... | 0.7686113 | 0 |
Returns a new answer with the given blueprint and parents. def process_answers answers.each do |a| ary1 << make_answer(a.blueprint, a) ary2 << make_answer(a.blueprint.reverse, a) end label group1: ary1 label group2: ary2 end Use this method inside a process block or inside a Machineprocess_answers method definition. | def make_answer (blueprint, *parents)
parent_ids = parents.collect {|answer| answer.id }
Answer.new(nil, blueprint, @location, @location, parent_ids, Factory.cycle, nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_question_answer_tree\n before :each do\n @reply = 1\n @type_vendor = make_forms_for_app_type \"vendor\"\n @type_donor = make_forms_for_app_type \"donor\"\n \n @q1 = Questionnaire.create(:question => \"hello world\")\n @q2 = Questionnaire.create(:question => \"how are you?\... | [
"0.59596515",
"0.55361146",
"0.5426413",
"0.54173076",
"0.5416092",
"0.53365755",
"0.53365755",
"0.5334735",
"0.5283233",
"0.5237453",
"0.5222678",
"0.51908827",
"0.51536494",
"0.50896204",
"0.5064321",
"0.5054957",
"0.5046981",
"0.5016765",
"0.50117314",
"0.4989565",
"0.4980... | 0.69876224 | 0 |
Returns the number of answers currently at this machine without forcing the answers to load. def process_answers if answer_count > 500 ... end label group1: ary1 end Use this method inside a process block or inside a Machineprocess_answers method definition. | def answer_count
return @answers.length if @answers
Factory.count_answers_at_machine(@location)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bad_results\n answer_choice_count = {}\n answer_choices = self.answer_choices\n answer_choices.each do |answer_choice|\n answer_choice_count[answer_choice.answer_choice_body] = answer_choice.responses.length\n end\n\n answer_choice_count\n end",
"def n_results\n output = {}\n answe... | [
"0.62781805",
"0.62276155",
"0.6201172",
"0.61235964",
"0.60876024",
"0.60167545",
"0.6007431",
"0.6007431",
"0.5966726",
"0.5965637",
"0.59611744",
"0.5868931",
"0.5714675",
"0.5684064",
"0.56705743",
"0.566917",
"0.5668605",
"0.56296676",
"0.5516189",
"0.5510711",
"0.548838... | 0.6999388 | 0 |
PATCH/PUT /pricetypes/1 PATCH/PUT /pricetypes/1.json | def update
respond_to do |format|
if @pricetype.update(pricetype_params)
format.html { redirect_to @pricetype, notice: 'Pricetype was successfully updated.' }
format.json { render :show, status: :ok, location: @pricetype }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @type.update(type_params)\n end",
"def update\n respond_to do |format|\n if @spec_type.update(spec_type_params)\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully updated.' }\n format.json { render :show, status: :ok, location: @spec_type }\n e... | [
"0.6347546",
"0.6296984",
"0.6278799",
"0.6275465",
"0.6262482",
"0.62403977",
"0.62403977",
"0.62166166",
"0.61902964",
"0.6180412",
"0.6174437",
"0.61717933",
"0.61661386",
"0.61605716",
"0.6146162",
"0.614573",
"0.614209",
"0.61316186",
"0.6125931",
"0.6121973",
"0.6104092... | 0.6562807 | 0 |
DELETE /pricetypes/1 DELETE /pricetypes/1.json | def destroy
@pricetype.destroy
respond_to do |format|
format.html { redirect_to pricetypes_url, notice: 'Pricetype was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @type = Type.find(params[:type])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to company_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n respond_to do |format|\n ... | [
"0.73798156",
"0.7343801",
"0.721607",
"0.70976806",
"0.7091887",
"0.70742613",
"0.70742613",
"0.70737946",
"0.7067571",
"0.70593506",
"0.70551926",
"0.7036629",
"0.700738",
"0.69975984",
"0.6975472",
"0.6974206",
"0.69698375",
"0.6962976",
"0.69595975",
"0.6955237",
"0.69521... | 0.7376548 | 1 |
Wraps the deep_cloneable gem deep_clone method to allow using the predefined associations and options from our Cloneable.acts_as_cloneable macro. | def deep_clone!(options = {})
processed_options = Para::Cloneable::IncludeTreeBuilder.new(self, cloneable_options).build
options = options.reverse_merge(processed_options)
callback = build_clone_callback(options.delete(:prepare))
deep_clone(options) do |original, clone|
Para::Clon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deep_clone; end",
"def deep_clone\n return @deep_cloning_obj if @deep_cloning\n @deep_cloning_obj = clone\n @deep_cloning_obj.instance_variables.each do |var|\n val = @deep_cloning_obj.instance_variable_get(var)\n begin\n @deep_cloning = true\n val = val.deep_clone\n res... | [
"0.79374623",
"0.74966246",
"0.7482058",
"0.7159899",
"0.71067685",
"0.7042009",
"0.7020679",
"0.68281054",
"0.68103254",
"0.6760494",
"0.6750986",
"0.67439926",
"0.6689758",
"0.6678776",
"0.66758543",
"0.65711266",
"0.65700716",
"0.6535038",
"0.6527982",
"0.65121573",
"0.643... | 0.76570904 | 1 |
We ensure that the passed callback is actually callable on the object we're cloning. This is needed for associations because deep_cloneable calls the callback for every associated object. | def build_clone_callback(callback)
case callback
when Proc
callback
when Symbol
->(original, clone) {
original.send(callback, clone) if original.respond_to?(callback, true)
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone_pre_copy_hook(clone_source_object, _opts = {})\n clone_source_object\n end",
"def clone_temp\n clone.tap do |c|\n def c.save(*a)\n true\n end\n end\n end",
"def initialize_copy(orig) \n super\n @delegated_to_object = @delegated_to_object.clone\n ... | [
"0.5658105",
"0.50213337",
"0.49550936",
"0.49513608",
"0.4924511",
"0.49192488",
"0.49093536",
"0.48721215",
"0.48316348",
"0.48180613",
"0.48180613",
"0.48167148",
"0.48160154",
"0.47474736",
"0.47469723",
"0.47295466",
"0.47180298",
"0.47179538",
"0.47179538",
"0.47154334",
... | 0.75211847 | 0 |
Returns webdriver capabilities for chrome browser | def chrome_capabilities
Selenium::WebDriver::Remote::Capabilities.chrome(
logging_prefs: {browser: 'ALL'},
'chromeOptions' => {
'args' => %w[--ignore-certificate-errors],
'w3c' => false
},
'acceptSslCerts' => true,
'acceptInsecureCerts' => true
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_capabilities\n {\n :browserName => \"Chrome\",\n :version => nil,\n :platform => \"Linux\"\n }\n end",
"def browser_caps(browser,browser_options)\n target = (browser.to_sym if ENV['BROWSER'].nil? or ENV['browser'].empty?) || (ENV['BROWSER'].to_sym)\n ... | [
"0.7280506",
"0.70243466",
"0.6899227",
"0.680194",
"0.6686297",
"0.66435844",
"0.65800536",
"0.6466498",
"0.6454511",
"0.6454511",
"0.64074486",
"0.63275",
"0.6298335",
"0.6298335",
"0.6298335",
"0.6250818",
"0.624858",
"0.62260336",
"0.61855286",
"0.6182668",
"0.6165267",
... | 0.81232023 | 0 |
Registers :chrome webdriver options in Capybara framework | def register_chrome_driver
Capybara.register_driver :chrome do |app|
if ENV['SELENIUM_GRID'] == 'false'
Capybara::Selenium::Driver.new(app,
browser: :chrome,
desired_capabilities: chrome_capabilities)
else
Capy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scrapping_options\n opts = {\n headless: true\n }\n\n if Rails.env.production?\n if (chrome_bin = ENV.fetch('GOOGLE_CHROME_SHIM', nil))\n opts[:options] = { binary: chrome_bin }\n end\n else\n chrome_bin = '/usr/bin/google-chrome'\n opts[:options] = { binary: chrome_bin }\n end\n opts... | [
"0.7220167",
"0.70062333",
"0.6906341",
"0.6695963",
"0.65873945",
"0.65040004",
"0.64951307",
"0.64898086",
"0.64546084",
"0.64195466",
"0.6409399",
"0.6401847",
"0.6361569",
"0.6305533",
"0.6273613",
"0.6190459",
"0.61745954",
"0.61311656",
"0.6123459",
"0.6032418",
"0.6020... | 0.73800695 | 0 |
Returns webdriver capabilities for firefox browser | def firefox_capabilities
Selenium::WebDriver::Remote::Capabilities.firefox(
logging_prefs: {browser: 'ALL'},
'acceptSslCerts' => true,
'acceptInsecureCerts' => true,
'native_events' => true
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def firefox\n options = Selenium::WebDriver::Firefox::Options.new(profile: firefox_profile)\n options.headless! if config.headless\n\n options\n end",
"def firefox\r\n @web_browser.firefox\r\n end",
"def firefox\n @web_browser.firefox\n end",
"def default_capabilities\n ... | [
"0.7060469",
"0.70300734",
"0.7022445",
"0.69639164",
"0.6904549",
"0.66492707",
"0.65623003",
"0.6546828",
"0.65064734",
"0.64981073",
"0.63461965",
"0.63461965",
"0.63127154",
"0.63042223",
"0.6295552",
"0.6295552",
"0.6295552",
"0.62866884",
"0.61872965",
"0.6133089",
"0.6... | 0.865628 | 0 |
Registers :firefox webdriver options in Capybara framework | def register_firefox_driver
Capybara.register_driver :firefox do |app|
if ENV['SELENIUM_GRID'] == 'false'
options = Selenium::WebDriver::Firefox::Options.new
Capybara::Selenium::Driver.new(app, browser: :firefox,
options: options,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def firefox_options\n options = Selenium::WebDriver::Firefox::Options.new\n options.add_preference('intl.accept_languages', locale)\n options.add_argument('--headless') if headless\n options\n end",
"def firefox\n options = Selenium::WebDriver::Firefox::Options.new(profile: firefox_profile)\n ... | [
"0.7815109",
"0.7530077",
"0.7256108",
"0.7079577",
"0.68835956",
"0.6814004",
"0.6480904",
"0.6363908",
"0.6362734",
"0.6348524",
"0.63122797",
"0.62159866",
"0.6215542",
"0.6209992",
"0.6164417",
"0.6022008",
"0.59987974",
"0.59982044",
"0.5986009",
"0.5982393",
"0.5978406"... | 0.786688 | 0 |
Return absolute uri for path | def absolute_uri_path(path)
"#{root_uri}#{path}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uri(path)\n s = File::expand_path(path).gsub(DIR, \"\").gsub(File::SEPARATOR, '/')\n return s == '' ? '/' : s\n end",
"def uri(path)\n return File.join(@base_url, path)\n end",
"def absolute_url\n domain + path\n end",
"def path\n @path ||= filters.uri_escape(absolute_url) i... | [
"0.7787539",
"0.7586607",
"0.758113",
"0.7573215",
"0.7573215",
"0.7544063",
"0.747992",
"0.736957",
"0.73562634",
"0.7326265",
"0.7321616",
"0.73165345",
"0.72991306",
"0.7286656",
"0.7269893",
"0.7259619",
"0.7200553",
"0.71972775",
"0.7184429",
"0.71646506",
"0.7156175",
... | 0.85709447 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.