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 |
|---|---|---|---|---|---|---|
Filter the member ids and return only the FileSet ids (filter out child works) | def file_set_ids(work)
case work
when ActiveFedora::Base
::FileSet.search_with_conditions(id: work.member_ids).map(&:id)
when Valkyrie::Resource
Hyrax.custom_queries.find_child_file_set_ids(resource: work)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_files_with_access\n return [] unless id.present?\n member_file_set_title_ids.sort { |x,y| x[0].upcase <=> y[0].upcase }\n end",
"def file_set_ids\n @file_set_ids ||= Hyrax::SolrService.query(\"{!field f=has_model_ssim}FileSet\",\n ... | [
"0.6471242",
"0.62790644",
"0.62308514",
"0.61166453",
"0.61020875",
"0.60694194",
"0.60377336",
"0.6030241",
"0.6022832",
"0.5984974",
"0.58350545",
"0.58187276",
"0.5799518",
"0.5734219",
"0.57315433",
"0.5707714",
"0.56468433",
"0.5641047",
"0.5640787",
"0.55985355",
"0.55... | 0.724531 | 0 |
Helper method to check for beta tester | def is_beta_tester?
beta_tester
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def needs_beta_approval?\n fairness_level_comparison < 0\n end",
"def auto_beta\n if should_nightly?\n UI.message 'building nightly'\n nightly\n elsif should_beta?\n UI.message 'building beta'\n beta\n elsif has_api_keys?\n UI.message 'signing and building, but not deploying'\n build\n ... | [
"0.7040609",
"0.6687367",
"0.6630215",
"0.60963845",
"0.60924137",
"0.6021985",
"0.6015234",
"0.5999725",
"0.59935975",
"0.59506696",
"0.59261584",
"0.5911626",
"0.5900739",
"0.5897722",
"0.5889922",
"0.58875775",
"0.5882732",
"0.58672047",
"0.586622",
"0.58546513",
"0.582061... | 0.82514924 | 1 |
GET /trainings/1 GET /trainings/1.json | def show
@training = trainings.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @training }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trainings\n render json: @plan.trainings\n end",
"def index\n @trainings = Training.all\n end",
"def index\n @trainings = Training.all\n end",
"def index\n @trainings = Training.all\n end",
"def find(key)\n url = url_for(\"organizers\", credentials.organizer_key, \"trai... | [
"0.74484915",
"0.711328",
"0.711328",
"0.711328",
"0.69039685",
"0.68307686",
"0.68068457",
"0.6799327",
"0.67097276",
"0.65183014",
"0.65183014",
"0.65183014",
"0.650598",
"0.6488535",
"0.64826035",
"0.6470133",
"0.6448665",
"0.6407615",
"0.6387376",
"0.636871",
"0.62820524"... | 0.76275057 | 0 |
PUT /trainings/1 PUT /trainings/1.json | def update
@training = trainings.find(params[:id])
respond_to do |format|
if @training.update_attributes(params[training_param])
format.html { redirect_to @training, notice: 'Training was successfully updated.' }
format.json { head :no_content }
else
format.html { render act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @train.update(train_params)\n format.html { redirect_to @train, notice: 'Train was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @train.errors,... | [
"0.6820466",
"0.6719823",
"0.651404",
"0.645278",
"0.645278",
"0.645278",
"0.645278",
"0.645278",
"0.645278",
"0.645278",
"0.64038336",
"0.6382797",
"0.63691705",
"0.6353685",
"0.6345988",
"0.6345988",
"0.6345988",
"0.6345988",
"0.629294",
"0.6275884",
"0.6245249",
"0.61866... | 0.69071096 | 0 |
Monkeypatch of the original parse_tracking_response to include carrier, ship date, and arrival time. Changed lines are marked. | def parse_tracking_response(document)
response = {}
response[:tracking_numbers] = {}
track_node = REXML::XPath.first(document, '//ns1:FulfillmentShipmentPackage/ns1:TrackingNumber')
if track_node
id_node = REXML::XPath.first(document, '//ns1:MerchantFulfillmentOrderId')
response... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_and_store_time_info_to_delta_request(response_time_info_line)\n rts = response_time_info_line.split(',')\n start_time = rts[0].strip\n end_time = rts[1].strip\n duration = rts[2].strip.to_f\n self.start_time = start_time\n self.end_time = end_time\n self.duration = duration\n end",
... | [
"0.60381913",
"0.5896206",
"0.56001604",
"0.55901915",
"0.5527676",
"0.54632586",
"0.5450354",
"0.5399098",
"0.5332453",
"0.5305175",
"0.5275026",
"0.52396965",
"0.52318716",
"0.51926935",
"0.51465714",
"0.5115361",
"0.5069466",
"0.50456786",
"0.5018301",
"0.501307",
"0.49969... | 0.68656117 | 0 |
Returns the tracking number if there is one, else :error if there's a problem with the shipment that will result in a permanent failure to fulfill, else nil. | def track
sleep 1 # avoid throttle from Amazon
Spree::Fulfillment.log "amazon order id #{@shipment.number}"
resp = remote.fetch_tracking_raw(@shipment.number)
Spree::Fulfillment.log "#{resp.params}"
# This can happen, for example, if the SKU doesn't exist.
return :error if !resp.success? && re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order_tracking_number\n hash[\"OrderTrackingNumber\"]\n end",
"def track_shipment(shipment: nil)\n nil\n end",
"def tracking\n @shipments = current_user.shipments.order(\"created_at DESC\")\n #Searching Shipment between selected dates\n if params[:shipment_from].present? && par... | [
"0.65598273",
"0.6267988",
"0.61989325",
"0.61928433",
"0.61294496",
"0.6081786",
"0.58317906",
"0.57924765",
"0.57850856",
"0.5734796",
"0.5734796",
"0.5724519",
"0.5716747",
"0.56556016",
"0.5633379",
"0.5632768",
"0.5621784",
"0.5621784",
"0.5621784",
"0.5621784",
"0.56128... | 0.63805884 | 1 |
The start time of this measurement in UTC. | def utc_start_time
@time.utc.strftime("%Y-%m-%dT%H:%M:%S.000Z")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_time\n return @start_time\n end",
"def start_time\n @start_time\n end",
"def start_time\n @internal_data.start_time\n end",
"def start_time\n if ev = start_event.last\n ev.time\n end\n end",
... | [
"0.7968918",
"0.7964193",
"0.79081905",
"0.7786676",
"0.7786676",
"0.7770032",
"0.7770032",
"0.76926416",
"0.7628185",
"0.75825864",
"0.75712997",
"0.7565534",
"0.75503135",
"0.75433123",
"0.74285465",
"0.74285465",
"0.74285465",
"0.74285465",
"0.74285465",
"0.74285465",
"0.7... | 0.7982829 | 0 |
The stop time of this measurement in UTC. It's assumed to be 1 hour after the start as that is the current resolution of PG&E's data. | def utc_stop_time
one_hour = 60*60
(@time + one_hour).utc.strftime("%Y-%m-%dT%H:%M:%S.000Z")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_time\n if ev = stop_event.last\n ev.time\n end\n end",
"def end_time\n if ev = stop_event.last\n ev.time\n end\n end",
"def end_time\n return nil if empty?\n @start_time + (@v.size-1).hours\n end",
"d... | [
"0.73813426",
"0.73813426",
"0.7125828",
"0.7084352",
"0.7066164",
"0.6852032",
"0.6812503",
"0.67781126",
"0.6737414",
"0.6645315",
"0.6623392",
"0.66051304",
"0.65948457",
"0.65693957",
"0.656425",
"0.6562145",
"0.65562904",
"0.65179896",
"0.65095353",
"0.6504622",
"0.64782... | 0.799863 | 0 |
Interrogates the current state of the Sample. Returns [String] a compact representation of the Sample. | def inspect
"<Sample #{@time} #{@kwh}>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n \"state: #{@state}, line: #{@line_counter}, file: #{@file_name}\"\n end",
"def to_s\r\n s = StringIO.new\r\n newstate = map\r\n @initstate.each_with_index do |sum, i|\r\n if sum != newstate[i]\r\n s.write \"*\"\r\n @initstate[i] = newstate[i]\r\n ... | [
"0.66878086",
"0.662619",
"0.64929175",
"0.6489491",
"0.64709574",
"0.63696235",
"0.63193643",
"0.6304555",
"0.62740207",
"0.62740207",
"0.62348855",
"0.6176154",
"0.61586803",
"0.6147278",
"0.61324865",
"0.61300725",
"0.61206883",
"0.6116207",
"0.6113521",
"0.6101647",
"0.61... | 0.66632986 | 1 |
POST /dispositivos POST /dispositivos.json | def create
@dispositivo = Dispositivo.new(params[:dispositivo])
@dispositivo = current_user.dispositivos.build(params[:dispositivo])
#@dispositivo = current_usuario.dispositivos.build(params[:dispositivo])
respond_to do |format|
if @dispositivo.save
format.html { redirect_to @dispositivo, n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @dispositif = Dispositif.new(dispositif_params)\n\n respond_to do |format|\n if @dispositif.save\n format.html { redirect_to @dispositif, notice: 'Dispositif was successfully created.' }\n format.json { render :show, status: :created, location: @dispositif }\n else\n ... | [
"0.6141045",
"0.5933305",
"0.5899908",
"0.58714634",
"0.58574677",
"0.58507633",
"0.58262837",
"0.58136034",
"0.5793322",
"0.578817",
"0.5783932",
"0.57650155",
"0.5763711",
"0.57299757",
"0.5728305",
"0.57237756",
"0.57159877",
"0.57014096",
"0.5690005",
"0.5683885",
"0.5665... | 0.63205415 | 0 |
PUT /dispositivos/1 PUT /dispositivos/1.json | def update
@dispositivo = Dispositivo.find(params[:id])
respond_to do |format|
if @dispositivo.update_attributes(params[:dispositivo])
format.html { redirect_to @dispositivo, notice: 'Dispositivo was successfully updated.' }
format.json { head :no_content }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def update\n @solicitudrecurso = Solicitudrecurso.find(params[:id])\n \n\n respond_to do |format|\n\n \n if @solicitudrecurso.update_attributes(:motivos => params[:motivos])\n \n @solicit... | [
"0.6641212",
"0.652574",
"0.6474296",
"0.6375669",
"0.6355425",
"0.6337288",
"0.63276917",
"0.63017666",
"0.62796396",
"0.6263459",
"0.62575084",
"0.62337536",
"0.62073296",
"0.62069595",
"0.62017256",
"0.6187508",
"0.6184703",
"0.6165104",
"0.61507016",
"0.61474305",
"0.6132... | 0.6914731 | 0 |
DELETE /dispositivos/1 DELETE /dispositivos/1.json | def destroy
@dispositivo = Dispositivo.find(params[:id])
@dispositivo.destroy
respond_to do |format|
format.html { redirect_to dispositivos_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @indicativo = Indicativo.find(params[:id])\n @indicativo.destroy\n\n respond_to do |format|\n format.html { redirect_to indicativos_url }\n format.json { he... | [
"0.72955304",
"0.7250861",
"0.72332454",
"0.721966",
"0.7209894",
"0.7206364",
"0.71273106",
"0.7114913",
"0.7094192",
"0.7088178",
"0.7071084",
"0.7066437",
"0.70656055",
"0.70599127",
"0.70586926",
"0.705605",
"0.7054129",
"0.7048442",
"0.70472616",
"0.7034836",
"0.7028445"... | 0.7606117 | 0 |
Finds all circular primes below integer n. Circular primes are numbers for which all rotations of the digits themselves are prime. Ex: 197 is a circular prime because 197, 971, 719 are themselves prime. args: +n+ > the exclusive upper bound of our search space returns: an array of all circular primes in the range [1, n... | def circular_primes(n)
circular_primes = Set.new
Prime.each(n) do |prime|
circular = true
rotations = prime.to_s.length - 1
digits = prime.to_s.chars.map(&:to_i)
rotations.times do # For an n-digit number, there are n-1 rotations.
digits << digits.shift # 'Rotate' the digits. Ex: 197 -> 971
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def circular_primes_of (n)\n res = [n]\n tmp = origin = n.to_s\n (origin.length-1).times do |i|\n tmp.concat(tmp[0]); tmp[0] = ''\n if prime? tmp.to_i then res << tmp.to_i else return nil end\n end\n res\nend",
"def circular_primes(max)\n idx = 2 #numbers lower than 2 aren't prime\n circ_primes = [... | [
"0.79549193",
"0.74755985",
"0.7263239",
"0.72367",
"0.72136796",
"0.71380365",
"0.71145535",
"0.70597154",
"0.69722825",
"0.6957808",
"0.6927094",
"0.6901598",
"0.68762994",
"0.6829639",
"0.68236476",
"0.6820372",
"0.67871827",
"0.6772315",
"0.6769943",
"0.6769018",
"0.67374... | 0.8237169 | 0 |
Given an actor (or actress) row, get the movie or episode | def parse_actor_row(row)
# find actor name - scan until there are multiple spaces, or there
# is a quotation mark. That's where the name ends and the title
# information begins.
return nil if row.blank?
rest = ''
if match = ACTOR_FIRST_ROW_REGEX.match(row)
@current_last_name = match[1].s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def movie_with_actors movie\n sql = %Q[\n SELECT \n movies.title as movie, \n actors.name as actor\n FROM \n public.actors, \n public.movies_actors, \n public.movies\n WHERE \n movies.title ILIKE '%#{movie}%' AND\n movies_actors.actor_id = actors.i... | [
"0.6485847",
"0.6266108",
"0.6081391",
"0.6042099",
"0.5896063",
"0.5833565",
"0.5728465",
"0.5672187",
"0.5607341",
"0.5603711",
"0.55966836",
"0.55895764",
"0.5588863",
"0.55414945",
"0.5532684",
"0.5521915",
"0.5520956",
"0.551707",
"0.551629",
"0.54963577",
"0.5481273",
... | 0.6729211 | 0 |
reduce 709 omitted reduce 710 omitted reduce 711 omitted | def _reduce_712(val, _values, result)
result = nil
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_608(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_76(val, _values, result); end",
"def _reduce_76(val, _values, result); end",
... | [
"0.7134408",
"0.70582455",
"0.7025808",
"0.7025808",
"0.70193124",
"0.700103",
"0.69769764",
"0.69673234",
"0.69649833",
"0.6962725",
"0.69614875",
"0.69448256",
"0.69448256",
"0.6941336",
"0.6938446",
"0.69286",
"0.69237727",
"0.6923574",
"0.6923574",
"0.6915068",
"0.6914925... | 0.7164694 | 0 |
Returns current metrics for a specific component | def get_component_current_metrics(uuid, opts = {})
data, _status_code, _headers = get_component_current_metrics_with_http_info(uuid, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dependency_current_metrics(project_uuid, component_uuid, opts = {})\n data, _status_code, _headers = get_dependency_current_metrics_with_http_info(project_uuid, component_uuid, opts)\n data\n end",
"def get_active_metrics(from)\n @metric_svc.get_active_metrics(from)\n end",
"def me... | [
"0.7022309",
"0.68819064",
"0.66390866",
"0.6574385",
"0.65610856",
"0.65599525",
"0.65319085",
"0.6433514",
"0.62820923",
"0.626378",
"0.62607193",
"0.61806905",
"0.61726457",
"0.61364406",
"0.6021867",
"0.6011828",
"0.5997118",
"0.59855473",
"0.5941988",
"0.5866709",
"0.586... | 0.75043404 | 0 |
Returns current metrics for a specific dependency | def get_dependency_current_metrics(project_uuid, component_uuid, opts = {})
data, _status_code, _headers = get_dependency_current_metrics_with_http_info(project_uuid, component_uuid, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dependency_current_metrics_with_http_info(project_uuid, component_uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MetricsApi.get_dependency_current_metrics ...'\n end\n # verify the required parameter 'project_uuid' is set\n if @... | [
"0.6513026",
"0.6474385",
"0.63633937",
"0.62685955",
"0.61980915",
"0.6099908",
"0.6027442",
"0.59839404",
"0.5898996",
"0.5898507",
"0.58940065",
"0.5889642",
"0.582204",
"0.57003975",
"0.5695554",
"0.5607925",
"0.5593797",
"0.55854106",
"0.5560778",
"0.5556261",
"0.5548509... | 0.66843027 | 0 |
Returns current metrics for a specific dependency | def get_dependency_current_metrics_with_http_info(project_uuid, component_uuid, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: MetricsApi.get_dependency_current_metrics ...'
end
# verify the required parameter 'project_uuid' is set
if @api_client... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dependency_current_metrics(project_uuid, component_uuid, opts = {})\n data, _status_code, _headers = get_dependency_current_metrics_with_http_info(project_uuid, component_uuid, opts)\n data\n end",
"def metrics\n @metrics ||= collect_metrics\n end",
"def get_metrics\n {\n ... | [
"0.6685197",
"0.6476036",
"0.6364631",
"0.6270442",
"0.6200404",
"0.6100566",
"0.6028302",
"0.59844744",
"0.5899406",
"0.5898886",
"0.5894929",
"0.5890755",
"0.5822766",
"0.5701926",
"0.5697266",
"0.5609698",
"0.5595368",
"0.5586119",
"0.5562877",
"0.5558457",
"0.55505896",
... | 0.6512582 | 1 |
Returns current metrics for the entire portfolio | def get_portfolio_current_metrics(opts = {})
data, _status_code, _headers = get_portfolio_current_metrics_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_portfolio_current_metrics_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MetricsApi.get_portfolio_current_metrics ...'\n end\n # resource path\n local_var_path = '/v1/metrics/portfolio/current'\n\n # query paramete... | [
"0.6934879",
"0.6586578",
"0.65820956",
"0.64618456",
"0.641164",
"0.63297254",
"0.62902224",
"0.62498116",
"0.6226794",
"0.61405885",
"0.6111729",
"0.6001996",
"0.59794337",
"0.59765446",
"0.5967695",
"0.59581065",
"0.5957346",
"0.59393555",
"0.5928215",
"0.5876445",
"0.5867... | 0.74729836 | 0 |
Returns current metrics for the entire portfolio | def get_portfolio_current_metrics_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: MetricsApi.get_portfolio_current_metrics ...'
end
# resource path
local_var_path = '/v1/metrics/portfolio/current'
# query parameters
que... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_portfolio_current_metrics(opts = {})\n data, _status_code, _headers = get_portfolio_current_metrics_with_http_info(opts)\n data\n end",
"def get_portfolio\n return self.total_value_in_stocks + self.balance\n end",
"def last_year_portfolio_performance\n last_year_performance_all_stoc... | [
"0.74729836",
"0.6586578",
"0.65820956",
"0.64618456",
"0.641164",
"0.63297254",
"0.62902224",
"0.62498116",
"0.6226794",
"0.61405885",
"0.6111729",
"0.6001996",
"0.59794337",
"0.59765446",
"0.5967695",
"0.59581065",
"0.5957346",
"0.59393555",
"0.5928215",
"0.5876445",
"0.586... | 0.6934879 | 1 |
Returns current metrics for a specific project | def get_project_current_metrics(uuid, opts = {})
data, _status_code, _headers = get_project_current_metrics_with_http_info(uuid, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_project_current_metrics_with_http_info(uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MetricsApi.get_project_current_metrics ...'\n end\n # verify the required parameter 'uuid' is set\n if @api_client.config.client_side_validati... | [
"0.693826",
"0.6425427",
"0.604481",
"0.6013068",
"0.5980049",
"0.5977877",
"0.59771407",
"0.5943392",
"0.59150517",
"0.5895897",
"0.5870856",
"0.5864705",
"0.5861316",
"0.58085644",
"0.58082813",
"0.57127",
"0.5684747",
"0.5668891",
"0.56567156",
"0.5643321",
"0.5631272",
... | 0.74461526 | 0 |
Returns current metrics for a specific project | def get_project_current_metrics_with_http_info(uuid, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: MetricsApi.get_project_current_metrics ...'
end
# verify the required parameter 'uuid' is set
if @api_client.config.client_side_validation && uuid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_project_current_metrics(uuid, opts = {})\n data, _status_code, _headers = get_project_current_metrics_with_http_info(uuid, opts)\n data\n end",
"def get_project_metrics(project_id, event_type, resolution, from, to, opts = {})\n data, _status_code, _headers = get_project_metrics_with_htt... | [
"0.7444891",
"0.64238393",
"0.60466933",
"0.60135454",
"0.5978795",
"0.5977481",
"0.59768784",
"0.5947156",
"0.5913815",
"0.5896089",
"0.5871689",
"0.5863233",
"0.5862473",
"0.58096796",
"0.58078223",
"0.5711617",
"0.56848544",
"0.5668508",
"0.56577814",
"0.5643991",
"0.56323... | 0.6938324 | 1 |
Requests a refresh of a specific components metrics | def refresh_component_metrics_with_http_info(uuid, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: MetricsApi.refresh_component_metrics ...'
end
# verify the required parameter 'uuid' is set
if @api_client.config.client_side_validation && uuid.nil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_dependency_metrics_with_http_info(project_uuid, component_uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MetricsApi.refresh_dependency_metrics ...'\n end\n # verify the required parameter 'project_uuid' is set\n if @api_clie... | [
"0.64929205",
"0.6291834",
"0.6277406",
"0.6277406",
"0.62459517",
"0.62244517",
"0.6207395",
"0.6134558",
"0.6094011",
"0.6052735",
"0.60372627",
"0.5972412",
"0.5965947",
"0.5925777",
"0.592278",
"0.592278",
"0.5918575",
"0.59116006",
"0.5874841",
"0.5861946",
"0.5816646",
... | 0.69842386 | 0 |
Requests a refresh of a specific dependency metrics | def refresh_dependency_metrics_with_http_info(project_uuid, component_uuid, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: MetricsApi.refresh_dependency_metrics ...'
end
# verify the required parameter 'project_uuid' is set
if @api_client.config.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_component_metrics_with_http_info(uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MetricsApi.refresh_component_metrics ...'\n end\n # verify the required parameter 'uuid' is set\n if @api_client.config.client_side_validation &... | [
"0.624577",
"0.6038676",
"0.601758",
"0.58982456",
"0.5892157",
"0.58769983",
"0.58641696",
"0.58179885",
"0.58179885",
"0.5761473",
"0.57588375",
"0.5750026",
"0.57327324",
"0.56975937",
"0.5652172",
"0.56305",
"0.56246454",
"0.5619888",
"0.5602693",
"0.5594041",
"0.55846006... | 0.6870245 | 0 |
Requests a refresh of the portfolio metrics | def refresh_portfolio_metrics_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: MetricsApi.refresh_portfolio_metrics ...'
end
# resource path
local_var_path = '/v1/metrics/portfolio/refresh'
# query parameters
query_param... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_feature_cache \n get(\"/globalsettings.json/cache/refresh\")\nend",
"def refresh_portfolio_metrics(opts = {})\n data, _status_code, _headers = refresh_portfolio_metrics_with_http_info(opts)\n data\n end",
"def refresh!\n unpack(agent.get(url))\n self\n end",
"def refresh... | [
"0.65649414",
"0.6414426",
"0.6388917",
"0.6381372",
"0.6348395",
"0.6311716",
"0.61877733",
"0.6056171",
"0.6033536",
"0.6033536",
"0.601987",
"0.5978742",
"0.5952905",
"0.5952905",
"0.5952905",
"0.5891325",
"0.5868529",
"0.57808965",
"0.57688314",
"0.57688314",
"0.5764515",... | 0.72848946 | 0 |
Requests a refresh of a specific projects metrics | def refresh_project_metrics_with_http_info(uuid, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: MetricsApi.refresh_project_metrics ...'
end
# verify the required parameter 'uuid' is set
if @api_client.config.client_side_validation && uuid.nil?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_portfolio_metrics_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MetricsApi.refresh_portfolio_metrics ...'\n end\n # resource path\n local_var_path = '/v1/metrics/portfolio/refresh'\n\n # query parameters\n ... | [
"0.6369052",
"0.6129621",
"0.59499925",
"0.58923507",
"0.58616084",
"0.5750607",
"0.5739308",
"0.57009786",
"0.56965613",
"0.5681903",
"0.5679818",
"0.56420165",
"0.56405056",
"0.5627607",
"0.55871856",
"0.55829275",
"0.5557615",
"0.55433464",
"0.5535051",
"0.5530413",
"0.552... | 0.6787305 | 0 |
Puts +data+ onto the queue named +key+ | def put(key, data)
queue = queues(key)
return nil unless queue
@stats[:current_bytes] += data.size
@stats[:total_items] += 1
queue.push(data)
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enqueue! data\n @q << data\n self\n end",
"def putQueue( queue_name, data)\n params = Hash.new\n params['queue_name'] = queue_name\n params['data'] = data\n return doCurl(\"put\",\"/queue\",params)\n end",
"def put(data)\n end",
"def retrieve(key); @amq.queue(key); end",
... | [
"0.69379944",
"0.6892355",
"0.6856241",
"0.68039405",
"0.67975396",
"0.6717993",
"0.6653196",
"0.6617067",
"0.65926903",
"0.65846545",
"0.6577258",
"0.6568393",
"0.6563329",
"0.64551437",
"0.64512646",
"0.6450988",
"0.6387535",
"0.6384403",
"0.63783985",
"0.63705593",
"0.6364... | 0.84100246 | 0 |
Safely close all queues. | def close
@shutdown_mutex.lock
@queues.each_pair do |name,queue|
queue.close
@queues.delete(name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n @queue_filler.exit\n @queue.close\n end",
"def close\n @queue.close\n end",
"def close_all\n @connections.close_all\n end",
"def clear\n LOCK.synchronize do\n @queue.each { |_, jes| jes.each(&:close) }\n @queue.clear\n end\n end",
"def clear\n LOCK.s... | [
"0.71949464",
"0.6893037",
"0.6441888",
"0.6336662",
"0.63092136",
"0.6306011",
"0.62727696",
"0.62618643",
"0.6258099",
"0.62299365",
"0.6227227",
"0.6212704",
"0.60819876",
"0.60495716",
"0.60096246",
"0.5894206",
"0.5891737",
"0.5830131",
"0.58272386",
"0.5827229",
"0.5806... | 0.8277452 | 0 |
Adds a question to be written to the XML file. | def add_question(question)
@questions << question
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(new_question)\n\n\n\tquestions = File.open(\"/Users/Wipf/questions.txt\", \"a\")\n\n\tquestions.puts new_question\n\n\tquestions.close\n\n\tprint \"Question '#{new_question}' has been added\"\n\nend",
"def write_question_data_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.questions... | [
"0.6894625",
"0.64840126",
"0.6471729",
"0.64586",
"0.59354985",
"0.5786065",
"0.57543945",
"0.5726825",
"0.54737556",
"0.54667956",
"0.542982",
"0.5426964",
"0.5426964",
"0.5416855",
"0.5366143",
"0.53618777",
"0.5342653",
"0.5313948",
"0.53021455",
"0.5300819",
"0.5272744",... | 0.6856152 | 1 |
Writes the question data XML to a file. The file will be saved to the directory set earlier or the current directory if this was not set. | def write_question_data_xml
builder = Nokogiri::XML::Builder.new do |xml|
xml.questions {
@questions.each do |question|
xml.question {
xml.questionMidiFileName question.question_midi_filename
xml.answer {
xml.chordRoot CHORD_ROOT_NAMES[ques... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_file(directory)\n xml = \"\"\n xml << taxon_xml\n xml << enzyme_xml\n xml << n_terminal_xml if n_terminal\n xml << c_terminal_xml if c_terminal\n xml << ion_xml\n xml << mass_xml\n xml << motif_xml\n \n File.open(directory + PARAMETER_FILENAME, \"w\") do |file|\n fil... | [
"0.6190993",
"0.60605365",
"0.6017743",
"0.5840268",
"0.5805729",
"0.5805729",
"0.5716918",
"0.57009107",
"0.5665739",
"0.5546088",
"0.5501948",
"0.54470444",
"0.54125834",
"0.54047304",
"0.5384447",
"0.5379113",
"0.5374313",
"0.5369844",
"0.5359658",
"0.5343131",
"0.5309464"... | 0.7837909 | 0 |
used to find if any king moves are available. This also checks if a kings valid_moves puts the king in check | def any_king_moves?(king_pos, opp_moves)
opp_color = opponent_color(self[king_pos].color)
# Find all kings valid moves minus opponents moves that share the kings moves
(self[king_pos].valid_moves - all_opponent_moves(opp_color)).length == 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check?\n king_coords = current_player_king_coordinates\n return true unless build_DANGER_moves_array.empty?\n end",
"def compare_available_positions(king, moves)\n checkmate = []\n # Get king moves using King location\n king_moves = possible_moves(king[0], king[1])\n\n # Check if king move... | [
"0.77650845",
"0.75171727",
"0.72764677",
"0.72611594",
"0.7197541",
"0.7193625",
"0.7157636",
"0.7150077",
"0.7149266",
"0.7075609",
"0.70263517",
"0.69827205",
"0.6973165",
"0.6967036",
"0.69614106",
"0.694789",
"0.6937322",
"0.6933658",
"0.69234127",
"0.69133514",
"0.68789... | 0.78028715 | 0 |
Helper method for `setup_grid`. All empty spaces on the board is an Object `EmptyPiece` | def empty_rows
rows = [2, 3, 4, 5]
rows.each do |row|
@grid[row].map! { EmptyPiece.new }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty_spaces\n\t\t\tempty_spaces = []\n\n\t\t\t@board.each_with_index do |outer, row|\n\n\t\t\t\touter.each_with_index do |inner, col|\n\n\t\t\t\t\tif inner == fill_char\n\t\t\t\t\t\n\t\t\t\t\t\tspace = [row, col]\n\n\t\t\t\t\t\tempty_spaces <<\tspace\n\n\t\t\t\t\tend\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\tempty... | [
"0.7057203",
"0.7018135",
"0.6874984",
"0.6849886",
"0.67295843",
"0.6716466",
"0.6713302",
"0.6688335",
"0.663859",
"0.66217923",
"0.6612001",
"0.6598663",
"0.65077245",
"0.64888453",
"0.648517",
"0.6478042",
"0.64591944",
"0.6458164",
"0.6448367",
"0.64393115",
"0.6405819",... | 0.72005343 | 0 |
calculate m3 of biogas total | def total_m3_biogas
(calculations.collect(&:calc_m3_biogas).sum).round 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_m3_ch4\n\t\t(calculations.collect(&:calc_m3_ch4).sum).round 2\n\tend",
"def total_digestate_phosphorus\n\t\t(calculations.collect(&:calc_digestate_phosphorus).sum).round 3\n\tend",
"def benchsubtotal3\n @benchsubtotal3 = @benchsubtotal2 + @benchcafm + @benchhelpdesk\n end",
"def subtotal3\n... | [
"0.68837905",
"0.61905223",
"0.6103333",
"0.6086729",
"0.6050007",
"0.60207945",
"0.5998443",
"0.589742",
"0.5896067",
"0.58794",
"0.58388025",
"0.58037037",
"0.5759608",
"0.5732601",
"0.57058114",
"0.5705497",
"0.56831235",
"0.5648573",
"0.56325203",
"0.56324",
"0.56306416",... | 0.87755877 | 0 |
calculate m3 of methane total | def total_m3_ch4
(calculations.collect(&:calc_m3_ch4).sum).round 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_m3_biogas\n\t\t(calculations.collect(&:calc_m3_biogas).sum).round 2\n\tend",
"def m3; 3 end",
"def multiply_sum_by_3rd_argument\n\n end",
"def subtotal3\n @subtotal3 = @subtotal2 + @cafm + @helpdesk\n end",
"def benchsubtotal3\n @benchsubtotal3 = @benchsubtotal2 + @benchcafm + @benc... | [
"0.7245025",
"0.70748234",
"0.66522604",
"0.65535283",
"0.65237826",
"0.63929206",
"0.63067484",
"0.62044525",
"0.6179989",
"0.61542207",
"0.6146338",
"0.6142449",
"0.6129126",
"0.6103612",
"0.6062646",
"0.6050537",
"0.60303456",
"0.6026532",
"0.6026234",
"0.5998209",
"0.5991... | 0.7973878 | 0 |
calculate kgs methane total | def total_kg_ch4
(calculations.collect(&:calc_kg_ch4).sum).round 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def totalkcal\n\t\t\tkcalproteinas + kcallipidos + kcalglucidos\n\t\tend",
"def total; end",
"def valorenergeticoKcal\n veKJ=(cgrasas * 9) + (cgrasassa * 9) + (grasasmono * 9) + (grasaspoli * 9) + (hcarbono * 4) + (polialcoholes * 2.4) + (almidon * 4) + (fibra * 2) + (proteinas * 4) + (sal * 6)\... | [
"0.78463507",
"0.73391515",
"0.7121196",
"0.69250673",
"0.690143",
"0.6863056",
"0.68265635",
"0.68265635",
"0.6728622",
"0.67167693",
"0.67015696",
"0.66691613",
"0.65984774",
"0.6589646",
"0.658125",
"0.65617824",
"0.6548907",
"0.65284365",
"0.6515651",
"0.649666",
"0.64958... | 0.73509866 | 1 |
digestate totals calculate total digestate volume in tonnes | def total_digestate_tonnes
(calculations.collect(&:calc_digestate_tonnes).sum).round 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_digestate_nitrogen\n\t\t(calculations.collect(&:calc_digestate_nitrogen).sum).round 3\n\tend",
"def total_digestate_potash\n\t\t(calculations.collect(&:calc_digestate_potash).sum).round 3\n\tend",
"def total_digestate_phosphorus\n\t\t(calculations.collect(&:calc_digestate_phosphorus).sum).round 3\n\t... | [
"0.69809276",
"0.6973218",
"0.69516546",
"0.6505471",
"0.64996815",
"0.6192895",
"0.6185786",
"0.61765516",
"0.6127531",
"0.61081237",
"0.60883915",
"0.6082397",
"0.6078503",
"0.60561395",
"0.60410637",
"0.6019609",
"0.60070556",
"0.5993237",
"0.59901446",
"0.5970996",
"0.594... | 0.729016 | 0 |
calculate total nitrogen tonnes | def total_digestate_nitrogen
(calculations.collect(&:calc_digestate_nitrogen).sum).round 3
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_nicotin\n (Smoke.by_user(self.id).sum(:counted) * cigaret_nicotin).convert_to('milligram')\n .to_i\n .round(2)\n end",
"def total_tonnes\n\t\t(calculations.collect(&:tonnes).sum... | [
"0.7358016",
"0.6977093",
"0.6895042",
"0.67463493",
"0.6746002",
"0.66037005",
"0.65751505",
"0.6490092",
"0.6426676",
"0.64045006",
"0.63952327",
"0.6357501",
"0.6329861",
"0.6311196",
"0.63030964",
"0.62921286",
"0.62843186",
"0.62748706",
"0.6263221",
"0.62570465",
"0.620... | 0.71717864 | 1 |
calculate total phosphorus tonnes | def total_digestate_phosphorus
(calculations.collect(&:calc_digestate_phosphorus).sum).round 3
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_tonnes\n\t\t(calculations.collect(&:tonnes).sum).round 2\n\tend",
"def phat\n @phat ||= 1.0 * positive/total\n end",
"def gramos_total\n\t\tsuma = 0\n\t\t\n\t\t@gramos.each do |i|\n\t\t\tsuma += i\n\t\tend\n\n\t\treturn suma.round(2)\n\tend",
"def totalGramos\n\t\tgramos = 0\n\t\ttotal = 0\n\t\... | [
"0.70864964",
"0.69127643",
"0.67729133",
"0.6721064",
"0.6539481",
"0.648451",
"0.64551663",
"0.6405199",
"0.63520914",
"0.63090277",
"0.6189414",
"0.61812913",
"0.6172409",
"0.6129951",
"0.61062855",
"0.6104757",
"0.60873723",
"0.60594064",
"0.60362476",
"0.60312706",
"0.60... | 0.76365405 | 0 |
calculate total potash tonnes | def total_digestate_potash
(calculations.collect(&:calc_digestate_potash).sum).round 3
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_tonnes\n\t\t(calculations.collect(&:tonnes).sum).round 2\n\tend",
"def calculate_tar\n (Smoke.by_user(self.id).sum(:counted) * cigaret_tar).convert_to('milligram')\n .to_i\n .round(2)\n end... | [
"0.6993719",
"0.6934635",
"0.68074816",
"0.68031484",
"0.66151124",
"0.6570336",
"0.65679336",
"0.6475784",
"0.64734817",
"0.6439301",
"0.6435681",
"0.6404353",
"0.6400958",
"0.6390865",
"0.63708115",
"0.6350489",
"0.6337718",
"0.6335225",
"0.6316599",
"0.63127756",
"0.630790... | 0.72850394 | 0 |
CHP calculations calculate usable heat fixed conversion rate 0.5 | def chp_usable_heat(val1 = total_mwh_ch4, val2 = 0.5)
(val1 * val2).round 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_carbon_savings_from_chp_heat(val1= chp_salable_heat, val2= 1.1, val3= 0.272)\n\t\t(val1 * val2 * val3).round 2\n\tend",
"def chp_salable_heat(val1= chp_usable_heat, val2 = 0.5)\n\t\t(val1 * val2).round 2\n\tend",
"def heat_based_input_capacity\n fetch(:heat_based_input_capacity) do\n i... | [
"0.7091575",
"0.65765285",
"0.6263588",
"0.610108",
"0.60227674",
"0.5960486",
"0.59514457",
"0.59407854",
"0.5887835",
"0.5819201",
"0.5797917",
"0.5791525",
"0.5745442",
"0.57339287",
"0.5731341",
"0.5690942",
"0.56868684",
"0.56836164",
"0.5678369",
"0.5678369",
"0.5677966... | 0.71405184 | 0 |
calculate salable heat fixed conversion rate 0.5 | def chp_salable_heat(val1= chp_usable_heat, val2 = 0.5)
(val1 * val2).round 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_carbon_savings_from_chp_heat(val1= chp_salable_heat, val2= 1.1, val3= 0.272)\n\t\t(val1 * val2 * val3).round 2\n\tend",
"def chp_usable_heat(val1 = total_mwh_ch4, val2 = 0.5)\n\t\t(val1 * val2).round 2\n\tend",
"def shiny_rate\n 16\n end",
"def rh_factor; end",
"def speed_of_spread\n #in... | [
"0.7068783",
"0.65492475",
"0.59901816",
"0.59762114",
"0.59442884",
"0.59442884",
"0.5903608",
"0.5875624",
"0.58723634",
"0.5869392",
"0.5869025",
"0.5864465",
"0.586321",
"0.5854879",
"0.5848838",
"0.5848153",
"0.58434004",
"0.58159024",
"0.58082354",
"0.5808223",
"0.58022... | 0.7085512 | 0 |
calculate carbon displaced for chp heat fixed value primary factor 1.1 fixed value emission factor 0.272 | def calc_carbon_savings_from_chp_heat(val1= chp_salable_heat, val2= 1.1, val3= 0.272)
(val1 * val2 * val3).round 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f2c(temp_f)\n (temp_f - 32) * 5 / 9\nend",
"def chp_usable_heat(val1 = total_mwh_ch4, val2 = 0.5)\n\t\t(val1 * val2).round 2\n\tend",
"def f2c(t)\n\treturn (t - 32) * 5.fdiv(9)\nend",
"def indicator_carbono()\n\t\t\t\tc = totalGei() / @alimentsList.length\n\t\t\t\t# c is the avg grams of co2 per plate... | [
"0.61210436",
"0.5985348",
"0.5956381",
"0.588661",
"0.5658602",
"0.56416416",
"0.5610715",
"0.5568937",
"0.5561437",
"0.554838",
"0.5511614",
"0.5485233",
"0.54826313",
"0.54609543",
"0.5445048",
"0.5441293",
"0.543217",
"0.54110867",
"0.5395919",
"0.536611",
"0.5363251",
... | 0.64903456 | 0 |
calculate carbon displaced by chp elec fixed value primary factor = 2.7 fixed value emission factor = 0.643 | def calc_carbon_savings_from_chp_elec(val1= chp_salable_elec, val2= 2.7, val3= 0.643)
(val1 * val2 * val3).round 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_carbon_savings_from_chp_heat(val1= chp_salable_heat, val2= 1.1, val3= 0.272)\n\t\t(val1 * val2 * val3).round 2\n\tend",
"def indicator_carbono()\n\t\t\t\tc = totalGei() / @alimentsList.length\n\t\t\t\t# c is the avg grams of co2 per plate\n\n\t\t\t\tif c < 670\n\t\t\t\t\treturn 1.0\n\t\t\t\telsif c <= 8... | [
"0.6597371",
"0.6341615",
"0.6012515",
"0.5980096",
"0.59452415",
"0.5911031",
"0.59056586",
"0.5818905",
"0.5815592",
"0.57970136",
"0.5783874",
"0.5771513",
"0.57635516",
"0.5714615",
"0.5710316",
"0.5701382",
"0.569924",
"0.5683082",
"0.567601",
"0.5673315",
"0.56677616",
... | 0.68586385 | 0 |
calculate potential elec income | def calc_potential_income_elec(val1= chp_salable_elec, val2= elec_price)
(val1 * val2).round 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def net_operating_income\n total_annual_rent_collected - total_annual_expenses\n end",
"def calc_potential_upg_income_vehicle(val1= calc_upg_ch4, val2= 0.81)\n\t\t(val1 * val2).round 2\n\tend",
"def calc_total_potential_income_chp(val1= calc_potential_income_heat, val2= calc_potential_income_elec)\n\t\tval... | [
"0.7040481",
"0.6944907",
"0.6887785",
"0.659494",
"0.659494",
"0.6557345",
"0.65366906",
"0.65331995",
"0.6525201",
"0.6507955",
"0.646362",
"0.6418495",
"0.6416998",
"0.6405059",
"0.63669366",
"0.6356619",
"0.63531196",
"0.63472706",
"0.63374716",
"0.63128215",
"0.63008773"... | 0.8024886 | 0 |
calculate total chp potential income | def calc_total_potential_income_chp(val1= calc_potential_income_heat, val2= calc_potential_income_elec)
val1 + val2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CPI\n if self.spent_hours>0 and self.estimated_hours>0\n earned_value= (self.completed_percent * self.estimated_hours)/100\n actual_cost=self.spent_hours\n return (earned_value/actual_cost)\n else\n return 0\n end\n\n rescue\n return 0\n ... | [
"0.68578815",
"0.6715173",
"0.66249025",
"0.65505403",
"0.6544516",
"0.65295786",
"0.6460228",
"0.64449525",
"0.64403975",
"0.64214724",
"0.6421279",
"0.640812",
"0.63974154",
"0.6391541",
"0.6391541",
"0.63690907",
"0.6340119",
"0.6318906",
"0.6283707",
"0.6280883",
"0.62776... | 0.7727691 | 0 |
calculate upgrading ch4 loss fixed value 3.35% | def calc_upg_ch4_loss(val1= total_m3_ch4, val2= 0.0335)
(val1 * val2).round 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eth_gain\n return ((eth_value - eth_initial) / eth_value) * 100\n end",
"def loss_percent(current_price)\n price = self.price.present? ? self.price : 0.0\n (self.loss_price(current_price)*100/price).round(2)\n end",
"def group_historical_loss_ratio\n @peer_group.try(:actual_lr).to_f\n ... | [
"0.6436446",
"0.64210695",
"0.6235474",
"0.6161203",
"0.6059224",
"0.60350746",
"0.5996198",
"0.5983851",
"0.5983851",
"0.5884493",
"0.587598",
"0.5871688",
"0.5846385",
"0.5819814",
"0.58174074",
"0.58094925",
"0.5799295",
"0.5798208",
"0.57910323",
"0.57831776",
"0.5779753"... | 0.7389339 | 0 |
calculate ch4 upgraded per hour | def calc_upg_ch4_per_hour(val1= calc_upg_ch4, val2= 364 * 24)
(val1 / val2).round 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fuel_per_hour\n 10\n end",
"def total_day_kwh_usage_on(date)\n raise \"Invalid argument: Please use a date value that is not in the future\" if (date > Time.now.utc.to_date)\n\n cumulative_hourly_kwh_usage = 0.0\n (0..23).each do |i|\n cumulative_hourly_kwh_usage += self.total_hour_kwh_usag... | [
"0.5621303",
"0.5579879",
"0.55710965",
"0.5384447",
"0.53523326",
"0.53488857",
"0.5345623",
"0.5337202",
"0.5298155",
"0.52782536",
"0.5258119",
"0.5245818",
"0.52340955",
"0.5227323",
"0.5225437",
"0.5224529",
"0.5183367",
"0.51621544",
"0.51427656",
"0.5126123",
"0.511703... | 0.63602155 | 0 |
calculate potential value of wholesale gas grid sales | def calc_potential_gas_grid_income(val1= calc_upg_therms, val2= 0.96)
(val1 * val2).round 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gasoline_gal\n @current_gasoline ||= quantity * fuel_per_hour * hours_per_year\n end",
"def book_value(period='enddate', basis, exclude)\n salearray = []\n sales = self.book_sales(period, basis, exclude)\n sales.each do |sale|\n salearray << sale.value_by_band.inject(0) { |sum, i| sum + i.t... | [
"0.63092303",
"0.628727",
"0.62834567",
"0.6265152",
"0.62097824",
"0.61631197",
"0.6131014",
"0.6131014",
"0.60980433",
"0.60277116",
"0.5976461",
"0.5967431",
"0.59657073",
"0.5946969",
"0.5935116",
"0.5935007",
"0.593094",
"0.58880514",
"0.5878968",
"0.5877245",
"0.5863036... | 0.6847544 | 0 |
calculate potential number of private homes fueled assume annual gas use is 13800 kwh or 1.38 mwh | def calc_potential_homes_fueled(val1= calc_upg_mwh_ch4, val2= 13.8)
(val1 / val2).round 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_digestate_potash\n\t\t(calculations.collect(&:calc_digestate_potash).sum).round 3\n\tend",
"def mileage(miles_driven, gas_used)\n if gas_used == 0\n return 0.0\n end\n miles_driven / gas_used\nend",
"def mileage(miles_driven, gas_used)\n if gas_used == 0\n return 0.0\n end\n miles_driven ... | [
"0.62110376",
"0.6168185",
"0.6168185",
"0.6154684",
"0.61414784",
"0.6125645",
"0.61160594",
"0.6095162",
"0.6086913",
"0.60831714",
"0.60712844",
"0.60598034",
"0.6039229",
"0.6027108",
"0.60089004",
"0.60055184",
"0.5894642",
"0.5886598",
"0.5883424",
"0.588134",
"0.588125... | 0.67192835 | 0 |
calculate potential carbon displaced from gas grid fixed primary factor = 1.1 fixed emission factor = 0.203 | def calc_carbon_savings_from_upg_ggrid(val1= calc_upg_mwh_ch4, val2= 1.1, val3= 0.203)
(val1 * val2 * val3).round 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_potential_gas_grid_income(val1= calc_upg_therms, val2= 0.96)\n\t\t(val1 * val2).round 2\n\tend",
"def indicator_carbono()\n\t\t\t\tc = totalGei() / @alimentsList.length\n\t\t\t\t# c is the avg grams of co2 per plate\n\n\t\t\t\tif c < 670\n\t\t\t\t\treturn 1.0\n\t\t\t\telsif c <= 830\n\t\t\t\t\treturn 2.... | [
"0.5859707",
"0.58302844",
"0.5757078",
"0.56866395",
"0.56455463",
"0.55468976",
"0.5536345",
"0.552179",
"0.5476678",
"0.54762435",
"0.5469305",
"0.54529506",
"0.5445148",
"0.5432239",
"0.53753406",
"0.5336376",
"0.53300947",
"0.5327605",
"0.5324108",
"0.52939755",
"0.52923... | 0.58833826 | 0 |
Initializes a new category with the given +name+ and +options+ | def uhook_new_from_name name, options = {}
::Category.new(
:name => name,
:locale => (options[:locale] || :any).to_s,
:parent_id => options[:parent_id]
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(category_options={})\n @id = category_options[\"id\"]\n @name = category_options[\"name\"]\n end",
"def initialize(category:, id:, name:)\n @category, @id, @name = category, id, name\n end",
"def category(name, options = { }, &block)\n category = ::MetaEvents::Definition::C... | [
"0.78956926",
"0.70468926",
"0.69986117",
"0.6945332",
"0.6916393",
"0.681485",
"0.66791296",
"0.6677993",
"0.66526556",
"0.66291314",
"0.65460986",
"0.6531978",
"0.6495657",
"0.64574915",
"0.6456735",
"0.63834924",
"0.63249797",
"0.6295727",
"0.6294744",
"0.62797505",
"0.625... | 0.7274067 | 1 |
Returns the fittest category in the requested locale | def uhook_select_fittest category, options = {}
options[:locale] ? (category.in_locale(options[:locale]) || category) : category
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_category\n CATEGORY_KEYS[product_category] || ['n/a']\n end",
"def category_name\n I18n.t(\"feste.categories.#{category}\", default: category.titleize)\n end",
"def uhook_index_search_subject\n ::Category.locale(current_locale, :all)\n end",
"def uhook_category_parti... | [
"0.601515",
"0.6000717",
"0.59921086",
"0.57330567",
"0.5713531",
"0.5626888",
"0.5504401",
"0.54933876",
"0.54389125",
"0.5435073",
"0.5433379",
"0.5348683",
"0.5323454",
"0.531004",
"0.52587503",
"0.525722",
"0.52540696",
"0.52440715",
"0.5220063",
"0.51956457",
"0.5165564"... | 0.68735874 | 0 |
Returns content to show in the sidebar when editing a category | def uhook_edit_category_sidebar category
show_translations(category, :hide_preview_link => true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n render json: { content: render_to_string(partial: 'integral/backend/categories/modal', locals: { category: @resource, title: 'Edit Category', modal_id: \"modal--category-edit-#{@resource.id}\" }) }\n end",
"def uhook_new_category_sidebar category\n show_translations(category, :h... | [
"0.6842574",
"0.68406385",
"0.68133587",
"0.6670415",
"0.65511775",
"0.6459907",
"0.64220834",
"0.64220834",
"0.64139646",
"0.6405468",
"0.6341358",
"0.63256",
"0.6323848",
"0.632113",
"0.632113",
"0.62788516",
"0.6275623",
"0.6227195",
"0.61568487",
"0.61401737",
"0.6126869"... | 0.7433263 | 0 |
Returns content to show in the sidebar when creating a category | def uhook_new_category_sidebar category
show_translations(category, :hide_preview_link => true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sidebar_filter_categories(categories)\n html_code = ''\n if !categories.children.empty?\n\n html_code += '<div class=\"sidebar-module-container\">\n <div class=\"sidebar-filter\">\n <div class=\"sidebar-widget outer-bottom-small wow fadeInUp animated\"... | [
"0.6741695",
"0.6576318",
"0.6448055",
"0.63696146",
"0.6350639",
"0.63295346",
"0.62854195",
"0.6269136",
"0.62213135",
"0.6216479",
"0.613598",
"0.6115879",
"0.61019725",
"0.60984796",
"0.609365",
"0.6081731",
"0.60749036",
"0.60667235",
"0.60635674",
"0.6061225",
"0.604826... | 0.7192182 | 0 |
Returns the available actions links for a given category | def uhook_category_index_actions category_set, category
actions = []
if category.in_locale?(current_locale)
actions << category_view_link(category, category_set)
end
if category.in_locale?(current_locale)
actions << category_edit_link(category... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def category_links(category)\n links = \"\"\n iterated_cat = category\n if iterated_cat.parent.nil?\n links = insert_category_link(links,iterated_cat)\n else \n i = 0\n while !iterated_cat.parent.nil? and iterated_cat != Sfcatnode.root\n links = insert_category_link(links,iter... | [
"0.6833556",
"0.6328017",
"0.63271815",
"0.6185177",
"0.6185177",
"0.6185177",
"0.6185177",
"0.60692436",
"0.6026194",
"0.6003461",
"0.59924334",
"0.597646",
"0.5916344",
"0.5777802",
"0.5771844",
"0.5770151",
"0.5752863",
"0.571848",
"0.568542",
"0.5668534",
"0.56608385",
... | 0.6909422 | 0 |
Performs any required action on category when in show | def uhook_show_category category
unless category.in_locale?(current_locale)
redirect_to(ubiquo.category_set_categories_url)
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n authorize! :read, @category\n end",
"def show\n authorize! :read, @category\n end",
"def show_in_category\n @category = PostCategory.find_by(slug: params[:category_slug], deleted: false)\n @entity = Post.find_by(slug: params[:slug], deleted: false)\n if @entity.nil? || !@entity.... | [
"0.7095606",
"0.70259523",
"0.68838257",
"0.68810207",
"0.6863894",
"0.6804994",
"0.6761751",
"0.6737694",
"0.6689721",
"0.6638373",
"0.66123015",
"0.65721923",
"0.65635556",
"0.6542726",
"0.6466033",
"0.64621335",
"0.6428936",
"0.64112556",
"0.6390711",
"0.63807344",
"0.6354... | 0.70582145 | 1 |
Converts an argument to an parse tree (an ASTNode instance) | def coerce(arg)
case arg
when AstNode
arg
when Proc, String
CodeTree::parse(arg)
else
raise "Unable to coerce #{arg.inspect} to a CodeTree::AstNode"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argument_node; end",
"def node(type, *args)\n AST.new(type, args)\n end",
"def convert_argument_node(node, index)\n if node.is_a?(Array)\n node = node.map { |n| convert_argument_node(n, index) }\n else\n if node.identifier?\n node = node.updated(:local_variable)... | [
"0.59530365",
"0.5931683",
"0.5914792",
"0.57459813",
"0.5682716",
"0.5532927",
"0.55152154",
"0.55152154",
"0.5504824",
"0.5503228",
"0.54995835",
"0.5486936",
"0.54590017",
"0.5455037",
"0.54474276",
"0.5410227",
"0.53866225",
"0.5385247",
"0.53690517",
"0.5300857",
"0.5300... | 0.6652454 | 0 |
get the raw comment text for the given action from the the given filename | def find_raw_comment_for(filename, action)
@file_info_cache[filename].method_list.each do |m|
if m.name == action
return m.comment
end
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_comment(filename, action)\n DocUtil.extract_info(@comment_parser.parse(find_raw_comment_for(filename, action)))\n end",
"def parse_action_comment(folder)\n resource_name = @resource_group[:file_path].match(/([a-zA-Z_-]+)_spec\\.rb/)[1].singularize\n file_path = folder.is_a?(Proc) ? folder.c... | [
"0.827522",
"0.6758544",
"0.60716575",
"0.60575014",
"0.5911477",
"0.5871662",
"0.57535934",
"0.5610607",
"0.5382825",
"0.5374385",
"0.5360917",
"0.5348571",
"0.5318532",
"0.53080595",
"0.5287524",
"0.5267982",
"0.5256641",
"0.5238967",
"0.52321446",
"0.52237856",
"0.52081513... | 0.83301055 | 0 |
create a hash of the subcomponents of a path, the key is the subcomponent name, the value is a full subpath (which can be rendered as a link) if the value if nil, it mean there is no such suppath | def get_breadcrumb_hash(path)
ret = {}
path_components = DocUtil.path_to_arr(path)
path_components.each_index do |i|
next if i == 0
sub_path = DocUtil.arr_to_path(path_components[0..i])
if @route_info.keys.include?(sub_path)
ret[path_components[i]] = sub_path
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_component\n path_component = \"/#{self.class.endpoint_name}\"\n path_component += '/' + key_value if key_value\n path_component\n end",
"def paths\n {\n :homepage => '/',\n :people => '/people',\n :work => '/work',\n :labs => '/labs',\n :\"find-us\" => '/find-us',\n ... | [
"0.61184525",
"0.60735476",
"0.595502",
"0.59167546",
"0.58554083",
"0.5854382",
"0.58296716",
"0.58086324",
"0.5741213",
"0.5697927",
"0.56877184",
"0.5665206",
"0.56493807",
"0.5597614",
"0.55788326",
"0.5573098",
"0.5493405",
"0.548109",
"0.54418564",
"0.5438585",
"0.54349... | 0.6716143 | 0 |
get all the subpaths of a given path | def get_subresources(path)
ret = []
@route_info.keys.sort.each do |sub|
if RAPIDoc.is_sub_path(path, sub)
ret << sub
end
end
return ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SubPaths()\n #puts \"Searching subpaths in #{to_s()}\"\n entries = Dir.entries(AbsolutePath())\n subPaths = []\n \n #puts \"Found entries #{entries}\"\n \n entries.each do |entry|\n if(entry == \"..\" || entry == \".\")\n next\n end\n \n c... | [
"0.7338683",
"0.69371015",
"0.69181323",
"0.6692638",
"0.66531897",
"0.66531897",
"0.6585925",
"0.6566039",
"0.6550515",
"0.64974135",
"0.6401194",
"0.63411736",
"0.63321257",
"0.6293113",
"0.6284394",
"0.6282438",
"0.6243373",
"0.6243373",
"0.6218364",
"0.6207992",
"0.620669... | 0.7465076 | 0 |
returns an array representing a tree of the resource nodes | def calculate_resource_tree(path)
ret = []
resources = @route_info[path].subresources
return ret if resources.empty?
parent = {}
resources.each_index do |i|
if i == 0
ret << i
parent[i] = ret
elsif RAPIDoc.is_child(resources, i-1, i)
# start... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jstree_data\n Resource.tree.ordered.roots.map { |res| parse_jstree_node(res) }\n end",
"def get_resource_tree\n {\n method: \"Page.getResourceTree\"\n }\n end",
"def nodes\n []\n end",
"def x_get_tree_roots\n objects = [\n {:id => \"sis\", :text... | [
"0.73343474",
"0.69477797",
"0.68296796",
"0.67224836",
"0.6683917",
"0.65153563",
"0.6507323",
"0.65031815",
"0.6480859",
"0.6457119",
"0.6408778",
"0.6387972",
"0.6373433",
"0.6341233",
"0.63314414",
"0.6308369",
"0.6303977",
"0.6285462",
"0.6285462",
"0.62676704",
"0.62676... | 0.7062946 | 1 |
adds the opts to the type, where type is :gen, :out, or :in. takes opts as either a hash or a list: hash obconv.add_opts!(:out, d: true, u: true, p: 10 ) list obconv.add_opts!(:out, :d, :u, [:p, 10] ) returns self | def add_opts!(type=:gen, *opts)
opt_type = OpenBabel::OBConversion.const_get(type.to_s.upcase.<<("OPTIONS"))
hash =
if opts.first.is_a?(Hash)
opts.first
else
opts.inject({}) do |hsh,v|
if v.is_a?(Array)
hsh[v[0]] = v[1]
else
hsh[v] = true... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_options(opts)\n opts\n end",
"def build_opts(opts)\n {}.tap do |o|\n o[:serialize] = if opts[:serialize] && opts[:serialize].is_a?(Array)\n opts[:serialize].map(&:to_s)\n else\n []\n end\n\n o[:only] = opts[:only] || [\"add\", \"remov... | [
"0.67003953",
"0.5996636",
"0.59570503",
"0.58360714",
"0.57751405",
"0.5625925",
"0.5625925",
"0.55180216",
"0.55066735",
"0.55008864",
"0.54790384",
"0.5465375",
"0.5414669",
"0.5402268",
"0.5399143",
"0.539892",
"0.53667665",
"0.5312539",
"0.5301459",
"0.5242397",
"0.51888... | 0.8050075 | 0 |
Code which can be used to find addcuts from molecule containing them | def find_internal_adducts(mol = self)
mol.adducts ||= []
splits = mol.ob.separate.map(&:upcast).flatten.each {|m| mol.adducts << m if ADDUCTS.values.include?(m) }
mol.adducts = mol.adducts.uniq(&:csmiles)
# TODO add a filter to remove the captured adducts from the molecule
#??? mol = mol.o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_cut(meth)\n @__cuts__ ||= []\n c = @__cuts__.detect{ |c| ! c.instance_methods.include?(meth) }\n if ! c\n x = (@__cuts__.empty? ? self : self.cuts.last)\n c = Class.new(x) { extend CutExtend; include CutInclude }\n c.base_class = self\n @__cuts__ << c\n end\n c\n end",
... | [
"0.5448065",
"0.5157963",
"0.51436144",
"0.51360506",
"0.50599396",
"0.49442035",
"0.4922229",
"0.48570126",
"0.48546168",
"0.48454276",
"0.4813162",
"0.48101884",
"0.47578737",
"0.47433603",
"0.4737634",
"0.47334626",
"0.47274336",
"0.47176644",
"0.47173578",
"0.47042066",
"... | 0.60964066 | 0 |
arg may be a Fixnum, a Symbol (Elemental symbol that is a Symbol), or a Rubabel::Atom. Returns the newly associated/created atom. | def associate_atom!(arg)
if arg.is_a?(Rubabel::Atom)
@ob.add_atom(arg.ob)
arg
else
(num, is_aromatic) =
if arg.is_a?(Symbol)
[Rubabel::ELEMENT_TO_NUM[arg], (arg.to_s.capitalize != arg.to_s)]
else
[arg, false]
end
new_oba... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_atom!(arg=6, bond_order=1, attach_to=nil)\n attach_to ||= atoms.last\n atom = associate_atom!(arg)\n add_bond!(attach_to, atom, bond_order) if attach_to\n atom\n end",
"def bond!(arg, bond_order=1)\n mol.add_atom!(arg, bond_order, self)\n end",
"def atom\n begin\n ... | [
"0.6987793",
"0.5657757",
"0.55890185",
"0.557424",
"0.54944587",
"0.5423405",
"0.52465504",
"0.52458626",
"0.5129341",
"0.51291984",
"0.5125793",
"0.5072083",
"0.50052917",
"0.5001609",
"0.4999369",
"0.49979034",
"0.49967933",
"0.49946147",
"0.4983919",
"0.4961467",
"0.49614... | 0.78910404 | 0 |
returns the atom passed in or that was created. arg is a preexisting atom, an atomic number or an element symbol (e.g. :c). default is to add carbon. | def add_atom!(arg=6, bond_order=1, attach_to=nil)
attach_to ||= atoms.last
atom = associate_atom!(arg)
add_bond!(attach_to, atom, bond_order) if attach_to
atom
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def associate_atom!(arg)\n if arg.is_a?(Rubabel::Atom)\n @ob.add_atom(arg.ob)\n arg\n else\n (num, is_aromatic) = \n if arg.is_a?(Symbol)\n [Rubabel::ELEMENT_TO_NUM[arg], (arg.to_s.capitalize != arg.to_s)]\n else\n [arg, false]\n end\n... | [
"0.61474794",
"0.5689518",
"0.5392669",
"0.5096857",
"0.503211",
"0.49259982",
"0.48773244",
"0.4808677",
"0.48035288",
"0.47769266",
"0.47419065",
"0.4590337",
"0.45533767",
"0.45506746",
"0.4520864",
"0.45061886",
"0.4469373",
"0.44610235",
"0.4456409",
"0.44334316",
"0.440... | 0.5770634 | 1 |
returns the exact_mass corrected for charge gain/loss | def mass
@ob.get_exact_mass - (@ob.get_total_charge * Rubabel::MASS_E)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def experiMass(mass, charge, diff)\n ((mass + diff) + (charge.to_f * 1.00727646677)) / charge\n end",
"def experiMass(mass, charge, diff)\n ((mass + diff) + (charge.to_f * 1.00727646677)) / charge\n end",
"def calMass(mass, charge)\n (mass + (charge.to_f * 1.00727646677)) / charge\n end",
"def ca... | [
"0.7305833",
"0.7305833",
"0.7288076",
"0.7288076",
"0.6644365",
"0.6612196",
"0.6599678",
"0.6411416",
"0.63379514",
"0.62615466",
"0.6230695",
"0.6208254",
"0.617845",
"0.60845476",
"0.6061601",
"0.60284966",
"0.5985279",
"0.5973039",
"0.5969478",
"0.582728",
"0.58194417",
... | 0.7565354 | 0 |
returns a list of atom indices matching the patterns (corresponds to the OBSmartsPattern::GetUMapList() method if uniq==true and GetMapList method if uniq==false). Note that the original GetUMapList returns atom numbers (i.e., the index + 1). This method returns the zero indexed indices. | def smarts_indices(smarts_or_string, uniq=true)
mthd = uniq ? :get_umap_list : :get_map_list
pattern = smarts_or_string.is_a?(Rubabel::Smarts) ? smarts_or_string : Rubabel::Smarts.new(smarts_or_string)
pattern.ob.match(@ob)
pattern.ob.send(mthd).map {|atm_indices| atm_indices.map {|i| i - 1 } }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pattern_indexes\n self.bits ||= 0\n array = bits.to_s(2).rjust(self.step_count, '0').chars.each_with_index.map do |value, index|\n index if value == '1'\n end\n array.compact\n end",
"def get_matching_indices pattern\n matches = []\n @obj.content.each_with_index { |e,i| \n ... | [
"0.67281014",
"0.6374899",
"0.6121888",
"0.5726235",
"0.5723935",
"0.57168365",
"0.5541578",
"0.5428842",
"0.53704464",
"0.5369961",
"0.53595203",
"0.52374375",
"0.522977",
"0.519576",
"0.51762056",
"0.51652396",
"0.5125004",
"0.5082091",
"0.5063857",
"0.50444674",
"0.4991247... | 0.67252004 | 1 |
only adds polar hydrogens. returns self | def add_polar_h!
@ob.add_polar_hydrogens
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_h!(ph=nil, polaronly=false)\n if ph.nil?\n @ob.add_hydrogens(polaronly)\n else\n @ob.add_hydrogens(polaronly, true, ph)\n end\n self\n end",
"def do_with_hydrogens(ph=nil, polaronly=false, &block)\n hydr_added = @ob.has_hydrogens_added\n add_h!(ph, polaronly... | [
"0.75696814",
"0.6353384",
"0.5734326",
"0.568589",
"0.54563904",
"0.5340623",
"0.5221294",
"0.51782054",
"0.51368624",
"0.51098585",
"0.5061477",
"0.49841413",
"0.4965531",
"0.49581435",
"0.49497584",
"0.493817",
"0.48960406",
"0.48676056",
"0.48487803",
"0.4833604",
"0.4801... | 0.83679056 | 0 |
returns self. If ph is nil, then neutral! is called | def correct_for_ph!(ph=7.4)
ph.nil? ? neutral! : @ob.correct_for_ph(ph)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neutral!\n had_hydrogens = h_added?\n atoms.each {|atom| atom.charge = 0 if (atom.charge != 0) }\n remove_h!\n add_h! if had_hydrogens \n self\n end",
"def ph\n read_attr :ph\n end",
"def empty\n h = Hand.new\n h.copy_all(self)\n super\n h... | [
"0.60820717",
"0.5275527",
"0.4985994",
"0.4985994",
"0.48896417",
"0.4857969",
"0.48535535",
"0.4850299",
"0.48086256",
"0.4777799",
"0.4766482",
"0.47505477",
"0.4730909",
"0.47027293",
"0.46332008",
"0.46229702",
"0.4618399",
"0.4618399",
"0.460683",
"0.46052793",
"0.46002... | 0.7349976 | 0 |
simple method to coerce the molecule into a neutral charge state. It does this by removing any charge from each atom and then removing the hydrogens (which will then can be added back by the user and will be added back with proper valence). If the molecule had hydrogens added it will return the molecule with hydrogens ... | def neutral!
had_hydrogens = h_added?
atoms.each {|atom| atom.charge = 0 if (atom.charge != 0) }
remove_h!
add_h! if had_hydrogens
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_without_hydrogens(&block)\n _obmol = @ob.get_parent\n had_hydrogens = _obmol.has_hydrogens_added\n _obmol.delete_hydrogens(self.ob) if had_hydrogens\n reply = block.call(had_hydrogens)\n _obmol.add_hydrogens(self.ob) if had_hydrogens\n reply\n end",
"def resetHypothese()\n... | [
"0.51168877",
"0.5103436",
"0.5046053",
"0.50205046",
"0.49453935",
"0.49453935",
"0.48888606",
"0.4836903",
"0.47817254",
"0.47568306",
"0.47311354",
"0.47305295",
"0.4728025",
"0.47255734",
"0.4717832",
"0.47159007",
"0.46966302",
"0.46934694",
"0.4690697",
"0.4689803",
"0.... | 0.81677514 | 0 |
returns just the smiles string :smi (not the id) | def smiles
to_s(:smi)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def smile\n\n oper = @message.split(\" \")[0]\n val1 = @message.split(\" \")[1].to_i\n val2 = @message.split(\" \")[2].to_i\n\n eyes = [\"O\",\"o\",\"^\",\"*\" ]\n mouths = [\"_\",\"__\",\".\" ]\n\n symmetry = rand(1) > 0\n\n lefteye = eyes.shuffle[0]\n right... | [
"0.5675656",
"0.52469224",
"0.51914287",
"0.50903004",
"0.50847703",
"0.50395447",
"0.5031672",
"0.50129956",
"0.5006075",
"0.49999252",
"0.4984309",
"0.4977675",
"0.4977675",
"0.4956502",
"0.4940794",
"0.4939122",
"0.49282256",
"0.49153322",
"0.48979113",
"0.48896393",
"0.48... | 0.804131 | 0 |
defined as whether the csmiles strings are identical. This incorporates more information than the FP2 fingerprint, for instance (try changing the charge and see how it does not influence the fingerprint). Obviously, things like title or data will not be evaluated with ==. See equal? if you are looking for identity. Mor... | def ==(other)
other.respond_to?(:csmiles) && (csmiles == other.csmiles)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_isomorphic(s, t)\n s = s.split(//)\n s_dup = s.detect {|dup| s.count(dup) > 1}\n s_dup_inx = s.each_index.select{|ind| s[ind] == s_dup}\n\n t = t.split(//)\n t_dup = t.detect {|dup| t.count(dup) > 1}\n t_dup_inx = t.each_index.select{|ind| t[ind] == t_dup}\n\n return s_dup_inx == t_dup_inx\nend",
"... | [
"0.62069875",
"0.615386",
"0.61407036",
"0.6081648",
"0.6000384",
"0.59941113",
"0.5961282",
"0.59599644",
"0.5928758",
"0.5919754",
"0.588723",
"0.587777",
"0.58641267",
"0.5860528",
"0.58582914",
"0.5855899",
"0.5837448",
"0.58196837",
"0.5812019",
"0.5789473",
"0.5788994",... | 0.62351215 | 0 |
iterates over the molecule's Rubabel::Atom objects | def each_atom(&block)
# could use the C++ iterator in the future
block or return enum_for(__method__)
iter = @ob.begin_atoms
atom = @ob.begin_atom(iter)
while atom
block.call atom.upcast
atom = @ob.next_atom(iter)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_atom(&block)\n block or return enum_for(__method__)\n iter = @ob.begin_bonds\n _atom = @ob.begin_nbr_atom(iter)\n while _atom\n block.call _atom.upcast\n _atom = @ob.next_nbr_atom(iter)\n end\n end",
"def each\n @molecules.each do |mol|\n yield mol\n ... | [
"0.6970734",
"0.66176206",
"0.6616765",
"0.6616765",
"0.5972154",
"0.56026256",
"0.5512422",
"0.5401684",
"0.5306294",
"0.5295126",
"0.52784616",
"0.5189552",
"0.5184258",
"0.5174355",
"0.5156288",
"0.51550305",
"0.5114378",
"0.5109912",
"0.5105772",
"0.5105225",
"0.5103881",... | 0.73133504 | 0 |
iterates over the molecule's Rubabel::Bond objects | def each_bond(&block)
# could use the C++ iterator in the future
block or return enum_for(__method__)
iter = @ob.begin_bonds
obbond = @ob.begin_bond(iter)
while obbond
block.call obbond.upcast
obbond = @ob.next_bond(iter)
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bonds\n each_bond.map.to_a\n end",
"def bonds\n each_bond.map.to_a\n end",
"def bond(atomids)\n #pp atomids\n if atomids.size != 2\n raise SizeError\n end\n atoms = []\n atomids.each do |atomid|\n atom = atom_by_id(atomid)\n raise AtomNotFoundError, atomid unle... | [
"0.6610751",
"0.6610751",
"0.6396702",
"0.5932344",
"0.57392544",
"0.55528134",
"0.55516905",
"0.55407435",
"0.5470353",
"0.5429616",
"0.5351253",
"0.53470147",
"0.53184295",
"0.5315987",
"0.5313306",
"0.5256326",
"0.52285",
"0.5210247",
"0.51894283",
"0.51855415",
"0.5184152... | 0.77293366 | 0 |
gets the bond by id | def bond(id)
@ob.get_bond_by_id(id).upcast
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_bond\n @bond = Bond.find(params[:id])\n end",
"def set_bond\n @bond = Bond.find(params[:id])\n end",
"def load(id)\n #find connction by identifier from .gift\n end",
"def get_relation(id)\n @relations[id.to_i]\n end",
"def get_by_db4o_id(id)\n obj = ... | [
"0.6852718",
"0.6852718",
"0.6487985",
"0.6342515",
"0.6277374",
"0.61747605",
"0.61159056",
"0.6068429",
"0.6032214",
"0.5987994",
"0.5985671",
"0.5925068",
"0.5925068",
"0.59127617",
"0.59117025",
"0.58908933",
"0.58896947",
"0.5868927",
"0.5866537",
"0.58104765",
"0.579901... | 0.7594055 | 0 |
returns the array of bonds. Consider using each_bond | def bonds
each_bond.map.to_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_bond(&block)\n # could use the C++ iterator in the future\n block or return enum_for(__method__)\n iter = @ob.begin_bonds\n obbond = @ob.begin_bond(iter)\n while obbond\n block.call obbond.upcast\n obbond = @ob.next_bond(iter)\n end\n self\n end",
"def... | [
"0.6612723",
"0.6055683",
"0.59265846",
"0.59254515",
"0.5681503",
"0.55322325",
"0.5507255",
"0.54169774",
"0.5350012",
"0.52894866",
"0.5253684",
"0.5192009",
"0.5190137",
"0.5149285",
"0.51452273",
"0.51446265",
"0.51425797",
"0.5129579",
"0.51250947",
"0.50786763",
"0.506... | 0.9179735 | 1 |
gets the atom by id | def atom(id)
@ob.get_atom_by_id(id).upcast
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_atom(id)\n @hive_party.get(\"/atoms/#{id}\") \n end",
"def atom_by_id(atom_id)\n elem_num, perio = atom_id.split('-')\n /^(\\D+)(\\d+)/ =~ elem_num\n elem = $1\n num = $2\n perio ||= '555'\n atom = atoms_of_element(elem)[num.to_i - 1]\n vec = perio.split(//).map { |figure| fi... | [
"0.83021164",
"0.68321353",
"0.6807312",
"0.6779026",
"0.6771151",
"0.673604",
"0.67352307",
"0.6702029",
"0.6641058",
"0.65480673",
"0.65305895",
"0.65208334",
"0.6517548",
"0.6516804",
"0.6479925",
"0.6444777",
"0.6444777",
"0.6431486",
"0.64135015",
"0.64018726",
"0.639535... | 0.7252581 | 1 |
returns the array of atoms. Consider using each | def atoms
each_atom.map.to_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](i)\n\t\tatoms[i]\n\tend",
"def [](*args)\n atoms[*args]\n end",
"def to_a\n Array(each)\n end",
"def each_atom(&block)\n # could use the C++ iterator in the future\n block or return enum_for(__method__)\n iter = @ob.begin_atoms\n atom = @ob.begin_atom(iter)\n w... | [
"0.6725148",
"0.64645535",
"0.63100284",
"0.62419796",
"0.6114659",
"0.6114659",
"0.6114659",
"0.604095",
"0.58665246",
"0.5818798",
"0.5816451",
"0.5801325",
"0.57789767",
"0.57789767",
"0.5752523",
"0.56790185",
"0.56660664",
"0.56568754",
"0.56417793",
"0.56417793",
"0.561... | 0.8702879 | 1 |
if given a bond, deletes it (doesn't garbage collect). If given two atoms, deletes the bond between them. | def delete_bond(*args)
case args.size
when 1
@ob.delete_bond(args[0].ob, false)
when 2
@ob.delete_bond(args[0].get_bond(args[1]).ob, false)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unbond(atom1,atom2)\n atom1.bonds.delete(atom2)\n atom2.bonds.delete(atom1)\n [atom1.bonds, atom2.bonds]\nend",
"def delete_and_restore_bonds(*bonds, &block)\n bonds.each do |bond|\n unless @ob.delete_bond(bond.ob, false)\n raise \"#{bond.inspect} not deleted!\" \n end\n e... | [
"0.73124295",
"0.636439",
"0.5911528",
"0.58672786",
"0.58309627",
"0.5618754",
"0.5426542",
"0.53945875",
"0.5335832",
"0.53291935",
"0.5302082",
"0.52898914",
"0.528624",
"0.5265661",
"0.5242786",
"0.5217972",
"0.519402",
"0.51442915",
"0.5047748",
"0.5014448",
"0.49968338"... | 0.7822901 | 0 |
swaps to_move1 for to_move2 on the respective anchors returns self | def swap!(anchor1, to_move1, anchor2, to_move2)
OpenBabel::OBBuilder.swap(@ob, *[anchor1, to_move1, anchor2, to_move2].map {|at| at.ob.get_idx } )
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_onto(a, b)\n reveal(a)\n reveal(b)\n move_single(a, b)\n end",
"def move_to!(x, y, z)\n @a1[0] = @a2[0] = @b1[0] = @b2[0] = x\n @a1[1] = @a2[1] = @d1[1] = @d2[1] = y\n @a1[2] = @b1[2] = @c1[2] = @d1[2] = z\n @a2[2] = @b2[2] = @c2[2] = @d2[2] = @a2[2] + z\n @b1[1] = @b2[1] = @c1[... | [
"0.6866957",
"0.68606293",
"0.6860554",
"0.6608636",
"0.65287954",
"0.6456767",
"0.64508414",
"0.6385917",
"0.6382756",
"0.6286009",
"0.6286009",
"0.61970675",
"0.6196056",
"0.6183518",
"0.6178692",
"0.6173597",
"0.6172905",
"0.6168826",
"0.6158771",
"0.6154547",
"0.60957396"... | 0.7739049 | 0 |
creates a new (as yet unspecified) bond associated with the molecule and gives it a unique id | def new_bond
@ob.new_bond.upcast
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @bond = Bond.new\n end",
"def bond!(arg, bond_order=1)\n mol.add_atom!(arg, bond_order, self)\n end",
"def bond(id)\n @ob.get_bond_by_id(id).upcast\n end",
"def add_bond(num, atomid1, atomid2)\n if not num.between?(1,@numbonds)\n raise RuntimeError, \"trying to add more ... | [
"0.62508386",
"0.5800881",
"0.5774591",
"0.56056726",
"0.55875283",
"0.55875283",
"0.55617434",
"0.5538485",
"0.54584277",
"0.5393256",
"0.5382698",
"0.5346085",
"0.5283206",
"0.52620214",
"0.52254814",
"0.51917607",
"0.51917607",
"0.5185938",
"0.5182646",
"0.51758295",
"0.51... | 0.6132488 | 1 |
yields self after deleting the specified bonds. When the block is closed the bonds are restored. Returns whatever is returned from the block. | def delete_and_restore_bonds(*bonds, &block)
bonds.each do |bond|
unless @ob.delete_bond(bond.ob, false)
raise "#{bond.inspect} not deleted!"
end
end
reply = block.call(self)
bonds.each {|bond| @ob.add_bond(bond.ob) }
reply
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_if\n return @bin unless block_given?\n @bin.delete_if {|key, val| yield(val)}\n end",
"def around_delete\n yield\n end",
"def delete\n result, _ = Sidekiq::Batch.redis(bid) do |conn|\n conn.pipelined do\n conn.hsetnx(\"b-#{bid}\", \"deleted\", \"... | [
"0.5518094",
"0.5458573",
"0.5424188",
"0.541065",
"0.5398207",
"0.52303433",
"0.5136515",
"0.5115425",
"0.51039845",
"0.50879854",
"0.50668603",
"0.50661576",
"0.50445276",
"0.5034207",
"0.50230265",
"0.50097954",
"0.4959093",
"0.4952693",
"0.4936223",
"0.49321738",
"0.49291... | 0.7458443 | 0 |
splits the molecules at the given bonds and returns the fragments. Does not alter the caller. If the molecule is already fragmented, then returns the separate fragments. !! Doesn't handle adducts, retained for backwards compatibility | def basic_split(*bonds)
if bonds.size > 0
delete_and_restore_bonds(*bonds) do |mol|
mol.ob.separate.map(&:upcast)
end
else
self.ob.separate.map(&:upcast)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_with_adducts(*bonds)\n to_return = split(*bonds)\n if adducts?\n products = to_return.product(@adducts)#.map {|mol, adduct| mol.associate_atom! adduct.atoms.first ; mol}\n products.map! {|mol, adduct| mol2 = mol.dup; mol2.associate_atom! adduct.atoms.first ; mol2}\n to_retu... | [
"0.6493468",
"0.590121",
"0.56440073",
"0.55665654",
"0.54055846",
"0.54055846",
"0.5203604",
"0.51741964",
"0.5104688",
"0.5013258",
"0.5013258",
"0.50059205",
"0.4941353",
"0.4877196",
"0.4867319",
"0.47877103",
"0.47561362",
"0.47500256",
"0.47161508",
"0.46995404",
"0.469... | 0.6389707 | 1 |
returns a Rubabel::MoleculeData hash | def data
Rubabel::MoleculeData.new(@ob)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n self.atoms.hash\n end",
"def to_hash\n @data\n end",
"def to_hash()\n @data\n end",
"def to_hash\n @data\n end",
"def hash\n [mcc, uf, id_antecipacao_simulada, id_conta, id_compra, id_tipo_transacao, quantidade_parcelas_antecipaveis, valor_parcela, data_hora_... | [
"0.6780073",
"0.651219",
"0.6502748",
"0.648016",
"0.6430292",
"0.6425371",
"0.6319053",
"0.623587",
"0.62290543",
"0.6152113",
"0.6139493",
"0.60701436",
"0.60648847",
"0.60648847",
"0.6055708",
"0.6000411",
"0.59708655",
"0.5933838",
"0.5933838",
"0.59265935",
"0.59164536",... | 0.7554122 | 0 |
If filename_or_type is a symbol, then it will return a string of that type. If filename_or_type is a string, will write to the filename given no args, returns a DEFAULT_OUT_TYPE string | def write(filename_or_type=:can, out_options={})
if filename_or_type.is_a?(Symbol)
write_string(filename_or_type, out_options)
else
write_file(filename_or_type, out_options)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect\n if blank_name?\n SENSIBLE_DEFAULT\n elsif empty_file?\n EMPTY_TYPE\n elsif calculated_type_matches.any?\n calculated_type_matches.first\n else\n type_from_file_contents || SENSIBLE_DEFAULT\n end.to_s\n end",
"def detect\n if blank_name?\... | [
"0.63548625",
"0.63484466",
"0.62527406",
"0.5995776",
"0.58911306",
"0.5888845",
"0.5874577",
"0.58691156",
"0.58370346",
"0.57522345",
"0.5750913",
"0.57469344",
"0.57051414",
"0.5690586",
"0.5677101",
"0.56745857",
"0.5665723",
"0.5615292",
"0.56047386",
"0.555299",
"0.553... | 0.77002406 | 0 |
def global_optimize!(forcefield=DEFAULT_FORCEFIELD, steps=1000) if dim != 3 don't bother optimizing yet (steps=nil) make_3d!(DEFAULT_FORCEFIELD, nil) end end does a bit of basic local optimization unless steps is set to nil returns self | def make_3d!(forcefield=DEFAULT_FORCEFIELD, steps=50)
BUILDER.build(@ob)
@ob.add_hydrogens(false, true) unless hydrogens_added?
local_optimize!(forcefield, steps) if steps
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_optimize!(forcefield=DEFAULT_FORCEFIELD, steps=500)\n add_h! unless hydrogens_added?\n if dim == 3\n ff = Rubabel.force_field(forcefield.to_s)\n ff.setup(@ob) || raise(OpenBabelUnableToSetupForceFieldError)\n ff.steepest_descent(steps) # is the default termination count 1.... | [
"0.81991804",
"0.56755394",
"0.5487573",
"0.5312191",
"0.50375086",
"0.49697906",
"0.49524212",
"0.49524212",
"0.49524212",
"0.4865019",
"0.48600012",
"0.48557678",
"0.4854172",
"0.48149276",
"0.4801916",
"0.47987375",
"0.47947207",
"0.47947207",
"0.47894365",
"0.47885168",
"... | 0.653957 | 1 |
centers the molecule (deals with the atomic coordinate systems for 2D or 3D molecules). returns self. | def center!
@ob.center
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center\n\t\t\tcenter_x\n\t\t\tcenter_y\n\t\tend",
"def center_horizontally\n @horizontal_align = :center\n return self\n end",
"def center()\n Vector.new(x + w / 2, y + h / 2, z)\n end",
"def centerx; return self[0]+(self[2].div(2)); end",
"def center=(arg)\n x, y = *(arg.is_a... | [
"0.6871484",
"0.6755198",
"0.6749888",
"0.6702777",
"0.66403043",
"0.6547038",
"0.6493297",
"0.6471738",
"0.64507705",
"0.6411302",
"0.6294942",
"0.62438726",
"0.61673945",
"0.61419255",
"0.61187893",
"0.60905844",
"0.60765535",
"0.6048147",
"0.6017616",
"0.60159266",
"0.6009... | 0.70500636 | 0 |
GET /api/v1/cookbooks Return all Cookbooks. Defaults to 10 at a time, starting at the first Cookbook when sorted alphabetically. The max number of Cookbooks that can be returned is 100. Pass in the start and items params to specify the index at which to start and how many to return. | def index
@total = Cookbook.count
@cookbooks = Cookbook.order('name ASC').limit(@items).offset(@start)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search\n @results = Cookbook.search(\n params.fetch(:q, nil)\n ).offset(@start).limit(@items)\n end",
"def index\n @cookbooks = Cookbook.includes(:cookbook_versions).order(:deprecated)\n\n @current_params = cookbook_index_params\n\n if @current_params[:q].present?\n @cookbooks = @co... | [
"0.6723476",
"0.6432152",
"0.60987455",
"0.5950087",
"0.5947892",
"0.594333",
"0.59015524",
"0.58658576",
"0.57861453",
"0.5784761",
"0.5766114",
"0.5744875",
"0.5716487",
"0.5715928",
"0.5657153",
"0.56198883",
"0.56144744",
"0.56046236",
"0.55976325",
"0.5596168",
"0.559380... | 0.7036146 | 0 |
GET /api/v1/search?q=QUERY Return cookbooks with a name that contains the specified query. Takes the +q+ parameter for the query. It also handles the start and items parameters for specify where to start the search and how many items to return. Start defaults to 0. Items defaults to 10. Items has an upper limit of 100. | def search
@results = Cookbook.search(
params.fetch(:q, nil)
).offset(@start).limit(@items)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(**args)\n params = parameters(args) do\n required_params :term\n optional_params :term, :item_type, :start, :limit, :exact_match\n end\n request(:get, 'searchResults', params)\n end",
"def index\n from_param = (params[:p].to_i * 10)\n @recipes = Recipe... | [
"0.68714195",
"0.68207526",
"0.66979325",
"0.66689944",
"0.6571793",
"0.65428835",
"0.65006787",
"0.63792604",
"0.63567495",
"0.63551533",
"0.63387954",
"0.6337639",
"0.6319077",
"0.63145584",
"0.6287789",
"0.6244085",
"0.62010324",
"0.6194003",
"0.6172957",
"0.61720544",
"0.... | 0.81002206 | 0 |
Public: The date of the next occurance Returns a Date | def next_date
next_observance.try(:start_on) || 100.years.from_now.to_date
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_next date\n loop do \n \treturn date if include?(date)\n \t# puts \"#{@resolution} : #{date}\"\n \tdate = beginning_of_next @resolution, date\n end\n end",
"def next_day\n advance(days: 1)\n end",
"def next_scheduled_use_date\n next_date = nil\n\n open_o... | [
"0.7624062",
"0.7569742",
"0.746851",
"0.7462743",
"0.7460338",
"0.74395275",
"0.7366707",
"0.7330746",
"0.7330661",
"0.7327503",
"0.7250004",
"0.71438074",
"0.7104651",
"0.7103082",
"0.70364714",
"0.70241046",
"0.6992962",
"0.6992962",
"0.69758457",
"0.69467884",
"0.6927325"... | 0.8010909 | 0 |
Public: The next upcoming observance Returns an Observance | def next_observance
@next_observance ||= upcoming_observances.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def observance_after\n @observance_after ||= upcoming_observances.second\n end",
"def next_date\n next_observance.try(:start_on) || 100.years.from_now.to_date\n end",
"def with_upcoming_observance\n upcoming_observances.first.tap do |observance|\n yield observance.decorate unless observance.nil... | [
"0.6937585",
"0.68194634",
"0.6233151",
"0.61215127",
"0.60571146",
"0.60537845",
"0.5863802",
"0.58519715",
"0.58208054",
"0.5737317",
"0.5701238",
"0.5681953",
"0.5659503",
"0.56347686",
"0.55644983",
"0.55534005",
"0.5499431",
"0.5491458",
"0.5451808",
"0.5406008",
"0.5394... | 0.87543887 | 0 |
Public: The observance after the next Returns an Observance | def observance_after
@observance_after ||= upcoming_observances.second
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_observance\n @next_observance ||= upcoming_observances.first\n end",
"def with_upcoming_observance\n upcoming_observances.first.tap do |observance|\n yield observance.decorate unless observance.nil?\n end\n end",
"def next\n after.first\n end",
"def next_result()\n ... | [
"0.7795847",
"0.5939188",
"0.5818285",
"0.5630839",
"0.5462582",
"0.5462582",
"0.5430192",
"0.5416585",
"0.52959365",
"0.5293723",
"0.52334654",
"0.5232885",
"0.5215093",
"0.5196263",
"0.5196263",
"0.5196263",
"0.5196263",
"0.5196263",
"0.5196263",
"0.5182375",
"0.5171517",
... | 0.77447605 | 1 |
Metodo constructor, que un mapa con los nombres y estrategias de los jugadores | def initialize(mapa)
mapatemp = []
mapa.each_value {|value| mapatemp.push(value) }
# Verificando que hay exactamente dos jugadores
if mapa.length == 2
# Verificando que en efecto son estrategias, si alguna no lo es se lanza excepcion
if (!mapatemp[0].is_a?(Manual... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(mapa)\n\n # Verificar que hay exactamente dos jugadores y que \n # en efecto se trata de estrategias\n temp = []\n mapa.each_value {|value| temp.push(value) }\n temp1 = temp[0].class <= Estrategia\n temp2 = temp[1].class <= Estrategia\n keys = []\n ... | [
"0.7363907",
"0.6222435",
"0.5962808",
"0.5922722",
"0.5891788",
"0.5887692",
"0.58630276",
"0.5760971",
"0.5756105",
"0.5724822",
"0.5723104",
"0.5688683",
"0.56344473",
"0.56073433",
"0.5510641",
"0.55088323",
"0.55034363",
"0.549064",
"0.54766136",
"0.5458674",
"0.5447257"... | 0.68473136 | 1 |
Metodo rondas con n un entero positivo, debe completar n rondas en el juego y producir un mapa indicando los puntos obtenidos por cada jugador y la cantidad de rondas jugadas. | def rondas(n)
$i = 0
$num = n
estrategia1=@map[@map.keys[0]]
estrategia2=@map[@map.keys[1]]
# Verifica si alguna estrategia es Copiar o Manual
if estrategia1.is_a?(Copiar)
if !estrategia2.is_a?(Manual) && !estrategia2.is_a?(Copiar)
estrategia2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rondas(n)\n puntos0 = 0\n puntos1 = 0\n oldjugada1 = nil\n for i in 0..n\n if i > 0 # segunda ronda\n if @copiar0 || @pensar0\n jugada0 = @jugador0.prox(oldjugada1)\n end\n if @copiar1 || @pensar1\n ... | [
"0.7365029",
"0.7157807",
"0.69847924",
"0.6666018",
"0.66042465",
"0.65536004",
"0.63220596",
"0.6110491",
"0.6070444",
"0.5894856",
"0.5804829",
"0.578375",
"0.5685171",
"0.5633608",
"0.558539",
"0.55821174",
"0.5509409",
"0.5459299",
"0.54433125",
"0.54143775",
"0.53800553... | 0.7174296 | 1 |
Metodo cambioPuntajes, que dado un string n, actualiza el puntaje de los jugadores en el mapa. | def cambioPuntajes(n)
puntaje1=@mapaactual[@mapaactual.keys[0]]
puntaje2=@mapaactual[@mapaactual.keys[1]]
if n=="[1,0]"
puntaje1=1+puntaje1
@mapaactual[@mapaactual.keys[0]]=puntaje1
@mapaactual
elsif n=="[0,1]"
puntaje2=1+puntaje2
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cambioRondas(n)\n rond=@mapaactual[@mapaactual.keys[2]]\n @mapaactual[@mapaactual.keys[2]]=rond+n\n @mapaactual\n end",
"def alcanzar (n)\n i = @mapaactual[@mapaactual.keys[0]]\n j = @mapaactual[@mapaactual.keys[1]]\n count = 0\n estrategia1=@map[@map.keys[... | [
"0.638594",
"0.6024699",
"0.59939545",
"0.59494334",
"0.5780051",
"0.5764405",
"0.5752206",
"0.5702828",
"0.5611694",
"0.5477108",
"0.5376888",
"0.53409874",
"0.53357744",
"0.52372897",
"0.5129038",
"0.5072762",
"0.5066665",
"0.50573796",
"0.5032762",
"0.50172675",
"0.500228"... | 0.7194111 | 0 |
Metodo cambioRondas, que dado un valor n, suma la cantidad de rondas actuales con n y actualiza el valor en el mapa. | def cambioRondas(n)
rond=@mapaactual[@mapaactual.keys[2]]
@mapaactual[@mapaactual.keys[2]]=rond+n
@mapaactual
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rondas(n)\n puntos0 = 0\n puntos1 = 0\n oldjugada1 = nil\n for i in 0..n\n if i > 0 # segunda ronda\n if @copiar0 || @pensar0\n jugada0 = @jugador0.prox(oldjugada1)\n end\n if @copiar1 || @pensar1\n ... | [
"0.6798254",
"0.6609659",
"0.6544852",
"0.55428237",
"0.54918754",
"0.54273623",
"0.5405255",
"0.5159021",
"0.5138764",
"0.5138704",
"0.51233596",
"0.51164544",
"0.5109404",
"0.5006006",
"0.50020933",
"0.49887407",
"0.49828243",
"0.49783742",
"0.49725443",
"0.49501497",
"0.49... | 0.83727527 | 0 |
Metodo alzanzar, con n un entero positivo, debe completar tantas rondas como sea necesario hasta que alguno de los jugadores alcance n puntos, produciendo un mapa indicando los puntos obtenidos por cada jugador y la cantidad de rondas jugadas. | def alcanzar (n)
i = @mapaactual[@mapaactual.keys[0]]
j = @mapaactual[@mapaactual.keys[1]]
count = 0
estrategia1=@map[@map.keys[0]]
estrategia2=@map[@map.keys[1]]
# Verifica si alguna estrategia es Copiar o Manual
if estrategia1.is_a?(Copiar)
if !estr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alcanzar(n)\n puntos0 = 0\n puntos1 = 0\n rondas = 0\n oldjugada1 = nil \n while puntos0<n and puntos1<n\n if rondas > 0 # segunda ronda\n if @copiar0 || @pensar0\n jugada0 = @jugador0.prox(oldjugada1)\n end\n ... | [
"0.67739445",
"0.6729836",
"0.6567955",
"0.64257216",
"0.61969626",
"0.61963266",
"0.61639214",
"0.60870886",
"0.6040734",
"0.58321184",
"0.57615393",
"0.57237643",
"0.56581026",
"0.56562525",
"0.5644666",
"0.5480239",
"0.54722166",
"0.5387045",
"0.537898",
"0.5342042",
"0.53... | 0.6932235 | 0 |
Metodo pasosProximo, que recibe las estrategias de los jugadores y les aplica el metodo prox. | def pasosProximo(estrategia1,estrategia2)
if !estrategia1.is_a?(Manual)
estrategia1.prox()
else
puts "Jugador1"
m=preguntaManual()
estrategia1.prox(m)
end
if !estrategia2.is_a?(Manual)
estrategia2.prox()
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prox()\n # Selecciona al azar la proxima jugada\n @index = $random.rand(0..@movimientos_posibles.length)\n\n # Obtiene la jugada, dentro de las jugadas posibles, que se encuentra en la posicion seleccionada\n aux = @movimientos_posibles[@index].to_s\n\n if aux == \"Piedra\"\n... | [
"0.633612",
"0.6297606",
"0.61893123",
"0.61852056",
"0.61362696",
"0.6114025",
"0.6092217",
"0.59697175",
"0.55490744",
"0.54991525",
"0.5494485",
"0.5395622",
"0.51803696",
"0.5125853",
"0.5090696",
"0.5066304",
"0.5063645",
"0.50177544",
"0.4979122",
"0.49082395",
"0.48861... | 0.7752297 | 0 |
Metodo pasosLoop, que recibe las dos estrategias de los jugadores. Termina de realizar los pasos de la jugada, calcula los puntos y los actualiza en el mapa para luego retornarlo. | def pasosLoop(estrategia1,estrategia2)
if !estrategia1.is_a?(Copiar)
if (estrategia1.actual.nil? && !estrategia1.is_a?(Manual))
estrategia1.prox()
end
estrategia1.jugar()
end
if !estrategia2.is_a?(Copiar)
if (estrategia2.actual.nil?... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(mapa)\n\n # Verificar que hay exactamente dos jugadores y que \n # en efecto se trata de estrategias\n temp = []\n mapa.each_value {|value| temp.push(value) }\n temp1 = temp[0].class <= Estrategia\n temp2 = temp[1].class <= Estrategia\n keys = []\n ... | [
"0.6250195",
"0.5982218",
"0.5914223",
"0.58084404",
"0.5773814",
"0.57278335",
"0.5654987",
"0.564216",
"0.5633422",
"0.5620696",
"0.55916363",
"0.5557524",
"0.54997534",
"0.54872346",
"0.54723155",
"0.5445747",
"0.53612995",
"0.53221214",
"0.5321909",
"0.5297718",
"0.526120... | 0.6977473 | 0 |
Metodo reiniciar, que lleva el juego a su estado inicial. | def reiniciar
reset()
@mapaactual=@mapainicio
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reactivacion\r\n\t\tif session[:usuario_id]\r\n\t\t\tenti = Usuarioentidad.where(usuario_id: session[:usuario_id]).take\r\n\t\tend\r\n\t\t#Solamente el consejo de facultad tiene la posibilidad de reactivar instructores\r\n\t\tif session[:usuario_id] && session[:entidad] == true && enti.entidad_id == 13\r\n\t\t... | [
"0.628067",
"0.60152984",
"0.5957892",
"0.59375745",
"0.5936755",
"0.59107625",
"0.5882465",
"0.5878252",
"0.58740556",
"0.58703536",
"0.58211076",
"0.5801054",
"0.5756315",
"0.5755097",
"0.57244736",
"0.564859",
"0.56414264",
"0.5618678",
"0.5600212",
"0.55982333",
"0.559564... | 0.63188696 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.