query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return +true+ if self was declared as +acts_as_tracked+. | def acts_as_tracked?
self < TrackedBehavior
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tracked?\n\t\treturn !self.not_tracked?\n\tend",
"def used?\n return @tracked\n end",
"def is_tracked?(node)\n unless @tracker.include?(node.scoped_name)\n # not tracked yet, but add now\n @tracker << node.scoped_name\n false\n else\n ... | [
"0.74758726",
"0.69866717",
"0.6716979",
"0.65531427",
"0.6505097",
"0.6278708",
"0.62482214",
"0.61917794",
"0.61491525",
"0.6144363",
"0.6113313",
"0.6030626",
"0.59501433",
"0.5812827",
"0.57847893",
"0.576381",
"0.5695497",
"0.5690863",
"0.567995",
"0.567995",
"0.56719536... | 0.8541006 | 0 |
Return array of parent relation foreign keys, which is used for lock_version calculation. | def get_parent_relation_keys(parent)
parents = Array(parent)
reflect_on_all_associations.inject([]) do |result, relation|
result << relation.foreign_key if parents.include?(relation.name)
result
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def record_foreign_keys(parent_record)\n association_foreign_keys(parent_record)\n end",
"def foreign_keys\n vals = []\n foreign_key_fields.each do |field|\n vals << self.send(field)\n end\n vals\n end",
"def references\n @parents.keys\n end",
"def parent_rel_ids\n rel = ... | [
"0.754292",
"0.722657",
"0.71410656",
"0.71164155",
"0.6930004",
"0.6885066",
"0.6827013",
"0.6759581",
"0.67535347",
"0.6691609",
"0.6678692",
"0.6619537",
"0.66067874",
"0.6593433",
"0.6580837",
"0.6578804",
"0.6558973",
"0.6509145",
"0.6405247",
"0.64034456",
"0.6368085",
... | 0.83699566 | 0 |
Marks +self+ as a new record. Sets +id+ attribute to nil, but memorizes the old value in case of exception. | def to_new_record!
store_before_to_new_record_values
reset_persistence_values
@new_record = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_or_update\n if self.id.is_a?(Numeric) && self.id.to_i.zero?\n self.id = nil\n @new_record = true\n end\n super\n end",
"def sneaky_create\n if self.id.nil? && sneaky_connection.prefetch_primary_key?(self.class.table_name)\n self.id = sneaky_connection.next_s... | [
"0.70145166",
"0.6489481",
"0.640583",
"0.62509036",
"0.61349744",
"0.61349744",
"0.6033856",
"0.59981227",
"0.59494054",
"0.58684504",
"0.58589864",
"0.58589864",
"0.58186895",
"0.5817696",
"0.58118194",
"0.579157",
"0.57854867",
"0.57800853",
"0.575058",
"0.5729567",
"0.572... | 0.5571425 | 35 |
Marks +self+ as persistent record. If another record is passed, uses its persistence attributes (id, timestamps). If nil is passed as an argument, marks +self+ as persisted record and sets +id+ to memorized value. | def to_persistent!(existing = nil)
if existing
self.id = existing.id
self.created_at = existing.created_at if respond_to?(:created_at)
self.updated_at = existing.updated_at if respond_to?(:updated_at)
clear_changes_information
else
restore_before_to_new_record_values
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save()\n saved = persister.save(@decorated, @id)\n\n if saved\n @id = saved.id\n self\n end\n end",
"def record_to_persist\n record\n end",
"def save\n if self.id.nil?\n self.create\n else\n self.update\n end\n end",
"def save!\n set_default_id_if_... | [
"0.6455037",
"0.61419916",
"0.601606",
"0.59977233",
"0.5996202",
"0.5959938",
"0.59282714",
"0.59250665",
"0.5918136",
"0.588778",
"0.5856912",
"0.5839192",
"0.5838468",
"0.57636887",
"0.5749459",
"0.57072896",
"0.5683056",
"0.56776994",
"0.5673774",
"0.5656461",
"0.56466866... | 0.6304285 | 1 |
Stores original record id for tracking purposes. | def set_parent
tbc = self.class.preceding_key_column
if tbc && self.respond_to?(tbc)
write_attribute(tbc, @_before_to_new_record_values[:id])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def record_id(record)\n record.id\n end",
"def __record_id=(value)\n @__record_id = value.nil? ? nil : value.to_i\n end",
"def record_id=(value)\n doc['record_id'] = value\n end",
"def record_identifier(record)\n record.id\n end",
"def id ; @recor... | [
"0.70703286",
"0.69839454",
"0.68831414",
"0.684688",
"0.684223",
"0.6780858",
"0.67712975",
"0.6712241",
"0.6657215",
"0.66068906",
"0.66068906",
"0.6603847",
"0.6589834",
"0.6589834",
"0.6578259",
"0.6567394",
"0.65541464",
"0.6530405",
"0.6517132",
"0.6508877",
"0.6484402"... | 0.0 | -1 |
Helper method used by has_aggregated (in fact, belongs_to) association during autosave. | def updated_as_aggregated?
!!@updated_as_aggregated
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autosave_associated_records_for_tag\n if new_tag = Tag.find_or_create_by_name(self.name)\n self.tag = new_tag\n else\n self.tag = tag if self.tag.save!\n end\n end",
"def save(*)\n update_magic_properties\n clear_association_cache\n create_or_update\n end",
"def autosa... | [
"0.6374329",
"0.6271527",
"0.6184257",
"0.61631256",
"0.6155838",
"0.605727",
"0.6053018",
"0.60258424",
"0.59781146",
"0.59522444",
"0.5939795",
"0.59333193",
"0.5919242",
"0.59122086",
"0.5900609",
"0.5874705",
"0.5834004",
"0.5797735",
"0.5792173",
"0.5787229",
"0.5776041"... | 0.0 | -1 |
Save persistence values of id, updated_at and created_at to instance variable to have an ability to set them back if object fails to be saved. | def store_before_to_new_record_values
values = {:id => id}
values[:updated_at] = updated_at if respond_to?(:updated_at)
values[:created_at] = created_at if respond_to?(:created_at)
@_before_to_new_record_values = values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n self.saved_at = Time.now\n end",
"def save\n response = perform_save(nil)\n response_data = ActiveSupport::HashWithIndifferentAccess.new(response.data)\n\n if new_record?\n created_object = self.class.new(client, self.class.map_to_scope_parameters(attributes).merge(re... | [
"0.7442104",
"0.72849107",
"0.69637465",
"0.6834871",
"0.67591333",
"0.6736147",
"0.6616573",
"0.661033",
"0.6591287",
"0.6567908",
"0.6525982",
"0.65132695",
"0.65078723",
"0.64774793",
"0.64528877",
"0.6439902",
"0.64397365",
"0.6404181",
"0.639723",
"0.6386059",
"0.6368210... | 0.68109584 | 4 |
Set persistence values of id, updated_at and created_at back. | def restore_before_to_new_record_values
values = @_before_to_new_record_values
self.id = values[:id]
self.created_at = values[:created_at] if respond_to?(:updated_at=)
self.updated_at = values[:updated_at] if respond_to?(:updated_at=)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_persistence_values\n self.id = nil\n\n if respond_to?(:updated_at=)\n self.updated_at = nil\n self.updated_at_will_change!\n end\n\n if respond_to?(:created_at=)\n self.created_at = nil\n self.created_at_will_change!\n end\n\n # mark all other attributes is changing\... | [
"0.76221883",
"0.69777346",
"0.6599983",
"0.65867394",
"0.64536995",
"0.6341095",
"0.6302841",
"0.6262398",
"0.6238171",
"0.6238171",
"0.620733",
"0.6198965",
"0.61731815",
"0.61457276",
"0.61457276",
"0.61027735",
"0.60615265",
"0.6058354",
"0.6044331",
"0.60161537",
"0.5926... | 0.6967803 | 2 |
Set id, updated_at and created_at to nil in order to update them when new record is created. | def reset_persistence_values
self.id = nil
if respond_to?(:updated_at=)
self.updated_at = nil
self.updated_at_will_change!
end
if respond_to?(:created_at=)
self.created_at = nil
self.created_at_will_change!
end
# mark all other attributes is changing
(attributes.ke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset!\n self.entered_at = nil\n self.started_at = nil\n self.finished_at = nil\n self.status = \"\"\n\n self.save!(validate: false)\n end",
"def set_timestamps\n self.created_at = Time.now\n #Set updated_at initially before manually setting because column cannot be null.\n self.upda... | [
"0.6450692",
"0.64222777",
"0.6364067",
"0.63493705",
"0.63398206",
"0.63032573",
"0.6170979",
"0.6125083",
"0.6057904",
"0.5963874",
"0.5897381",
"0.58703935",
"0.58164567",
"0.5785944",
"0.5748075",
"0.57465905",
"0.57397556",
"0.5738414",
"0.5712351",
"0.57105964",
"0.5703... | 0.6339246 | 5 |
Create an instance of the Daemon. It requires a logger instance roughly compatible with Logger. | def initialize logger = Nacreon.log
self.log = logger
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(name = nil)\n logger_name = name || caller(1..1).first[/`(.+)'/, 1]\n Logger.new(logger_name)\n end",
"def setup\n self.logger.reopen(File.open(File.join(Lokii::Config.root, Lokii::Config.log), \"a\")) if daemon? && self.logger\n self.logger ||= ::Logger.new(File.join(Lokii:... | [
"0.6546983",
"0.632076",
"0.62869984",
"0.62619126",
"0.62619126",
"0.6245005",
"0.6210357",
"0.6197381",
"0.6173778",
"0.61424124",
"0.6122081",
"0.61089045",
"0.6100191",
"0.6074445",
"0.6074445",
"0.60477144",
"0.60461944",
"0.6045537",
"0.5983741",
"0.59679574",
"0.595292... | 0.5411226 | 98 |
Executes the main loop, from which there is no return. All Exceptions will be caught and logged as errors. | def main_loop
begin
loop {
iterate
log.debug "Finished iteration; sleeping for #{sleep_time}s."
sleep sleep_time
}
rescue Exception => e
# We want to avoid crashing if at all possible, so we catch
# everything, log it, sleep (to avoid thrashing or flooding the
# logs completely ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main\n loop do\n unless @context\n begin\n self.process(self.await_input)\n rescue ConsoleInterrupt\n self.replace '^C'\n self.println ':(', 2\n rescue ConsoleError => e\n self.print _INTL(\"{1}: {2}\",self.name,e.message), 0, true\n sel... | [
"0.747822",
"0.72080857",
"0.7104693",
"0.6909512",
"0.6817978",
"0.67442375",
"0.6734121",
"0.67306894",
"0.6730029",
"0.6730029",
"0.66747487",
"0.6649616",
"0.66089153",
"0.65865695",
"0.65865695",
"0.6582166",
"0.65456325",
"0.65074724",
"0.644238",
"0.64092946",
"0.63900... | 0.79486454 | 0 |
Makes one run through the main loop. | def iterate
# First off, if we can free up resources, we should do that first.
Model::Instance.marked_on_host(AppManager.host).each { |i|
AppManager.kill_marked i
}
# We do this right after to avoid too long a wait for instances to
# spin up.
Model::Instance.started_on_host(AppManager.host).each ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n main_loop\n end",
"def run_loop\n end",
"def main_loop\n @main_loop ||= lambda do\n # Smoother, but slower: GC.start if rand > 0.98\n next_step\n SUBSTEPS.times do\n move\n targeting\n handle_input\n remove_marked\n step_physics\n e... | [
"0.8038374",
"0.7991461",
"0.76902676",
"0.7680703",
"0.7582327",
"0.7565876",
"0.7565876",
"0.73662996",
"0.7306901",
"0.7255702",
"0.7233766",
"0.7147582",
"0.70594007",
"0.7054231",
"0.69912106",
"0.69723827",
"0.6939742",
"0.69314855",
"0.6907574",
"0.6890003",
"0.6887182... | 0.0 | -1 |
A calculation of the amount of time this particular daemon should sleep between iterations. | def sleep_time
# TODO: Hard-coded for now. See doc/app_manager.rdoc for some
# thoughts on this.
1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sleep_value\n 20\n end",
"def calculate_sleep\n if @timeouts.empty?\n @sleep_for = DefaultSleepFor\n else\n diff = @timeouts.first.value.timeout_at.to_f - Time.now.to_f\n\n if diff < 0.0\n @sleep_for = 0\n else\n @sleep_for = diff\n e... | [
"0.71855474",
"0.71640605",
"0.7116918",
"0.6909913",
"0.69066525",
"0.68345773",
"0.67138433",
"0.6703008",
"0.6553534",
"0.6522523",
"0.65092605",
"0.6495179",
"0.64456654",
"0.6440165",
"0.6436283",
"0.6364189",
"0.6323842",
"0.63132393",
"0.63124067",
"0.6295731",
"0.6295... | 0.6733744 | 6 |
Converts a hash of hashes into dot notaion used by graphite targets. Takes optional time argument, defaulting to now. | def dump(hash, time = Time.now.to_i)
data = []
raise "Hash was not received" unless hash.is_a? Hash
walk_the_forrest(hash) do |target, value|
data << "#{target} #{value} #{time}"
end
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dotify(h)\n h.use_dot_syntax = true; h.keys.each{|k| dotify(h[k]) if h[k].is_a?(::Hash)}\n end",
"def to_dotted_hash(hash, recursive_key = \"\")\n hash.each_with_object({}) do |(k , v), ret|\n key = recursive_key + k.to_s\n if v.is_a? Hash\n ret.merge!(to_dotted_hash(v, key + ... | [
"0.608443",
"0.6048034",
"0.53383887",
"0.512911",
"0.512911",
"0.5061868",
"0.49701047",
"0.49491757",
"0.48620927",
"0.48363256",
"0.47856304",
"0.47539097",
"0.4732487",
"0.4717901",
"0.4717901",
"0.47111958",
"0.46617937",
"0.46414754",
"0.4602472",
"0.45957926",
"0.45782... | 0.5551928 | 2 |
def comment_params params.require(:evaluate).permit(:id) end | def set_evaluate
@evaluate = Evaluate.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate_params\n params.require(:evaluate).permit(:rating, :comment)\n end",
"def comment_params\n params.require(:artifact_answer).permit(:id, comment_attributes: [:comment, :id])\n end",
"def comment_params\n params.permit(:text, :user_id, :event_id, :report)\n end",
"def comment_p... | [
"0.83164436",
"0.76501423",
"0.7338511",
"0.7320107",
"0.7270725",
"0.7257191",
"0.7252487",
"0.7151087",
"0.71293527",
"0.71258277",
"0.7115858",
"0.71115875",
"0.710132",
"0.70899653",
"0.708883",
"0.70834297",
"0.7081341",
"0.70812887",
"0.7071263",
"0.7064903",
"0.7063173... | 0.0 | -1 |
GET /api/v2/account Get all accounts (users and service accounts) of a customer | def list(offset = 0, limit = 100)
api.get('', offset: offset, limit: limit)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accounts\n get('/accounts')['accounts']\n end",
"def get_accounts()\n http_get(accounts_url)\n end",
"def accounts\n response = query_api(\"/rest/accounts\")\n return response[\"accounts\"].map {|account| Account.new(self, account)}\n end",
"def list_customer_accounts_with_ht... | [
"0.794613",
"0.7465647",
"0.7432261",
"0.7397778",
"0.7356671",
"0.73481715",
"0.72885424",
"0.72851634",
"0.7283654",
"0.7244451",
"0.72076863",
"0.7207448",
"0.7146544",
"0.71339786",
"0.7108099",
"0.7095105",
"0.70322317",
"0.70260096",
"0.7025219",
"0.7017181",
"0.7010684... | 0.0 | -1 |
POST /api/v2/account/addingestionpolicy Add a specific ingestion policy to multiple accounts | def add_ingestion_policy(policy_id, id_list)
wf_ingestionpolicy_id?(policy_id)
validate_account_list(id_list)
api.post('addingestionpolicy',
{ ingestionPolicyId: policy_id,
accounts: id_list },
'application/json')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(policy)\n @sets[policy.name.to_s].add(policy.schema)\n end",
"def add(policy)\n @sets[policy.name.to_s].add(policy.schema)\n end",
"def remove_ingestion_policy(policy_id, id_list)\n wf_ingestionpolicy_id?(policy_id)\n validate_account_list(id_list)\n api.post('removeinges... | [
"0.55420196",
"0.55420196",
"0.5491811",
"0.515344",
"0.50598854",
"0.50330955",
"0.5026181",
"0.49957135",
"0.49871632",
"0.49660337",
"0.48799673",
"0.48715788",
"0.48230627",
"0.47777212",
"0.47460687",
"0.47139928",
"0.46833482",
"0.4663206",
"0.4650223",
"0.46244586",
"0... | 0.8007276 | 0 |
POST /api/v2/account/removeingestionpolicies Removes ingestion policies from multiple accounts. The API path says "policies" but I've made the method name "policy" for consistency. | def remove_ingestion_policy(policy_id, id_list)
wf_ingestionpolicy_id?(policy_id)
validate_account_list(id_list)
api.post('removeingestionpolicies',
{ ingestionPolicyId: policy_id,
accounts: id_list },
'application/json')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_policies(_sec, _ptype, _rules); end",
"def remove_resource_policies request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_remove_resource_policies_request request... | [
"0.65959626",
"0.6560054",
"0.60350144",
"0.5715759",
"0.54571384",
"0.53268105",
"0.5224802",
"0.52155775",
"0.51290053",
"0.5110659",
"0.5105765",
"0.508899",
"0.5062479",
"0.50374824",
"0.5024486",
"0.50168383",
"0.5015319",
"0.5011819",
"0.500764",
"0.4970719",
"0.4939734... | 0.7659464 | 0 |
POST /api/v2/account/deleteAccounts Deletes multiple accounts (users or service accounts) | def delete_accounts(id_list)
validate_account_list(id_list)
api.post('deleteAccounts', id_list, 'application/json')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bulk_delete_accounts(ids)\n delete('accounts/bulk_delete', ids: ids)\n end",
"def delete_accounts\n end",
"def delete_account\n @connection.request({\n :method => 'DELETE'\n })\n end",
"def delete_account(id)\n res = delete(\"/api/v2/accounts/#{id}\... | [
"0.7632435",
"0.6836864",
"0.6657502",
"0.6543368",
"0.6542564",
"0.6541467",
"0.6448831",
"0.63993603",
"0.63728106",
"0.6271218",
"0.61982596",
"0.6184893",
"0.6148212",
"0.60868376",
"0.605006",
"0.6023352",
"0.6019872",
"0.59716916",
"0.5965921",
"0.594817",
"0.59151596",... | 0.8007817 | 0 |
GET /api/v2/account/user Get all user accounts | def user_list(offset = 0, limit = 100)
api.get('user', offset: offset, limit: limit)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users(params = {})\n make_get_request('/account/users', params)\n end",
"def list_users_by_account(accountId, options={}) path = \"/api/v2/accounts/#{accountId}/users\"\n get(path, options, AvaTax::VERSION) end",
"def get_accounts_by_user\n return User.find(params[:user_id])... | [
"0.76649994",
"0.753135",
"0.752845",
"0.7501198",
"0.7410232",
"0.73704135",
"0.7366359",
"0.7329606",
"0.7272205",
"0.72367555",
"0.7192971",
"0.71900445",
"0.71841854",
"0.71622753",
"0.7158894",
"0.7150368",
"0.71422523",
"0.7100122",
"0.704084",
"0.7011901",
"0.7004619",... | 0.68580717 | 33 |
POST /api/v2/account/user/invite Invite user accounts with given user groups and permissions. | def user_invite(body)
raise ArgumentError unless body.is_a?(Array)
raise ArgumentError unless body.first.is_a?(Hash)
api.post('user/invite', body, 'application/json')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groups_invite(params = {})\n fail ArgumentError, \"Required arguments 'channel' missing\" if params['channel'].nil?\n fail ArgumentError, \"Required arguments 'user' missing\" if params['user'].nil?\n response = @session.do_post \"#{SCOPE}.invite\", params\n Slack.parse_response(res... | [
"0.7413611",
"0.7330537",
"0.70851165",
"0.70347726",
"0.6757246",
"0.67493796",
"0.66737473",
"0.662758",
"0.66225135",
"0.65885925",
"0.6576728",
"0.65615445",
"0.65600383",
"0.655272",
"0.65272444",
"0.65240383",
"0.6502234",
"0.6497006",
"0.6481116",
"0.6448014",
"0.63715... | 0.7295854 | 2 |
POST /api/v2/account/validateAccounts Returns valid accounts (users and service accounts), also invalid identifiers from the given list | def validate_accounts(id_list)
raise ArgumentError unless id_list.is_a?(Array)
api.post('validateAccounts', id_list, 'application/json')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(params)\n post('v1/account/validate', params)\n end",
"def create\n @account = current_user.accounts.build params[:account]\n \n account_array = accounts_from_credentials @account.api_email, @account.api_password\n \n accounts = account_array.map do |account_info|\n accou... | [
"0.6569392",
"0.6253507",
"0.59519637",
"0.585127",
"0.58498967",
"0.5522578",
"0.55107296",
"0.546855",
"0.53277",
"0.52904063",
"0.5256755",
"0.5233559",
"0.5186679",
"0.5080884",
"0.5059241",
"0.50077796",
"0.4943131",
"0.4939399",
"0.493811",
"0.4918781",
"0.4910689",
"... | 0.8434278 | 0 |
todo make docking station private | def initialize(capacity = DEFAULT_CAPACITY)
@capacity = capacity
@bikes = []
# @bikes << Bike.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dock(bike)\n fail 'Docking station full' if @bike\n @bike = bike\n end",
"def dock (bike)\n\t\tfail 'Docking Station full' if full?\n\t\t@bikes << bike\n\t\t#@working_bikes << bike unless bike.broken?\n\tend",
"def set_dock\n @dock = Dock.find(params[:id])\n end",
"def dock bike\n add_bike ... | [
"0.68709207",
"0.68464357",
"0.6444848",
"0.6311644",
"0.6309898",
"0.62901914",
"0.60405594",
"0.58964884",
"0.5754767",
"0.5753033",
"0.5580446",
"0.54963887",
"0.5480109",
"0.5480109",
"0.5480109",
"0.54648453",
"0.5393825",
"0.5387821",
"0.534949",
"0.53463197",
"0.533519... | 0.0 | -1 |
This Could be used to generate a small partial def mini_view render('mini_view') end | def set_alerts
if flash.notice
@notice = flash.notice
p(@notice)
elsif flash.alert
@alert = flash.alert
p(@alert)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_html\n ApplicationController.render(partial: partial, locals: locals)\n end",
"def partial; end",
"def partial; end",
"def partial; end",
"def partial; end",
"def partial(file_name)\n erb file_name, :layout => false\n end",
"def partial(partial)\n partial_view = \... | [
"0.69304436",
"0.684772",
"0.684772",
"0.684772",
"0.684772",
"0.65727234",
"0.6462722",
"0.6457185",
"0.63840353",
"0.6383238",
"0.63830024",
"0.6373516",
"0.6373413",
"0.6361858",
"0.63447",
"0.6343622",
"0.6330417",
"0.6240543",
"0.62402236",
"0.6235542",
"0.61971235",
"... | 0.0 | -1 |
check user store breeder based on listings count | def should_check_user_breeder(user, breeder_min=3)
if !user.breeder? and user.listings.active.count >= breeder_min
# set breeder flag
user.update(breeder: true)
elsif user.breeder? and user.listings.active.count < breeder_min
# turn off breeder flag
user.update(breeder: false)
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def should_be_store?\n listings.where(state: ['active', 'draft', 'removed', 'sold']).count >= 10\n end",
"def nfuse?\n @user.shouts.count > 0\n end",
"def count_listings\n listings.count\n end",
"def user_listings\n @listings =current_user.listings\n end",
"def full?\n self.u... | [
"0.6855107",
"0.6484054",
"0.6322911",
"0.61380583",
"0.60818696",
"0.60416687",
"0.6030601",
"0.59779906",
"0.5929285",
"0.5891587",
"0.5803679",
"0.57766557",
"0.5774909",
"0.5753135",
"0.57323855",
"0.57246715",
"0.5694159",
"0.56727666",
"0.56520635",
"0.5639717",
"0.5617... | 0.66363245 | 1 |
check user store flag based on listings count | def should_check_user_store(user)
if !user.store? and user.should_be_store?
user.update(store: true)
else
# noop
end
rescue Exception => e
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def should_be_store?\n listings.where(state: ['active', 'draft', 'removed', 'sold']).count >= 10\n end",
"def nfuse?\n @user.shouts.count > 0\n end",
"def chargeable? listing\n listing.seller?(@user) && listing.new? \n end",
"def staff_owned_gate?\n record.check_points.where(registrar: user).m... | [
"0.7520387",
"0.6623912",
"0.61175203",
"0.6047848",
"0.6041055",
"0.5990868",
"0.5925844",
"0.5922956",
"0.58354855",
"0.583003",
"0.58226043",
"0.58154917",
"0.5801167",
"0.57992846",
"0.57793474",
"0.5742506",
"0.57369566",
"0.57254803",
"0.5715056",
"0.5699447",
"0.567394... | 0.0 | -1 |
GET /calls GET /calls.json | def index
@calls = Call.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_calls()\n @client.make_request(:get, @client.concat_user_path(\"#{BRIDGE_PATH}/#{id}/calls\"))[0].map do |item|\n Call.new(item, @client)\n end\n end",
"def index\n @calls = Call.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render j... | [
"0.77972907",
"0.7322993",
"0.71231306",
"0.69490033",
"0.6921336",
"0.6867964",
"0.67478853",
"0.6747202",
"0.6721535",
"0.66803306",
"0.66491276",
"0.6598642",
"0.6478125",
"0.64536726",
"0.6418689",
"0.6367717",
"0.6249453",
"0.62471557",
"0.62298805",
"0.61550784",
"0.613... | 0.66808426 | 12 |
GET /calls/1 GET /calls/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_calls()\n @client.make_request(:get, @client.concat_user_path(\"#{BRIDGE_PATH}/#{id}/calls\"))[0].map do |item|\n Call.new(item, @client)\n end\n end",
"def index\n @calls = Call.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render j... | [
"0.7085216",
"0.7034136",
"0.70049185",
"0.69574934",
"0.6860939",
"0.67924064",
"0.67169565",
"0.669272",
"0.664764",
"0.6569741",
"0.638547",
"0.6375643",
"0.6375643",
"0.6375643",
"0.6375643",
"0.63599813",
"0.63530993",
"0.6351805",
"0.62812245",
"0.6279105",
"0.6272321",... | 0.0 | -1 |
POST /calls POST /calls.json | def create
@call = Call.new(call_params)
respond_to do |format|
if @call.save
record_call_activity
format.html { redirect_to @call, notice: 'Call was successfully created.' }
format.json { render :show, status: :created, location: @call }
else
format.html { render :n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_calls(calls, opts = {})\n post_calls_with_http_info(calls, opts)\n nil\n end",
"def create\n @call = Call.new(call_params)\n\n respond_to do |format|\n if @call.save\n format.html { redirect_to :back, notice: 'Call was successfully created.' }\n format.json { render... | [
"0.6947176",
"0.6655496",
"0.6614128",
"0.6578006",
"0.65733045",
"0.65627563",
"0.6550393",
"0.6429492",
"0.636054",
"0.62526894",
"0.62277645",
"0.62148064",
"0.6137315",
"0.61327255",
"0.6131071",
"0.6088025",
"0.60740584",
"0.60724384",
"0.6022822",
"0.6006601",
"0.600357... | 0.6741156 | 1 |
PATCH/PUT /calls/1 PATCH/PUT /calls/1.json | def update
respond_to do |format|
if @call.update(call_params)
record_call_activity
format.html { redirect_to @call, notice: 'Call was successfully updated.' }
format.json { render :show, status: :ok, location: @call }
else
format.html { render :edit }
format.json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def update\n @request_call = RequestCall.find(params[:id])\n\n respond_to do |format|\n if @request_call.update_attributes(params[:request_call])\n format.html { redirect_to @request_call, notice: 'Request call was successfully updated.' }\n form... | [
"0.6730913",
"0.6638005",
"0.65655315",
"0.65655315",
"0.6549112",
"0.6441413",
"0.6418613",
"0.6418613",
"0.63757586",
"0.63690454",
"0.6337483",
"0.6333296",
"0.631156",
"0.62713116",
"0.6261271",
"0.62377465",
"0.61656857",
"0.6133847",
"0.60801804",
"0.6079785",
"0.607978... | 0.6357464 | 10 |
DELETE /calls/1 DELETE /calls/1.json | def destroy
@call.destroy
respond_to do |format|
format.html { redirect_to calls_url, notice: 'Call was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.h... | [
"0.76046777",
"0.76046777",
"0.76046777",
"0.7582449",
"0.74180835",
"0.74180835",
"0.7393218",
"0.7358547",
"0.73455924",
"0.73455924",
"0.7263371",
"0.71280706",
"0.7106809",
"0.7036674",
"0.702898",
"0.70037293",
"0.68805474",
"0.6863541",
"0.68526137",
"0.6801308",
"0.679... | 0.7273029 | 13 |
Use callbacks to share common setup or constraints between actions. | def set_call
@call = Call.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def call_params
params.require(:call).permit(:caller_number, :called_number, :service_ids, :order)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Action for params that got from new | def create
# Set default status to new order
@order = Order.new(order_params.merge({"status" => "Ordering"}))
# Check duplicate of order from product
@order_check = Order.where(product: @order.product, brand: @order.brand).count(:id)
# Update history after request new order
@history = History... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_params\n # Only allow the user to edit the title and the contetn of a new\n params.require(:new).permit(:title, :content)\n end",
"def add_params(new)\n # We do not check for duplication on purpose: multiple calls\n # to add_params should be cumulative\n new.each {... | [
"0.66707426",
"0.66399753",
"0.66170734",
"0.65835893",
"0.6577507",
"0.64929354",
"0.6486691",
"0.6480517",
"0.64652985",
"0.64149445",
"0.64149445",
"0.64149445",
"0.64149445",
"0.64149445",
"0.64149445",
"0.64149445",
"0.64149445",
"0.64149445",
"0.64149445",
"0.64149445",
... | 0.0 | -1 |
Action for params that got from edit | def update
# Set notice after update action
respond_to do |format|
if @order.update(order_params)
format.html { redirect_to @order, notice: 'Order was successfully updated.' }
format.json { render :show, status: :ok, location: @order }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n\n end",
"def edit\r\n \r\n end",
"def edit(params)\n http_helper.send_post_request(\"#{@url_prefix}/edit\", params)\n end",
"def edit\r\n end",
"def edit\n \n end",
"def edit\n\t\t\n\tend",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
... | [
"0.7422835",
"0.73774827",
"0.7375415",
"0.73601615",
"0.7329665",
"0.7308468",
"0.7308307",
"0.72880757",
"0.72880757",
"0.72880757",
"0.72880757",
"0.72880757",
"0.72880757",
"0.72880757",
"0.72880757",
"0.72880757",
"0.72880757",
"0.72880757",
"0.72880757",
"0.72880757",
"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_order
@order = Order.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def order_params
params.require(:order).permit(:product, :brand, :amount)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Set action to index page | def index_page
# For search action
if params[:search] && params[:search] != ""
Order.index(sort_column, sort_direction, params[:page], params[:search])
else
Order.index(sort_column, sort_direction, params[:page])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action\n \"index\"\n end",
"def index\r\n end",
"def index\n \n redirect_to ( :action => \"list\")\n end",
"def index\n redirect_to :action => \"home\"\n end",
"def index\r\n end",
"def index\r\n end",
"def index\r\n end",
"def index\r\n list\r\n render_action 'list'\... | [
"0.79787666",
"0.7289561",
"0.7238098",
"0.72238404",
"0.72237074",
"0.72237074",
"0.72237074",
"0.7211676",
"0.7165746",
"0.71400267",
"0.71336216",
"0.71088547",
"0.71088547",
"0.71088547",
"0.71088547",
"0.71088547",
"0.71088547",
"0.71088547",
"0.71088547",
"0.7096595",
"... | 0.0 | -1 |
Set and get default of column to sort | def sort_column
Order.column_names.include?(params[:sort]) ? params[:sort] : "updated_at"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_column\n nil\n end",
"def sort_column(columns, default)\n columns.include?(params[:sort]) ? params[:sort] : default\n end",
"def sort_column klass, default_column = \"sort_order\"\n klass.constantize.column_names.include?(params[:sort]) ? params[:sort] : default_column\n end",
"d... | [
"0.7771473",
"0.7659191",
"0.7546548",
"0.7528647",
"0.7528647",
"0.74736243",
"0.74425596",
"0.7380745",
"0.7294264",
"0.7161491",
"0.7147585",
"0.71314913",
"0.7109389",
"0.71005285",
"0.70978177",
"0.70550215",
"0.70465887",
"0.6909049",
"0.6909049",
"0.6907196",
"0.689809... | 0.6711097 | 48 |
Set a sort direction between asc and desc | def sort_direction
%w[asc desc].include?(params[:direction]) ? params[:direction] : "desc"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_direction\n params[:dir] == \"asc\" ? \"asc\" : \"desc\"\n end",
"def sort_direction\n params[\"order\"][\"0\"][\"dir\"] == \"desc\" ? \"desc\" : \"asc\"\n end",
"def sort_direction\n %w[asc, desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_directio... | [
"0.8070791",
"0.79576063",
"0.79252446",
"0.7915123",
"0.7915123",
"0.7915123",
"0.7888232",
"0.7838864",
"0.7805947",
"0.7805947",
"0.7805947",
"0.7805947",
"0.7805947",
"0.7786107",
"0.7781922",
"0.7769284",
"0.7765846",
"0.7765846",
"0.7765846",
"0.7765846",
"0.7765846",
... | 0.7950387 | 3 |
method takes int and returns a string, as above int / 10 with modulus to get remainder e.g. 4 gives 0 and mod 4 17 gives 1 X mod 7 23 gives 2 XX mod 3 57 gives 5 L mod 7 107 gives C 7 145 gives C XXXX V modern create a method to operate on each number Thousands,Five hundreds, Hundreds, Tens,fives, ones | def old_roman_string num
raise "Use positive integer" if num <= 0
roman_str = ''
roman_str << 'M' * (num /1000)
roman_str << 'D' * (num % 1000 / 500)
roman_str << 'C' * (num % 500 / 100)
roman_str << 'L' * (num % 100 / 50)
roman_str << 'X' * (num % 50 / 10)
roman_str << 'V' * (num % 10 / 5)
roman_str << 'I' * (num... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def integer_to_string(number)\n result = []\n loop do\n divisor, remainder = number.divmod 10\n result.unshift(remainder) # or use push/<<, then reverse the array after loop ends\n break if divisor == 0\n number = divisor\n end\n \n result.join\nend",
"def integer_to_string(int)\n int_str = ''\... | [
"0.74238324",
"0.73362434",
"0.7249714",
"0.7239978",
"0.70832795",
"0.7067528",
"0.7062352",
"0.704556",
"0.7034099",
"0.6990809",
"0.69315743",
"0.68945664",
"0.6889801",
"0.688739",
"0.6884122",
"0.6878202",
"0.68652004",
"0.68463",
"0.68399066",
"0.6838205",
"0.682987",
... | 0.0 | -1 |
Returns truthy if two descriptions share too many words | def word_overlap?(item)
first_array = self.clean_description.split.declutter
second_array = item.clean_description.split.declutter
first_array.percentage_similarity_to(second_array) > 85 ? "Too much word overlap" : false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_description?(freelancer_descr, profile_descr)\n serialized_freelance_descr = freelancer_descr.chomp(\"...\").split(\" \")\n serialized_profile_descr = profile_descr.gsub(\"\\n\", \" \").split(\" \")[0..serialized_freelance_descr.size-1]\n comparision = serialized_freelance_descr - serialized_p... | [
"0.70451814",
"0.6973614",
"0.68647945",
"0.67625326",
"0.6577238",
"0.6404621",
"0.63256705",
"0.623791",
"0.6212595",
"0.6200048",
"0.6189053",
"0.61318135",
"0.6131543",
"0.60561186",
"0.6039106",
"0.600158",
"0.5988242",
"0.5971569",
"0.59423715",
"0.5928138",
"0.5895002"... | 0.78396857 | 0 |
Returns truthy if two descriptions share too many characteres | def character_overlap?(item)
first_array = self.decluttered_and_squished_description.split('')
second_array = item.decluttered_and_squished_description.split('')
first_array.percentage_similarity_to(second_array) > 80 ? "Too much character overlap" : false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_description?(freelancer_descr, profile_descr)\n serialized_freelance_descr = freelancer_descr.chomp(\"...\").split(\" \")\n serialized_profile_descr = profile_descr.gsub(\"\\n\", \" \").split(\" \")[0..serialized_freelance_descr.size-1]\n comparision = serialized_freelance_descr - serialized_p... | [
"0.7017018",
"0.69357574",
"0.66613984",
"0.6512262",
"0.640526",
"0.6391175",
"0.63556015",
"0.6311594",
"0.6304734",
"0.6282918",
"0.62708485",
"0.6213477",
"0.6203111",
"0.61142576",
"0.61040616",
"0.60828257",
"0.6079281",
"0.6044846",
"0.6038303",
"0.60340947",
"0.601613... | 0.7574837 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_campaign
@campaign = Campaign.find params[:campaign_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
String, name : initialize param :input:args:arrays of strings args[0]:targets:string coma separated list of targets args[1]:string root arsg[2]:steps:string ['Status',RunFlrtvc','ParseFlrtvc', 'DownloadFixes', 'CheckFixes','BuildResource','InstallResource'] , default InstallResource arsg[3]:level:string ['sec', 'hiper'... | def initialize(args)
#
if !args.empty?
targets = args[0]
@targets = targets.split(',')
else
@targets = ''
end
#
if args.size > 1
if !args[1].nil? && !args[1].empty?
root = args[1]
@root_dir = if root =~ %r{^\... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_request(*args); end",
"def initialize(names,options)\n super(names,options)\n @argument_name = options[:arg_name] || \"arg\"\n @must_match = options[:must_match]\n @type = options[:type]\n @mask = options[:mask]\n @required = options[:required]\n @multiple = options[:... | [
"0.5939533",
"0.5749135",
"0.5729949",
"0.57272995",
"0.56305546",
"0.5612692",
"0.55911994",
"0.55548257",
"0.5513177",
"0.547255",
"0.54538935",
"0.5438575",
"0.5418925",
"0.54123634",
"0.5407366",
"0.54035497",
"0.53763044",
"0.5359639",
"0.53412896",
"0.53337693",
"0.5328... | 0.67902654 | 0 |
name : check_flrtvc param : return : description : no need to explain but not used | def check_flrtvc
raise FlrtvcNotFound unless ::File.exist?('/usr/bin/flrtvc.ksh')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check(params)\n false\n end",
"def check\n \n end",
"def check\n \n end",
"def check_params; true; end",
"def check ; true ; end",
"def checks; end",
"def verify_params\n Validate::params_match @func, @current_param\n end",
"def valid?\n \n ... | [
"0.6412566",
"0.63794285",
"0.63794285",
"0.61565584",
"0.60719997",
"0.5864519",
"0.58520377",
"0.58490235",
"0.5844774",
"0.5844774",
"0.58414453",
"0.58321655",
"0.5812941",
"0.5777884",
"0.57666075",
"0.57041705",
"0.5693337",
"0.56737995",
"0.5652058",
"0.56358904",
"0.5... | 0.5969779 | 5 |
name : get_flrtvc_name param : input:type:symbol either :AdvisoryFlrtvc or :AdvisoryURLs or :DownloadURLs or :common_efixes :temp_dir or :efixes or :emgr or :filesets or :flrtvc or :lslpp or :NIM_dir or :NIM_res or :URL or :YML or any string param : input:target:string not for :common_efixes :temp_dir param : input:nam... | def get_flrtvc_name(type,
target = '',
name_suffix = '')
#
# Log.log_debug('get_flrtvc_name type=' + type.to_s + ' target=' +
# target.to_s + ' name_suffix=' + name_suffix.to_s)
case type
when :temp_dir
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNameForPrecompiled\n sanitizeForPath(\"#{@Name}_#{@Version}_\" +\n (@BranchEpoch ? \"sv_#{@BranchEpoch}_\" : '') +\n \"opts_#{optionsHash}\")\n end",
"def file_name(dir: T.unsafe(nil), name: T.unsafe(nil), ext: T.unsafe(nil), directory_separator: T.unsafe(nil)); e... | [
"0.5212531",
"0.51201797",
"0.50914115",
"0.50707537",
"0.5067773",
"0.50648963",
"0.50433946",
"0.50158596",
"0.5000362",
"0.499823",
"0.49890405",
"0.49693292",
"0.49479556",
"0.49331617",
"0.49196804",
"0.49150726",
"0.49086672",
"0.49033368",
"0.4896489",
"0.4896489",
"0.... | 0.7683647 | 0 |
name : mine_this_step param : input:step:string current step being done, to log it param : input:target:string one particular target on which action is being done return : hash with false as key and yml content as value, or with true as key and nil as value. description : if true is returned as key, it means that the m... | def mine_this_step(step,
target)
Log.log_debug('Into mine_this_step (target=' + target + \
') step=' + step.to_s + ' force=' + @force.to_s)
returned = {}
target_yml_file = get_flrtvc_name(:YML, target, step)
#
if @force == 'yes'
Log.log_debug('I... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_step(step,sample)\t\n\n\t\t\t\t# setting job working directory\n\t\t\t\tworking_dir = \"\"\t\n\t\t\t\tif self.local \n\t\t\t\t\tworking_dir = self.local+\"/\"+self.name\n\t\t\t\telse\n\t\t\t\t\tworking_dir = self.output\n\n\t\t\t\t\tif step.is_multi?\t\n\t\t\t\t\t\tfolder = (self.custom_output) ? self.cust... | [
"0.599441",
"0.5888625",
"0.56065786",
"0.5591483",
"0.5544922",
"0.5499181",
"0.54174966",
"0.53754115",
"0.53248847",
"0.53110176",
"0.53053707",
"0.52951175",
"0.5270732",
"0.52652335",
"0.52487326",
"0.5185392",
"0.51845837",
"0.5179348",
"0.51690346",
"0.51618207",
"0.51... | 0.75522405 | 0 |
name : run_step param : input:step:string current step being done, to log it param : input:target:string one particular target on which action is being done param : input:param: specific param for this step return : depending on the step description : switch function, to call specific function for each step. | def run_step(step,
target,
param = '')
# Log.log_debug('Into run_step(' + step.to_s + ', ' +
# target + ', ' + param.to_s + ')')
case step
when :status
returned = step_status(step, target, param)
when :installFlrtvc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(step)\n end",
"def step msg\n end",
"def run_step_one\n puts \"Executing Step ONE\"\n end",
"def step_result; end",
"def step1\n \n end",
"def step1\n\n end",
"def step_two()\r\nend",
"def step(name, opts = T.unsafe(nil)); end",
"def visit_step(step)\n tc_before_step... | [
"0.66542286",
"0.6614186",
"0.65040326",
"0.6482162",
"0.64345104",
"0.6381851",
"0.6346376",
"0.62620354",
"0.61748374",
"0.61578584",
"0.6107739",
"0.6063599",
"0.6057308",
"0.60519326",
"0.60495454",
"0.60364676",
"0.5991616",
"0.59857947",
"0.5943812",
"0.58806026",
"0.58... | 0.75669473 | 0 |
name : step_status param : input:step:string current step being done, to log it param : input:target:string one particular target on which action is being done param : input:yaml_file_name:yaml file name to persist output, if no param is provided, output is not persisted. return : status of the target description : ple... | def step_status(step,
target,
yaml_file_name = '')
Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')')
status_output = Utils.status(target)
status_output.keys.each do |key|
Log.log_info(' ' + key + '=>' + status_output[key... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mine_this_step(step,\n target)\n Log.log_debug('Into mine_this_step (target=' + target + \\\n') step=' + step.to_s + ' force=' + @force.to_s)\n returned = {}\n target_yml_file = get_flrtvc_name(:YML, target, step)\n #\n if @force == 'yes'\n Lo... | [
"0.68089205",
"0.61067957",
"0.60625935",
"0.5975485",
"0.5956903",
"0.5877242",
"0.5860547",
"0.56032413",
"0.55707407",
"0.54961663",
"0.5474727",
"0.5440021",
"0.5410324",
"0.5389214",
"0.5386097",
"0.5386097",
"0.53781545",
"0.5371308",
"0.5364466",
"0.5353992",
"0.533716... | 0.76408887 | 0 |
name : step_install_flrtvc param : input:step:string current step being done, to log it return : 0 if everything is ok description : step to install flrtvc if it is not installed. | def step_install_flrtvc(step)
Log.log_debug('Into step ' + step.to_s)
Utils.check_install_flrtvc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step_run_flrtvc(step,\n target)\n Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')')\n mine_this_step_hash = mine_this_step(step, target)\n if mine_this_step_hash[false].nil?\n Log.log_debug('Doing mine_this_step (target=' + target +\n... | [
"0.6871704",
"0.6004547",
"0.55842596",
"0.550775",
"0.5360447",
"0.5334406",
"0.5293596",
"0.52498066",
"0.5230362",
"0.52258164",
"0.5219904",
"0.51951",
"0.5194313",
"0.5194313",
"0.518615",
"0.5164902",
"0.51475245",
"0.5111882",
"0.5101894",
"0.50922453",
"0.50901634",
... | 0.88984376 | 0 |
name : step_run_flrtvc param : input:step:string current step being done, to log it param : input:target:string one particular target on which action is being done return : array of flrtvc output (either from yml output, or from flrtvc command) description : gathers all elements (output of lslpp, output of emgr) to be ... | def step_run_flrtvc(step,
target)
Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')')
mine_this_step_hash = mine_this_step(step, target)
if mine_this_step_hash[false].nil?
Log.log_debug('Doing mine_this_step (target=' + target +
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_step(step,\n target,\n param = '')\n # Log.log_debug('Into run_step(' + step.to_s + ', ' +\n # target + ', ' + param.to_s + ')')\n case step\n when :status\n returned = step_status(step, target, param)\n when :... | [
"0.65662944",
"0.6329646",
"0.6067764",
"0.5791255",
"0.5629625",
"0.51775867",
"0.5171693",
"0.5097078",
"0.5083946",
"0.5073938",
"0.4976345",
"0.49107382",
"0.48976663",
"0.48783344",
"0.4845393",
"0.48435226",
"0.48153746",
"0.48138502",
"0.48079467",
"0.47917986",
"0.477... | 0.8029314 | 0 |
name : step_parse_flrtvc param : input:step:string current step being done, to log it param : input:target:string one particular target on which action is being done param : input:flrtvc_report:string return : urls of fixes description : parse output file generated by flrtvc for this particular target, to retrieve all ... | def step_parse_flrtvc(step,
target,
flrtvc_report)
Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')')
#
mine_this_step_hash = mine_this_step(step, target)
if mine_this_step_hash[false].nil?
Log.log_deb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step_run_flrtvc(step,\n target)\n Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')')\n mine_this_step_hash = mine_this_step(step, target)\n if mine_this_step_hash[false].nil?\n Log.log_debug('Doing mine_this_step (target=' + target +\n... | [
"0.6245715",
"0.6139971",
"0.5663386",
"0.55266577",
"0.54059577",
"0.5387598",
"0.51689124",
"0.50989735",
"0.5090145",
"0.49492654",
"0.47712237",
"0.46671262",
"0.46651414",
"0.465649",
"0.46511582",
"0.4638462",
"0.46247002",
"0.45981416",
"0.45778146",
"0.45751917",
"0.4... | 0.8222691 | 0 |
name : step_perform_downloads param : input:step:string current step being done, to log it param : input:target:string one particular target on which action is being done param : input:urls_of_target:urls return : listoffixes description : First download is organized, and shared among all targets URLs can follow severa... | def step_perform_downloads(step,
target,
urls_of_target)
Log.log_info('Flrtvc step : ' + urls_of_target.length.to_s + ' ' + step.to_s + ' (target=' + target + ')')
urls_of_target.each do |url_of_target|
Log.log_debug(' url=' + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_fct(target,\n url_to_download,\n count,\n total)\n Log.log_debug('Into download_fct (target=' + target +\n ') url_to_download=' + url_to_download +\n ' count=' + count.to_s +\n ... | [
"0.6422832",
"0.64121276",
"0.6327526",
"0.60717094",
"0.59458727",
"0.5866489",
"0.5865",
"0.5839331",
"0.58325684",
"0.5750015",
"0.57207525",
"0.56811666",
"0.5669835",
"0.564066",
"0.5599627",
"0.5573908",
"0.5573781",
"0.5549189",
"0.55317867",
"0.5514631",
"0.5481542",
... | 0.84220165 | 0 |
name : step_check_fixes param : input:step:string current step being done, to log it param : input:target:string one particular target on which action is being done param : input:listoffixes:array of string return : listofkeptfixes_of_target description : Check of fixes is organized, so that only fixes which can be app... | def step_check_fixes(step,
target,
listoffixes)
Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')')
#
mine_this_step_hash = mine_this_step(step, target)
packaging_date_of_fixes = {}
if mine_this_step_hash[f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step_install_fixes(step,\n target,\n nimres_sortedfixes)\n Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')' +\n ' nimres_sortedfixes=' +\n nimres_sortedfixes.to_s)\n #\n ... | [
"0.6413854",
"0.6102356",
"0.560917",
"0.5458991",
"0.52197486",
"0.5141812",
"0.50658655",
"0.49971327",
"0.49633446",
"0.49457574",
"0.49355155",
"0.4757282",
"0.47438464",
"0.47284696",
"0.47004154",
"0.4609511",
"0.4593539",
"0.45409524",
"0.4515438",
"0.44986883",
"0.448... | 0.8082744 | 0 |
name : step_build_nim_resource param : input:step:string current step being done, to log it param : input:target:string one particular target on which action is being done param : input:hfixes_dates:hash with fix as key and packaging_date as value return : NIM lpp resource built as key and array of sorted fixes by pkgd... | def step_build_nim_resource(step,
target,
hfixes_dates)
Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')' +
' hfixes_dates=' +
hfixes_dates.to_s)
#
returned ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build\n new_resource.exclude_jars.each do |jar|\n exclude_jar(jar, ::File.join(new_resource.path, 'webapp', 'WEB-INF', 'lib'))\n end\n\n execute \"Building JIRA #{new_resource.version} in #{new_resource.path}\" do\n cwd new_resource.path\n command \"./build.sh #{new_resource.targets}\"\n creates... | [
"0.568395",
"0.52837753",
"0.5231078",
"0.51820934",
"0.50546396",
"0.49601907",
"0.49071354",
"0.49041933",
"0.48948765",
"0.48883677",
"0.48267984",
"0.48184887",
"0.48087016",
"0.47691616",
"0.4753747",
"0.4740852",
"0.47258818",
"0.46510088",
"0.46253702",
"0.45764923",
"... | 0.775141 | 0 |
name : step_install_fixes param : input:step:string current step being done, to log it param : input:target:string one particular target on which action is being done param : input:nimres_sortedfixes:hash with nim resource as key and array of sorted fixes by pkgdate as value return : nothing description : performs efix... | def step_install_fixes(step,
target,
nimres_sortedfixes)
Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')' +
' nimres_sortedfixes=' +
nimres_sortedfixes.to_s)
#
begin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step_check_fixes(step,\n target,\n listoffixes)\n Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')')\n #\n mine_this_step_hash = mine_this_step(step, target)\n packaging_date_of_fixes = {}\n if mine_this... | [
"0.67947245",
"0.6524239",
"0.63313246",
"0.54691374",
"0.50609344",
"0.5030081",
"0.49660692",
"0.4951436",
"0.49385762",
"0.49201894",
"0.49039638",
"0.4782512",
"0.45560697",
"0.45236295",
"0.45148098",
"0.45100164",
"0.44922614",
"0.44769162",
"0.4431291",
"0.44299105",
"... | 0.8840018 | 0 |
name : remove_nim_resources return : nothing description : For each target, remove specific NIM resource built for this target This is a convenient method used for tests, when we need to do some cycles of install efixes/uninstall efixes. | def remove_nim_resources
Log.log_info('In remove_nim_resources')
@targets.each do |target|
Log.log_debug('target=' + target)
nim_lpp_source_resource = get_flrtvc_name(:NIM_res, target)
exists = Nim.lpp_source_exists?(nim_lpp_source_resource)
Log.log_debug('exists=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_configured_resource_names\n roles = Kubernetes::Role.\n where(project_id: projects.map(&:id)).\n where(\"resource_name IS NOT NULL OR service_name IS NOT NULL\")\n roles.find_each do |role|\n role.update_attributes!(resource_name: nil, service_name: nil, manual_deletion_ac... | [
"0.5953627",
"0.59461904",
"0.5897316",
"0.56687176",
"0.5645711",
"0.5582274",
"0.55821604",
"0.55764127",
"0.5527935",
"0.55155945",
"0.5494807",
"0.544298",
"0.54371995",
"0.53624314",
"0.53123164",
"0.531009",
"0.5308538",
"0.528188",
"0.52818346",
"0.5279716",
"0.5271402... | 0.8438261 | 0 |
name : step_remove_fixes param : input:step:string current step being done, to log it param : input:target:string one particular target on which action is being done return : nothing description : For each target, uninstall efix. This is a convenient method used for tests, when we need to do some cycles of install efix... | def step_remove_fixes(step,
target)
Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')')
nim_lpp_source_resource = get_flrtvc_name(:NIM_res, target)
begin
Log.log_info('Removing efixes on ' + target)
returned = Nim.perform_efix_u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step_install_fixes(step,\n target,\n nimres_sortedfixes)\n Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')' +\n ' nimres_sortedfixes=' +\n nimres_sortedfixes.to_s)\n #\n ... | [
"0.635597",
"0.5734031",
"0.5249724",
"0.5234311",
"0.5122517",
"0.50937945",
"0.49793193",
"0.49568957",
"0.4890563",
"0.48850146",
"0.48775297",
"0.48477596",
"0.4846854",
"0.4817957",
"0.47942337",
"0.47090352",
"0.46873066",
"0.46762183",
"0.46762183",
"0.46737918",
"0.46... | 0.8317569 | 0 |
name : remove_downloaded return : nothing description : removes all efix downloaded files (.tar .epkg.Z) This is a convenient method used for tests, when we need to do some cycles of install efixes/uninstall efixes. | def remove_downloaded_files
Log.log_info('In remove_downloaded_files')
begin
Log.log_debug('Removing downloaded files')
# TBI
Log.log_debug('End removing downloaded files')
rescue StandardError => e
Log.log_err('Exception e=' + e.to_s)
end
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanDownloads()\n dir(\"#{DOWNLOADS_DIR}/*\").each do |path|\n if path != PREV_DOWNLOADS_DIR\n # colourFile(path)\n moveOldDownload(path)\n end\n end\n end",
"def delete_downloads\n FileUtils.remove_entry_secure(dir) if Dir.exist?(dir)\n end",
"def cleanup_download_path\... | [
"0.64101845",
"0.63258946",
"0.61507463",
"0.6019618",
"0.59880984",
"0.5925935",
"0.58789897",
"0.5878927",
"0.5815068",
"0.5798278",
"0.5793163",
"0.562875",
"0.56029296",
"0.5599098",
"0.5544235",
"0.5544235",
"0.55321306",
"0.5507151",
"0.5502297",
"0.5487408",
"0.5470529... | 0.7702392 | 0 |
name : download_fct param : input:target:string one particular target on which action is being done param : input:url_to_download:string param : input:count:string param : input:total:string return : hash with efix file names as keys and either 1;0;1 as values 1 meaning that there was an error and download was not done... | def download_fct(target,
url_to_download,
count,
total)
Log.log_debug('Into download_fct (target=' + target +
') url_to_download=' + url_to_download +
' count=' + count.to_s +
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ftp_download(target,\n url_to_download,\n count,\n total,\n ftp_server,\n ftp_dir,\n destination_dir)\n Log.log_debug(' Into download (target=' + target +\n ... | [
"0.69731146",
"0.6896958",
"0.60907227",
"0.60701597",
"0.6036027",
"0.5755308",
"0.5731725",
"0.5710946",
"0.56290746",
"0.55726874",
"0.554101",
"0.5515768",
"0.5488003",
"0.5470995",
"0.5429287",
"0.54100037",
"0.53978133",
"0.53937083",
"0.53887486",
"0.53866285",
"0.5364... | 0.8071681 | 0 |
name : download param : input:target:string param : input:download_url:string param : input:destination_file:string param : input:protocol:string return : either 1;0;1 1 meaning there was an error and download could not be done 0 meaning download was not done, but it was normal, as already done 1 meaning download has b... | def download(target,
download_url,
destination_file,
protocol)
Log.log_debug('Into download (target=' + target +
') download_url=' + download_url +
' destination_file=' + destination_file +
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download!(source_url, destination_file); end",
"def download_file(url, dest)\n ENV['DLURL'] = url\n ENV['DLDEST'] = dest\n retval = $options['verbose'] ? \n system($options['dlcommand']) :\n system($options['dlcommand'] + $options['sink'])\n\n unless retval\n debug(\"System d... | [
"0.7745686",
"0.7109198",
"0.70386046",
"0.68244946",
"0.6692206",
"0.6691801",
"0.6635847",
"0.66135955",
"0.6561674",
"0.6512114",
"0.64920115",
"0.6479273",
"0.6464178",
"0.64519936",
"0.642635",
"0.64249223",
"0.6414778",
"0.64111525",
"0.6407155",
"0.6394037",
"0.6360728... | 0.7910086 | 0 |
name : download param : input:target:string param : input:url_to_download:string param : input:count:string param : input:total:string param : input:ftp_server:string param : input:ftp_dir:string param : input:destination_dir:string return : hash with true if download has been done, false if download has been skipped, ... | def ftp_download(target,
url_to_download,
count,
total,
ftp_server,
ftp_dir,
destination_dir)
Log.log_debug(' Into download (target=' + target +
')... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download(target,\n download_url,\n destination_file,\n protocol)\n Log.log_debug('Into download (target=' + target +\n ') download_url=' + download_url +\n ' destination_file=' + destination_file +\n ... | [
"0.7464989",
"0.74295205",
"0.70572054",
"0.7021649",
"0.66598684",
"0.6625971",
"0.6552178",
"0.65238845",
"0.65105075",
"0.64983356",
"0.6462465",
"0.6461428",
"0.64236575",
"0.6422926",
"0.6401265",
"0.6341879",
"0.6293081",
"0.6259254",
"0.6246544",
"0.62251294",
"0.62112... | 0.8015322 | 0 |
name : tar_tf param : input:src:string return : array of relative file names which belong to the tar file description : | def tar_tf(file_to_untar)
Log.log_debug('Into tar_tf file_to_untar=' + file_to_untar)
returned = []
begin
command_output = []
command = "/bin/tar -tf #{file_to_untar} | /bin/grep epkg.Z$"
Utils.execute2(command, command_output)
untarred_files_array = comma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tar_content_filenames\n `tar tzf #{filename}`.split(\"\\n\")\n end",
"def list_tar_file(tar_file)\n `tar tfz #{tar_file}`.split(/[\\r\\n]+/)\n end",
"def full_tarfile #:nodoc:\n [tar_directory, tarfile].join(\"/\")\n end",
"def listTar\n tarfiles = File.join(data_path, '/', '*.tar')\n... | [
"0.69718593",
"0.6956286",
"0.6489996",
"0.61880374",
"0.60541284",
"0.60137576",
"0.59740126",
"0.5947074",
"0.56250423",
"0.55385",
"0.5538469",
"0.5526707",
"0.54693216",
"0.5468971",
"0.5408175",
"0.5380575",
"0.537472",
"0.53559023",
"0.53555185",
"0.53402454",
"0.533776... | 0.6558248 | 2 |
name : untar param : input:file_to_untar:string param : input:directory_for_untar:string return : array of absolute file names which have been untarred. description : performs untar and returns result of untar | def untar(file_to_untar,
directory_for_untar)
Log.log_debug('Into untar file_to_untar=' + file_to_untar +
' directory_for_untar=' + directory_for_untar)
returned = []
begin
command_output = []
command = "/bin/tar -tf #{file_to_untar} ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tar_tf(file_to_untar)\n Log.log_debug('Into tar_tf file_to_untar=' + file_to_untar)\n returned = []\n begin\n command_output = []\n command = \"/bin/tar -tf #{file_to_untar} | /bin/grep epkg.Z$\"\n Utils.execute2(command, command_output)\n untarred_files... | [
"0.69418913",
"0.6605054",
"0.6600663",
"0.6542406",
"0.6479121",
"0.6459987",
"0.6449227",
"0.6277579",
"0.61600477",
"0.61240566",
"0.6079987",
"0.5897362",
"0.58844763",
"0.5874584",
"0.5801364",
"0.57494015",
"0.57380867",
"0.56840086",
"0.5648555",
"0.56245166",
"0.55982... | 0.7767213 | 0 |
name : min_max_level_prereq_of param : input:fixfile:string return : hash with lpp as keys and [min, max] as values, for all lpp impacted by the efix description : this method parses the fix to get the prereq min max values | def min_max_level_prereq_of(fixfile)
Log.log_debug('Into is_min_max_level_prereq_of fixfile=' + fixfile)
returned = {}
# By default we return true, meaning the fix can be applied
begin
# Get 'min level' and 'max level' from the fix
command_output = []
# envi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suggestedLevel\r\n minLevel = 1\r\n maxLevel = GameData::GrowthRate.max_level\r\n num = self.suggestedNumber\r\n for rule in @pokemonRules\r\n if rule.is_a?(MinimumLevelRestriction)\r\n minLevel = rule.level\r\n elsif rule.is_a?(MaximumLevelRestriction)\r\n maxLevel = rule.l... | [
"0.5897508",
"0.5589063",
"0.5259432",
"0.50560844",
"0.5007647",
"0.50023043",
"0.49920613",
"0.49904206",
"0.49904206",
"0.4964421",
"0.49401185",
"0.49352413",
"0.4872171",
"0.48453298",
"0.4804793",
"0.4797246",
"0.47517896",
"0.4700236",
"0.46724084",
"0.46415097",
"0.46... | 0.8302938 | 0 |
name : packaging_date_of param : input:fixfile:string return : packaging_date formatted in such a way it can be sorted description : this method parses the fix to get packaging date and format this date so that if can be sorted | def packaging_date_of(fixfile)
Log.log_debug('Into packaging_date_of fixfile=' + fixfile)
packaging_date = ''
begin
# Get 'PACKAGING DATE' from the fix
command_output = []
# environment: {'LANG' => 'C'}
Utils.execute2("/usr/sbin/emgr -dXv3 -e #{fixfile} | ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_input(input)\n raise EmptyInput, 'No content in entry' if input.nil? || input.strip.empty?\n\n input_lines = input.split(/[\\n\\r]+/).delete_if(&:ignore?)\n title = input_lines[0]&.strip\n raise EmptyInput, 'No content in first line' if title.nil? || title.strip.empty?\n\n date ... | [
"0.59856415",
"0.58606386",
"0.57101107",
"0.5538686",
"0.5528218",
"0.54939055",
"0.54717034",
"0.5465247",
"0.54132897",
"0.5378205",
"0.53204674",
"0.5297449",
"0.5291284",
"0.52740777",
"0.5263743",
"0.5224738",
"0.5212302",
"0.5194425",
"0.51902723",
"0.51762503",
"0.516... | 0.81633943 | 0 |
name : level_prereq_ok? param : input:target:string param : input:lpp:string param : input:min:string param : input:max:string return : description : this method checks that the level of the fix can be applied on the system. To perform this check, the 'min level' of the fix and the 'max level' of the fix are compared w... | def level_prereq_ok?(target,
lpp,
min,
max)
Log.log_debug('Into level_prereq_ok? (target=' +
target +
'), lpp=' +
lpp +
', min=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_max_level_prereq_of(fixfile)\n Log.log_debug('Into is_min_max_level_prereq_of fixfile=' + fixfile)\n returned = {}\n # By default we return true, meaning the fix can be applied\n begin\n # Get 'min level' and 'max level' from the fix\n command_output = []\n ... | [
"0.6557516",
"0.57798",
"0.57009053",
"0.5657202",
"0.5619898",
"0.55545807",
"0.5462045",
"0.54594463",
"0.54502624",
"0.54230875",
"0.54215616",
"0.5419154",
"0.53740126",
"0.5357294",
"0.53137577",
"0.52064806",
"0.5190231",
"0.5184419",
"0.5182623",
"0.5174636",
"0.515449... | 0.8360227 | 0 |
name : filter_lock_fixes param : input:target:string param : input:lpp_source_dir:string param : input:efixes_basenames:array return hash table efix=>Files location filtered by locked filesets description : filtering fixes list by locked files | def filter_lock_fixes(target,
lpp_source_dir,
efixes_basenames)
Log.log_debug('Into filter_lock_fixes (target=' +
target +
'), lpp_source_dir=' +
lpp_source_dir +
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step_check_fixes(step,\n target,\n listoffixes)\n Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')')\n #\n mine_this_step_hash = mine_this_step(step, target)\n packaging_date_of_fixes = {}\n if mine_this... | [
"0.56294674",
"0.5498259",
"0.5492163",
"0.54089737",
"0.52989125",
"0.52989125",
"0.52426255",
"0.5197542",
"0.5163652",
"0.5150302",
"0.51444334",
"0.5050858",
"0.5047832",
"0.503542",
"0.5030523",
"0.5000932",
"0.49965227",
"0.49765947",
"0.4968677",
"0.49576056",
"0.49408... | 0.8300143 | 0 |
name : get_efix_files_loc param : input:lpp_source_dir:string param : input:filesets:array return hash table locked files (key = fileset) description : get impacted location files from fileset list | def get_efix_files_loc(lpp_source_dir,
filesets)
Log.log_debug('Into get_efix_files_loc' +
', lpp_source_dir=' +
lpp_source_dir +
', filesets=' +
filesets.to_s)
loc_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_sets\n @file_sets ||= begin\n geo_concern.geo_file_set_presenters\n end\n end",
"def caller_files\n caller_locations.\n map { |file,line| file }\n end",
"def files\n file_sets.map{|fs| fs.files }.flatten\n end",
"def files\n ... | [
"0.5946409",
"0.58867055",
"0.57478994",
"0.5680277",
"0.56669605",
"0.5611747",
"0.56053156",
"0.55959356",
"0.55933136",
"0.55910605",
"0.55841094",
"0.55601406",
"0.5524068",
"0.5515623",
"0.5456062",
"0.5434591",
"0.54273367",
"0.5403684",
"0.54013985",
"0.5356234",
"0.53... | 0.8477771 | 0 |
Just pretend you didn't see this and that I'm a better programmer | def outtoconsole(things)
sep = ", "
things = [things]
print things.join(sep).to_s + "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probers; end",
"def private; end",
"def anchored; end",
"def schubert; end",
"def who_we_are\r\n end",
"def silly_adjective; end",
"def herald; end",
"def jack_handey; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def buzzword; end",
"def buzzword... | [
"0.7101698",
"0.7041421",
"0.6771291",
"0.65537477",
"0.6537835",
"0.6495874",
"0.648229",
"0.64530367",
"0.6414432",
"0.6414432",
"0.6414432",
"0.6414432",
"0.6413937",
"0.6413937",
"0.6393073",
"0.6382765",
"0.6317685",
"0.62361735",
"0.6219102",
"0.6216388",
"0.6179352",
... | 0.0 | -1 |
Global access test: class Application [:index, :show] end | def access_test(*args)
options = args[-1].is_a?(Hash) ? args.pop : {}
before(*[options]) {|c| c.access_test(args)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app; @app; end",
"def app\n TestApp.new\n end",
"def main\n @app.main\n end",
"def appindex\n\n end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app... | [
"0.6848215",
"0.6781078",
"0.6636442",
"0.66242605",
"0.6586419",
"0.6586419",
"0.6586419",
"0.6586419",
"0.6586419",
"0.6586419",
"0.6586419",
"0.6586419",
"0.6586419",
"0.6586419",
"0.6572695",
"0.65175915",
"0.65068096",
"0.6429394",
"0.64158994",
"0.6408153",
"0.63880134"... | 0.0 | -1 |
team statistics for player | def lacrosse_scoring_average(sport, player)
goals = 0
games = sport.teams.find(player.team_id).gameschedules
games.each do |g|
stat = g.lacrosstats.find_by(athlete_id: player.id)
goals += stat.lacross_scorings.count if stat.lacross_scorings.any?
end
if games > 0
return goals / games.count
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_stats(name)\n# player_stats start at nil (nothing)\n player_stats = nil\n# game_hash.each do |home_away, team_info| iterates over the hash to return all player_stats\n game_hash.each do |home_away, team_info|\n team_info.each do |data_label, data|\n if data_label == :players\n data.each... | [
"0.74419737",
"0.739373",
"0.73387474",
"0.7320412",
"0.73088604",
"0.72817343",
"0.7231454",
"0.7228105",
"0.7189541",
"0.7189202",
"0.71424395",
"0.7141674",
"0.71337163",
"0.71251625",
"0.71108747",
"0.7106462",
"0.7095304",
"0.7094306",
"0.7069742",
"0.7058764",
"0.705405... | 0.0 | -1 |
DELETE /messages/1 DELETE /messages/1.json | def destroy
@message = Message.find(params[:id])
@message.destroy
respond_to do |format|
format.html { redirect_to messages_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end",
"def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n @message.destroy\n \n ... | [
"0.79590774",
"0.7747881",
"0.771779",
"0.76623553",
"0.7639338",
"0.76313365",
"0.7628893",
"0.76116306",
"0.76056355",
"0.7605057",
"0.7605057",
"0.7592493",
"0.75893265",
"0.75893265",
"0.75893265",
"0.75893265",
"0.7552685",
"0.7538219",
"0.7505909",
"0.74848205",
"0.7474... | 0.7550845 | 37 |
Establish getter and setter methods for our 'knowledge' attribute. | def initialize
@knowledge = [] # When we make a new student, that instance of a student will create an array tied to that specific student
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def knowledge\n @knowledge\n end",
"def knowledge\n @knowledge\n end",
"def initialize\n @knowledge = []\n\n end",
"def set_knowledge\n @knowledge = Knowledge.find(params[:id])\n end",
"def set_knowledge\n @knowledge = Knowledge.find(params[:id])\n end",
"def initialize\n ... | [
"0.72202",
"0.71849376",
"0.6907009",
"0.68640447",
"0.68640447",
"0.6710124",
"0.6589806",
"0.609537",
"0.5902805",
"0.5689094",
"0.56357425",
"0.53235495",
"0.52486974",
"0.5246356",
"0.5218926",
"0.51704663",
"0.5151116",
"0.5148589",
"0.51161635",
"0.5109293",
"0.5109293"... | 0.60581744 | 8 |
create the new logger with the default debug or accepting a log_level parameter | def initialize(log_level = 'debug')
@logger = Logger.new(STDOUT, level: log_level)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_logger(name, logdev, loglvl)\n logdev = [ global_logdev(name), logdev, $stderr ].find { |e| e }\n loglvl = [ global_loglvl(name), loglvl, Logger::INFO ].find { |e| e }\n logger = Logger.new(logdev)\n logger.level = loglvl\n logger.formatter = proc { |sev, datetime, progname, msg|\n... | [
"0.7035357",
"0.6725079",
"0.6725079",
"0.67241776",
"0.6609654",
"0.65670985",
"0.65634304",
"0.65469706",
"0.65210277",
"0.6502964",
"0.64637715",
"0.64637715",
"0.6455644",
"0.63672966",
"0.6331987",
"0.6331987",
"0.6331987",
"0.6322656",
"0.6302731",
"0.62957007",
"0.6276... | 0.672427 | 3 |
Returns the proxy to the java api | def method_missing(m, *args, &block)
return @services[m.to_sym] if @services.include? m.to_sym
raise NoMethodError.new("undefined method `#{m}' for #{self}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proxy\n @proxy\n end",
"def proxy\n return @proxy\n end",
"def http_proxy; end",
"def using_proxy?; end",
"def proxy\n @proxy ||= Proxy.new self\n end",
"def proxy; end",
"def proxy; end",
"def proxy; end",
"def proxy\n\t\t\tself.options[:proxy]\n\t... | [
"0.77953196",
"0.7550401",
"0.74426514",
"0.73370177",
"0.72237754",
"0.7215051",
"0.7215051",
"0.7215051",
"0.6918995",
"0.6902466",
"0.6902466",
"0.68915975",
"0.6820755",
"0.67682606",
"0.67682606",
"0.674893",
"0.6748019",
"0.6712074",
"0.670334",
"0.66588277",
"0.6599058... | 0.0 | -1 |
Binary search for the first elem in this array matching according to mode in the range (low..high1) Elements are compared using after mapping them using the provided block The supported modes are :asc array is expected to be sorted in ascending order, first geq elem is matched :asc_eq array expected to be sorted in asc... | def bin_index_by(elem, mode, low = 0, high = -1)
dir = if ::BinSearch::MODE_IS_ASC.include?(mode) then +1 else -1 end
check_eq = ::BinSearch::MODE_CHECK_EQ.include?(mode)
high = size - 1 if high < 0
e = yield elem
_bin_index(elem, low, high, dir, check_eq) { |b| e <=> (yiel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bin_search_by(elem, mode, low = 0, high = -1)\n dir = if ::BinSearch::MODE_IS_ASC.include?(mode) then +1 else -1 end\n check_eq = ::BinSearch::MODE_CHECK_EQ.include?(mode)\n high = size - 1 if high < 0\n e = yield elem\n _bin_search(elem, low, high, dir, check_eq) { |b|... | [
"0.69712573",
"0.68294007",
"0.6822791",
"0.6595416",
"0.5530662",
"0.54558516",
"0.53744084",
"0.5346362",
"0.53204685",
"0.5307713",
"0.5298964",
"0.5297905",
"0.52631354",
"0.52557933",
"0.5217618",
"0.5200348",
"0.51742494",
"0.51663125",
"0.5162699",
"0.5151497",
"0.5149... | 0.67096925 | 3 |
Binary search for the first elem in this array matching according to mode in the range (low..high1) By default, is used to compare elements. Alternatively, a comparator may be specified as block parameter The supported modes are :asc array is expected to be sorted in ascending order, first geq elem is matched :asc_eq a... | def bin_search(elem, mode, low = 0, high = -1)
dir = if ::BinSearch::MODE_IS_ASC.include?(mode) then +1 else -1 end
check_eq = ::BinSearch::MODE_CHECK_EQ.include?(mode)
high = size - 1 if high < 0
if block_given?
then _bin_search(elem, low, high, dir, check_eq) { |b| yield elem,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bin_search_by(elem, mode, low = 0, high = -1)\n dir = if ::BinSearch::MODE_IS_ASC.include?(mode) then +1 else -1 end\n check_eq = ::BinSearch::MODE_CHECK_EQ.include?(mode)\n high = size - 1 if high < 0\n e = yield elem\n _bin_search(elem, low, high, dir, check_eq) { |b|... | [
"0.73065835",
"0.703703",
"0.6911256",
"0.6822951",
"0.5764221",
"0.5576582",
"0.55386704",
"0.5498984",
"0.5376204",
"0.53623486",
"0.53221786",
"0.53024375",
"0.5283497",
"0.5223792",
"0.52123463",
"0.5201873",
"0.5200167",
"0.5199009",
"0.5188237",
"0.51850426",
"0.5181774... | 0.7157684 | 1 |
Binary search for the first elem in this array matching according to mode in the range (low..high1) Elements are compared using after mapping them using the provided block The supported modes are :asc array is expected to be sorted in ascending order, first geq elem is matched :asc_eq array expected to be sorted in asc... | def bin_search_by(elem, mode, low = 0, high = -1)
dir = if ::BinSearch::MODE_IS_ASC.include?(mode) then +1 else -1 end
check_eq = ::BinSearch::MODE_CHECK_EQ.include?(mode)
high = size - 1 if high < 0
e = yield elem
_bin_search(elem, low, high, dir, check_eq) { |b| e <=> (yi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bin_assoc_by(elem, mode, low = 0, high = -1)\n dir = if ::BinSearch::MODE_IS_ASC.include?(mode) then +1 else -1 end\n check_eq = ::BinSearch::MODE_CHECK_EQ.include?(mode)\n high = size - 1 if high < 0\n e = yield elem\n _bin_assoc(elem, low, high, dir, check_eq) { |b| e... | [
"0.6828632",
"0.6821931",
"0.67088056",
"0.65943325",
"0.5530934",
"0.5454799",
"0.53737235",
"0.53456026",
"0.5320141",
"0.5306124",
"0.5299402",
"0.5299264",
"0.52628523",
"0.5255637",
"0.52182883",
"0.5200421",
"0.51746905",
"0.5167303",
"0.5161097",
"0.5151725",
"0.514929... | 0.69707185 | 0 |
Binary search for the first elem in this array matching according to mode in the range (low..high1) By default, is used to compare elements. Alternatively, a comparator may be specified as block parameter The supported modes are :asc array is expected to be sorted in ascending order, first geq elem is matched :asc_eq a... | def bin_assoc(elem, mode, low = 0, high = -1)
dir = if ::BinSearch::MODE_IS_ASC.include?(mode) then +1 else -1 end
check_eq = ::BinSearch::MODE_CHECK_EQ.include?(mode)
high = size - 1 if high < 0
if block_given?
then _bin_assoc(elem, low, high, dir, check_eq) { |b| yield elem, b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bin_search_by(elem, mode, low = 0, high = -1)\n dir = if ::BinSearch::MODE_IS_ASC.include?(mode) then +1 else -1 end\n check_eq = ::BinSearch::MODE_CHECK_EQ.include?(mode)\n high = size - 1 if high < 0\n e = yield elem\n _bin_search(elem, low, high, dir, check_eq) { |b|... | [
"0.73065835",
"0.7157684",
"0.703703",
"0.6911256",
"0.5764221",
"0.5576582",
"0.55386704",
"0.5498984",
"0.5376204",
"0.53623486",
"0.53221786",
"0.53024375",
"0.5283497",
"0.5223792",
"0.52123463",
"0.5201873",
"0.5200167",
"0.5199009",
"0.5188237",
"0.51850426",
"0.5181774... | 0.6822951 | 4 |
Binary search for the first elem in this array matching according to mode in the range (low..high1) Elements are compared using after mapping them using the provided block The supported modes are :asc array is expected to be sorted in ascending order, first geq elem is matched :asc_eq array expected to be sorted in asc... | def bin_assoc_by(elem, mode, low = 0, high = -1)
dir = if ::BinSearch::MODE_IS_ASC.include?(mode) then +1 else -1 end
check_eq = ::BinSearch::MODE_CHECK_EQ.include?(mode)
high = size - 1 if high < 0
e = yield elem
_bin_assoc(elem, low, high, dir, check_eq) { |b| e <=> (yiel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bin_search_by(elem, mode, low = 0, high = -1)\n dir = if ::BinSearch::MODE_IS_ASC.include?(mode) then +1 else -1 end\n check_eq = ::BinSearch::MODE_CHECK_EQ.include?(mode)\n high = size - 1 if high < 0\n e = yield elem\n _bin_search(elem, low, high, dir, check_eq) { |b|... | [
"0.69712573",
"0.6822791",
"0.67096925",
"0.6595416",
"0.5530662",
"0.54558516",
"0.53744084",
"0.5346362",
"0.53204685",
"0.5307713",
"0.5298964",
"0.5297905",
"0.52631354",
"0.52557933",
"0.5217618",
"0.5200348",
"0.51742494",
"0.51663125",
"0.5162699",
"0.5151497",
"0.5149... | 0.68294007 | 1 |
GET /urls GET /urls.json | def index
@urls = Url.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @urls = Url.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @urls }\n end\n end",
"def index\n @urls = @site.urls.paginate(:page => params[:page])\n render json: @urls\n end",
"def url_list\n urls = current_user.mini_urls\n ... | [
"0.72622925",
"0.70533806",
"0.6914229",
"0.6791078",
"0.6790144",
"0.6723092",
"0.6704383",
"0.66312903",
"0.6551795",
"0.65379965",
"0.6494516",
"0.64851487",
"0.64801353",
"0.6451444",
"0.6408628",
"0.64008194",
"0.63861555",
"0.6346339",
"0.63178754",
"0.6289575",
"0.6287... | 0.5936416 | 50 |
given long url return short | def get_short_url
long_url = params[:long_url]
if long_url.blank? || !long_url.is_valid_url?
respond_to do |format|
format.html { redirect_to urls_url, notice: 'Long URL must be in the format http://www.decisiv.com' }
format.json { render :json => {:error => "Long URL must be in the form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def short_url\n @short_url ||= client.shorten(long_url: url).link\n rescue => e\n Rails.logger.warn(\"Could not shorten bit.ly url #{e.message}\")\n url\n end",
"def shorten\n result = url\n \n begin \n if url.size > 18 && !/http:\\/\\/snipr.com.*/.match(url)\n ... | [
"0.7991704",
"0.7863017",
"0.78599954",
"0.7855835",
"0.7691918",
"0.76866955",
"0.7577211",
"0.75657",
"0.73894274",
"0.7384247",
"0.7375337",
"0.7344823",
"0.7336211",
"0.73116374",
"0.7289642",
"0.7225135",
"0.7169267",
"0.71359867",
"0.709544",
"0.7093913",
"0.70847857",
... | 0.61202943 | 81 |
GET /urls/1 GET /urls/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @urls = Url.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @urls }\n end\n end",
"def index\n @urls = ShortenedUrl.order(\"updated_at ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { re... | [
"0.6885968",
"0.66887754",
"0.66787374",
"0.66593164",
"0.6529249",
"0.6509962",
"0.64914274",
"0.6448754",
"0.64453053",
"0.6409037",
"0.64083",
"0.6267918",
"0.6236266",
"0.6223829",
"0.6216287",
"0.62162524",
"0.620276",
"0.6169882",
"0.6138518",
"0.6119957",
"0.61180186",... | 0.0 | -1 |
POST /urls POST /urls.json | def create
@url = Url.new(url_params)
respond_to do |format|
if @url.save
format.html { redirect_to @url, notice: 'Url was successfully created.' }
format.json { render :show, status: :created, location: @url }
else
format.html { render :new }
format.json { render j... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n params[:url_list].each do |url|\n WebUrl.new(:url => url).save\n end\n render :json=>params[:url_list].to_json\n end",
"def create_api\n\n @url = Url.new(:url => params[:url])\n\n if @url.save\n url_hash = Hash.new\n\n url_hash[:short_url] = root_url.to_s() + \"urls_ap... | [
"0.66614103",
"0.6225674",
"0.62237",
"0.6133381",
"0.6110082",
"0.60986954",
"0.60519725",
"0.60070646",
"0.5954528",
"0.59431005",
"0.5926763",
"0.5872233",
"0.58478326",
"0.58240664",
"0.58098954",
"0.57900316",
"0.57866234",
"0.5748828",
"0.57442534",
"0.571095",
"0.57022... | 0.58907574 | 11 |
PATCH/PUT /urls/1 PATCH/PUT /urls/1.json | def update
respond_to do |format|
if @url.update(url_params)
format.html { redirect_to @url, notice: 'Url was successfully updated.' }
format.json { render :show, status: :ok, location: @url }
else
format.html { render :edit }
format.json { render json: @url.errors, statu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def update!(**args)\n @url = args[:url] if args.key?(:url)\n end",
"def update!(**args)\n @url =... | [
"0.68182933",
"0.6337107",
"0.62940824",
"0.6281579",
"0.6281374",
"0.6281374",
"0.6281374",
"0.6281374",
"0.6281374",
"0.6281374",
"0.6281374",
"0.6281374",
"0.6281374",
"0.6281374",
"0.6281374",
"0.6281374",
"0.6281374",
"0.6281374",
"0.6281374",
"0.62741256",
"0.62440073",... | 0.5773159 | 60 |
DELETE /urls/1 DELETE /urls/1.json | def destroy
@url.destroy
respond_to do |format|
format.html { redirect_to urls_url, notice: 'Url was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n delete_from_server single_url\n end",
"def destroy\n @url.destroy\n respond_to do |format|\n format.html { redirect_to urls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @url.destroy\n respond_to do |format|\n format.html { redirect_to... | [
"0.74598366",
"0.73736393",
"0.73736393",
"0.73469806",
"0.734492",
"0.7289792",
"0.72443515",
"0.7242469",
"0.7078571",
"0.7070416",
"0.70300484",
"0.701845",
"0.7008515",
"0.6996952",
"0.6963565",
"0.6919899",
"0.6910667",
"0.6867637",
"0.6856851",
"0.68486637",
"0.68439025... | 0.7071494 | 11 |
Use callbacks to share common setup or constraints between actions. | def set_url
@url = Url.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def url_params
params.require(:url).permit(:long_url, :short_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /subscribers GET /subscribers.xml | def index
@subscribers = Subscriber.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @subscribers }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_subscribers(user, list)\n get(\"/#{user}/#{list}/subscribers.json\")\n end",
"def subscriber_list(statuspage_id)\n request :method => :get,\n :url => @url + 'subscriber/list/' + statuspage_id\n end",
"def index\n @subscribers = Subscriber.all\n end",
"def get_subscribers\n... | [
"0.72809625",
"0.7031879",
"0.6797553",
"0.6790198",
"0.6774387",
"0.6741061",
"0.6700176",
"0.669863",
"0.66632074",
"0.65705794",
"0.6503509",
"0.63921857",
"0.63725275",
"0.6368817",
"0.6358378",
"0.6327006",
"0.6324496",
"0.6304352",
"0.6295411",
"0.62503606",
"0.6249367"... | 0.7444555 | 0 |
Walk a attribute path and find the base model and the name of the attribute "customer.orders.items.price" => [Item, "price"] | def find_column_and_table(path, base)
if path.length > 1
find_column_and_table(path[1..-1], base.reflect_on_association(path.first.to_sym).class_name.constantize)
else
[base.columns_hash[path.first.to_s], base]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attribute_from_path(obj, attribute_path, default=nil)\n for attr in attribute_path.split(\".\") do\n case obj\n when Hash\n obj = !obj[attr.to_sym].nil? ? obj[attr.to_sym] : obj[attr]\n else\n obj = obj.send(attr)\n end\n return default if obj.nil?\... | [
"0.61222863",
"0.5452604",
"0.5372779",
"0.5372779",
"0.5355326",
"0.53462034",
"0.53348035",
"0.52382445",
"0.5237615",
"0.5237615",
"0.5237615",
"0.5237615",
"0.5237615",
"0.5237615",
"0.5237615",
"0.5237615",
"0.5237615",
"0.5237615",
"0.5237615",
"0.5237615",
"0.5229279",... | 0.4894294 | 32 |
Actualiza el stock del producto en Centry, solo si el ultimo stock informado desde Centry es distinto al stock registrado en la base de datos local, actualiza en la base de datos local el ultimo stock registrado en Centry. | def perform
update_null = " or (stock is null and last_stock_reported_centry is not null)"
query = "stock <> last_stock_reported_centry or ((stock is not null and last_stock_reported_centry is null)#{update_null if ENV["UPDATE_NULL_STOCK"] == "false"})"
::Product.where(query).each do |local_product|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_stock\n operador = self.notas_creditos_debito.tipo == 'DevolucionCompra' ? -1 : 1\n if deleted?\n MercaderiaExtracto.eliminar_movimiento(self, self.notas_creditos_debito.fecha, cantidad * operador*-1)\n else\n MercaderiaExtracto.crear_o_actualizar_extracto(self, self.notas_creditos_deb... | [
"0.7154984",
"0.6980439",
"0.6709226",
"0.65402496",
"0.64754343",
"0.6443735",
"0.64150137",
"0.63391775",
"0.6336346",
"0.632547",
"0.631832",
"0.63140774",
"0.6206585",
"0.61822164",
"0.6174356",
"0.6128779",
"0.61278486",
"0.6125624",
"0.6079166",
"0.6070695",
"0.60635096... | 0.73696476 | 0 |
TODO: Take this out to a superclass or module to include in each "listable" model | def type
self.class.name.downcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n ... | [
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064",
"0.71821064"... | 0.0 | -1 |
Override in subclass if not using fill | def fill_setup(gc)
if @obj.fill
gc.set_background @obj.fill
gc.set_alpha @obj.fill_alpha
true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill\n \t@fill\n end",
"def fillarc(*)\n super\n end",
"def fill\n return @fill\n end",
"def fillrect(*)\n super\n end",
"def setfillstyle(*)\n super\n end",
"def fill?\n self.class.instance_methods.include?(:fill)\n end",
"def setfill... | [
"0.7074521",
"0.676816",
"0.66439265",
"0.6473981",
"0.64402753",
"0.64153755",
"0.62186617",
"0.61635923",
"0.6130734",
"0.60612845",
"0.5988651",
"0.5983722",
"0.5944933",
"0.5943937",
"0.5943937",
"0.5737502",
"0.57324547",
"0.5663164",
"0.5655046",
"0.5655046",
"0.5570158... | 0.0 | -1 |
Override in subclass if not using draw | def draw_setup(gc)
if @obj.stroke and @obj.strokewidth > 0
gc.set_foreground @obj.stroke
gc.set_alpha @obj.stroke_alpha
gc.set_line_width @obj.strokewidth
true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw n\n raise NotImplementedError, \"Subclass Responsibility\"\n end",
"def draw\n raise \"Not implemented\"\n end",
"def draw; end",
"def draw; end",
"def drawrect(*)\n super\n end",
"def draw renderer\n raise NotImplementedError\n end",
"def draw\n end",
"def draw\... | [
"0.79461604",
"0.78739536",
"0.7389341",
"0.7389341",
"0.7355029",
"0.7335041",
"0.71778834",
"0.71778834",
"0.71778834",
"0.7101167",
"0.7098598",
"0.7077523",
"0.7077523",
"0.7077523",
"0.7077523",
"0.70710707",
"0.70444494",
"0.7018734",
"0.6887791",
"0.6798962",
"0.676379... | 0.0 | -1 |
Attach a cloud volume as a queued task and return the task id. The queue name and the queue zone are derived from the server EMS, and both a userid and server EMS ref are mandatory. The device is optional. | def attach_volume_queue(userid, server_ems_ref, device = nil)
task_opts = {
:action => "attaching Cloud Volume for user #{userid}",
:userid => userid
}
queue_opts = {
:class_name => self.class.name,
:method_name => 'attach_volume',
:instance_id => id,
:role => 'e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detach_volume_queue(userid, server_ems_ref)\n task_opts = {\n :action => \"detaching Cloud Volume for user #{userid}\",\n :userid => userid\n }\n\n queue_opts = {\n :class_name => self.class.name,\n :method_name => 'detach_volume',\n :instance_id => id,\n :role =>... | [
"0.5628949",
"0.5542675",
"0.54921496",
"0.5417826",
"0.5396541",
"0.5372547",
"0.5341046",
"0.5318854",
"0.5307342",
"0.527511",
"0.5251107",
"0.52381647",
"0.5198219",
"0.5153831",
"0.5140874",
"0.51047176",
"0.50869596",
"0.5080278",
"0.50787145",
"0.5045837",
"0.5042891",... | 0.7495005 | 0 |
Detach a cloud volume as a queued task and return the task id. The queue name and the queue zone are derived from the server EMS, and both a userid and server EMS ref are mandatory. | def detach_volume_queue(userid, server_ems_ref)
task_opts = {
:action => "detaching Cloud Volume for user #{userid}",
:userid => userid
}
queue_opts = {
:class_name => self.class.name,
:method_name => 'detach_volume',
:instance_id => id,
:role => 'ems_operations'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attach_volume_queue(userid, server_ems_ref, device = nil)\n task_opts = {\n :action => \"attaching Cloud Volume for user #{userid}\",\n :userid => userid\n }\n\n queue_opts = {\n :class_name => self.class.name,\n :method_name => 'attach_volume',\n :instance_id => id,\n :... | [
"0.56000805",
"0.5480162",
"0.5453223",
"0.5452035",
"0.5387396",
"0.5346979",
"0.5299283",
"0.5272674",
"0.5244431",
"0.5239221",
"0.52372015",
"0.51452214",
"0.51253456",
"0.5116276",
"0.5098688",
"0.5091043",
"0.50749356",
"0.5053758",
"0.5034472",
"0.5020728",
"0.5012485"... | 0.76429456 | 0 |
Execute a shell command, with optional environment. stdout and stderr will be sent to the logger if the command exits with nonzero status. | def shlog(cmd, env={}, dir=nil)
# logger.info("Executing: [#{cmd.gsub(/\s{2,}/, ' ')}]")
logger.info("Executing: [#{cmd.gsub(/--password \w+/, '--password ******')}]")
output = ''
stderror = ''
status = systemu("#{cmd}", :stdout => output, :stderr => stderror, :env => env, :cwd => dir)
if status.exitsta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shell_execute(command)\n require 'open3'\n stdout, stderr, status = Open3.capture3(command.chomp)\n if status.success? && status.exitstatus.zero?\n stdout\n else\n msg = \"Shell command failed: [#{command}] caused by <STDERR = #{stderr}>\"\n msg << \" STDOUT = #{stdout}... | [
"0.71727675",
"0.692452",
"0.69080657",
"0.67709404",
"0.67275",
"0.67230946",
"0.66964155",
"0.66186315",
"0.6603507",
"0.65912724",
"0.65658784",
"0.65641344",
"0.648016",
"0.6468877",
"0.64519227",
"0.64421976",
"0.6416667",
"0.6396861",
"0.6366453",
"0.6355647",
"0.633533... | 0.6489919 | 12 |
direct logger to stdout | def logger
logger = Logger.new(STDOUT)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_to_stdout\n log_to STDOUT\n end",
"def logger_output; end",
"def log(*args)\n @out.puts(*args)\n end",
"def log_write(msg)\n puts msg\n end",
"def log_stdout(type: :info, message:)\n $stdout.puts log_entry(type, message)\n end",
"def log(message)\n STDOUT.p... | [
"0.80161893",
"0.7292288",
"0.71509564",
"0.707181",
"0.7047905",
"0.6952505",
"0.68731165",
"0.683907",
"0.678693",
"0.6747715",
"0.6739387",
"0.6736448",
"0.66818565",
"0.6680204",
"0.6677072",
"0.6677072",
"0.6677072",
"0.6677072",
"0.6677072",
"0.66723955",
"0.6670315",
... | 0.6836449 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.