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 |
|---|---|---|---|---|---|---|
Indicate whether this record is involved in a workflow step related to transmission to a member repository. | def being_submitted?(item = nil)
# noinspection RubyMismatchedArgumentType
super(item || self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_be_performed?\n self.research_billing_qty > 0\n end",
"def member?\n client.organization_member? org_id, github_user.login\n end",
"def push_to_epic_in_progress?\n %w(started sent_study).include? last_epic_push_status\n end",
"def payment_in_progress?\n\t\t\t\t\treturn !self.payment_id... | [
"0.60269934",
"0.5876646",
"0.583215",
"0.5796695",
"0.57946706",
"0.57756263",
"0.5743756",
"0.5726452",
"0.5714767",
"0.5714007",
"0.56414896",
"0.5607376",
"0.5590098",
"0.5579154",
"0.5577505",
"0.55734897",
"0.5565157",
"0.5551927",
"0.5551502",
"0.5545696",
"0.55435544"... | 0.0 | -1 |
Indicate whether this record is involved in a workflow step related to ingest into the EMMA Unified Index. | def being_indexed?(item = nil)
# noinspection RubyMismatchedArgumentType
super(item || self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embedded_workflow(field)\n field == AUTOMATION_TYPES[:workflow][:key]\n end",
"def supports_step?(step)\n if Maadi::Procedure::Step.is_step?( step )\n return %w(ENQUEUE DEQUEUE SIZE ATINDEX NULCONSTRUCT NONNULCONSTRUCT DETAILS PEEK FRONT BACK).include?( step.id )\n end\n\n ... | [
"0.5827662",
"0.5817973",
"0.5790007",
"0.57878095",
"0.57665795",
"0.57605106",
"0.5713166",
"0.5656291",
"0.5633928",
"0.5631065",
"0.5538834",
"0.5534686",
"0.55329186",
"0.54965264",
"0.54762733",
"0.54530025",
"0.5410095",
"0.5398691",
"0.5372843",
"0.53723836",
"0.53204... | 0.0 | -1 |
Indicate whether this record is involved in a workflow step related to ingest into the EMMA Unified Index. | def completed?(item = nil)
# noinspection RubyMismatchedArgumentType
super(item || self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embedded_workflow(field)\n field == AUTOMATION_TYPES[:workflow][:key]\n end",
"def supports_step?(step)\n if Maadi::Procedure::Step.is_step?( step )\n return %w(ENQUEUE DEQUEUE SIZE ATINDEX NULCONSTRUCT NONNULCONSTRUCT DETAILS PEEK FRONT BACK).include?( step.id )\n end\n\n ... | [
"0.5825774",
"0.58197343",
"0.5791107",
"0.5789122",
"0.576787",
"0.5761824",
"0.5712728",
"0.56567454",
"0.56348205",
"0.5632879",
"0.5538317",
"0.5535392",
"0.5534591",
"0.5496279",
"0.5476046",
"0.5455109",
"0.5409201",
"0.5398243",
"0.5374427",
"0.53740185",
"0.5321545",
... | 0.0 | -1 |
Indicate whether this record is involved in a workflow step which leads to a change in the associated EMMA Unified Index entry. | def in_process?(item = nil)
# noinspection RubyMismatchedArgumentType
super(item || self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changed?\n self.event_state.include? :changed\n end",
"def change_detail_set?\n self.change_detail\n end",
"def changed_to_manual_check?\n @participant_eligibility.manual_check_status? && ((@previous_status != \"manual_check\") || @new_eligibility_record)\n end",
"def changed?\n !!@pre... | [
"0.5916809",
"0.586544",
"0.586254",
"0.58358145",
"0.58322906",
"0.57918686",
"0.57481825",
"0.5738216",
"0.57357836",
"0.5707181",
"0.5680998",
"0.56685746",
"0.56676406",
"0.5661264",
"0.56133205",
"0.56089455",
"0.5593516",
"0.558596",
"0.55834067",
"0.55834067",
"0.55820... | 0.0 | -1 |
Indicate whether this record is involved in a workflow step where nonadministrative data (EMMA or file data) could be changed. | def unsealed?(item = nil)
# noinspection RubyMismatchedArgumentType
super(item || self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info_only\n if @type == RECORD\n @changed_records.all? { |r| r.type == RecordChange::IGNORED }\n else\n false\n end\n end",
"def can_modify\n\t\tself.changed_attributes.each do |attr|\n\n\t\t\tif attr.to_s == \"reports\"\n\t\t\t\tself.reports.each do |r|\n\t\t\t\t\... | [
"0.6380736",
"0.62730044",
"0.6119389",
"0.60992485",
"0.6073627",
"0.60585785",
"0.60317224",
"0.5988958",
"0.5967438",
"0.59032315",
"0.59023213",
"0.5859806",
"0.584117",
"0.58264637",
"0.5812641",
"0.57753146",
"0.5770743",
"0.5764145",
"0.5759696",
"0.5755832",
"0.574819... | 0.0 | -1 |
Return the class from app/jobs associated with the record class. | def job_class(item = nil)
# noinspection RubyMismatchedArgumentType
item and super or @job_class ||= super(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_class\n return if job_class_name.nil?\n job_class_name.constantize\n rescue NameError\n nil\n end",
"def job_class\n discrete? ? attributes['job_class'] : serialized_params['job_class']\n end",
"def application_job_class\n @application_job_class ||= self.class.ancest... | [
"0.80346054",
"0.75374675",
"0.7487816",
"0.7334007",
"0.7330949",
"0.7058623",
"0.69347084",
"0.69141716",
"0.6890386",
"0.68632156",
"0.68429816",
"0.68340504",
"0.6821356",
"0.66699386",
"0.6555719",
"0.6555719",
"0.6555719",
"0.65535855",
"0.6543842",
"0.6430811",
"0.6399... | 0.68344337 | 11 |
Get the next legal state(s). If "emma.state_table.[...].next" is false, nil or missing, the result is an empty array (indicating a terminal state). | def transitions(curr_state = nil, **)
curr_state = state_value(curr_state)
next_states = state_table.dig(curr_state, :next)
Array.wrap(next_states).compact_blank
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_state\n STATE_SIZE.times do |i|\n mix = @state[i] & 0x80000000 | @state[i+1 - STATE_SIZE] & 0x7fffffff\n @state[i] = @state[i+OFFSET - STATE_SIZE] ^ (mix >> 1)\n @state[i] ^= 0x9908b0df if mix.odd?\n end\n @last_read = -1\n end",
"def next_state(curr_... | [
"0.6258318",
"0.620533",
"0.61592627",
"0.6132604",
"0.60734963",
"0.59942895",
"0.5987397",
"0.58685297",
"0.5801302",
"0.57265407",
"0.5695783",
"0.5682755",
"0.56667256",
"0.565819",
"0.5601697",
"0.5599843",
"0.5565042",
"0.5549164",
"0.5536085",
"0.5525379",
"0.5525379",... | 0.63339007 | 0 |
Get the next legal state. | def next_state(curr_state = nil, **)
transitions(curr_state).first.presence
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_state\n STATE_SIZE.times do |i|\n mix = @state[i] & 0x80000000 | @state[i+1 - STATE_SIZE] & 0x7fffffff\n @state[i] = @state[i+OFFSET - STATE_SIZE] ^ (mix >> 1)\n @state[i] ^= 0x9908b0df if mix.odd?\n end\n @last_read = -1\n end",
"def next_state(name)... | [
"0.725607",
"0.6838979",
"0.67504334",
"0.655805",
"0.654231",
"0.65297747",
"0.6511565",
"0.64660233",
"0.6448985",
"0.63525397",
"0.62666035",
"0.62538904",
"0.6253644",
"0.6227243",
"0.6181804",
"0.6170161",
"0.616383",
"0.616383",
"0.60843486",
"0.60380286",
"0.59814996",... | 0.67251647 | 3 |
Indicate whether the value represents a terminal state. | def final_state?(curr_state = nil, **)
next_state(curr_state).blank?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def terminal_state?\n self.class.terminal_states.include?(@state)\n end",
"def terminal?\n terminal_flag\n end",
"def terminal?\n !!terminal\n end",
"def terminal?\n !!terminal\n end",
"def terminal?\n kind == :terminal\n end",
"def terminal?\n ... | [
"0.7993087",
"0.78036237",
"0.76342297",
"0.76342297",
"0.7603995",
"0.7592984",
"0.74381655",
"0.74381655",
"0.74248904",
"0.72899336",
"0.722593",
"0.72169036",
"0.69918114",
"0.69918114",
"0.65493584",
"0.648101",
"0.648101",
"0.63907075",
"0.6292932",
"0.62571025",
"0.616... | 0.0 | -1 |
helper methods, instance calls class methods for ease of use. They are one line because they should generally be ignored, since they do not handle any logic themselves. | def logWatch(name, data={}, &blk); return MootLogs.logWatch(name, data, &blk); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def custom; end",
"def custom; end",
"def private; end",
"def wrapper; end",
"def method_one; end",
"def method; end",
"def method; end",
"def method... | [
"0.6033193",
"0.6033193",
"0.6033193",
"0.6033193",
"0.6033193",
"0.6033193",
"0.6033193",
"0.6033193",
"0.5888774",
"0.5888774",
"0.5872564",
"0.5826495",
"0.58137465",
"0.57966715",
"0.57966715",
"0.57966715",
"0.57966715",
"0.57966715",
"0.57966715",
"0.57966715",
"0.57966... | 0.0 | -1 |
Declares an client instance. | def initialize(client)
@client = client
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_client\n @client = Client.find(current_user.client_id)\n end",
"def client\n @client ||= Client.new\n end",
"def set_client\n @client = Client.find(current_user.client_id)\n end",
"def set_client\n @client = ::Client.find(params[:id])\n end",
"def client\n puts ... | [
"0.70845103",
"0.7019603",
"0.6892988",
"0.689232",
"0.68220127",
"0.6737525",
"0.6737525",
"0.6713279",
"0.6705689",
"0.66985923",
"0.66985923",
"0.6691081",
"0.668062",
"0.6680454",
"0.6680454",
"0.6680454",
"0.6658828",
"0.664541",
"0.66444176",
"0.66375726",
"0.66287863",... | 0.6612961 | 100 |
Login a user for a new session /api/v1/auth/login ==== Attributes +username+ (required) A valid username (String) +password+ (required) A valid password (String) +device_id+ (required) Device ID (String) +push_token+ Push token (String) | def login(username, password, device_id, push_token = '')
values = {
username: username,
password: password,
device_id: device_id,
push_token: push_token
}
@client.make_request :post, auth_path('login'), values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n client.login(\n params[:user],\n params[:password],\n authParams: {\n scope: 'openid name email'\n },\n connection: 'Username-Password-Authentication'\n )\n end",
"def login\n debug 'Trying to login'\n _response = self.signed_request '/api/v1/login', 'POST... | [
"0.74996316",
"0.74854213",
"0.73431325",
"0.73130804",
"0.7243558",
"0.7192074",
"0.7083733",
"0.70569676",
"0.70533067",
"0.70533067",
"0.7046075",
"0.7042162",
"0.703709",
"0.7032128",
"0.70284855",
"0.69956726",
"0.6983903",
"0.69800705",
"0.6971913",
"0.6955941",
"0.6953... | 0.85716814 | 0 |
Login a user for a new session using token and secret. Endpoint for third party clients. /api/v1/auth/login_token ==== Attributes +token+ (required) A user token (String) +secret+ (required) A user secret (String) ==== Examples client.auth.login_with_token('token', 'secret') | def login_with_token(token, secret)
values = {
token: token,
secret: secret
}
@client.make_request :post,
auth_path('login_token'),
values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n user = User.find_by(username: params[:user][:username])\n # authenticate method from has_secure_password in user model\n if user && user.authenticate(params[:user][:password])\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n e... | [
"0.71462226",
"0.7093328",
"0.70675385",
"0.70675385",
"0.70450014",
"0.6939444",
"0.6938673",
"0.6867384",
"0.6794184",
"0.6790938",
"0.67138815",
"0.66847086",
"0.6675862",
"0.66715544",
"0.6609285",
"0.65791637",
"0.6545033",
"0.6510218",
"0.6495966",
"0.6484607",
"0.64723... | 0.83709806 | 0 |
Logout a user session /api/v1/auth/logout ==== Examples client.auth.logout | def logout
@client.make_request :post,
auth_path('logout')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logout\n HttpWrapper.post(\n url: \"#{::Coyodlee.base_url}/user/logout\"\n )\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n # reset auth key to nil\n @auth_... | [
"0.8418662",
"0.81685114",
"0.8143042",
"0.80800813",
"0.8068057",
"0.80643696",
"0.80470884",
"0.8036657",
"0.80232525",
"0.8013624",
"0.80005765",
"0.79896206",
"0.7909709",
"0.79068893",
"0.7887571",
"0.78685135",
"0.78685135",
"0.78021514",
"0.7785652",
"0.77731365",
"0.7... | 0.84311646 | 0 |
Logout a user session by device id only /api/v1/auth/logout_device ==== Attributes +device_id+ (required) Device ID (String) | def logout_device(device_id)
values = {
device_id: device_id
}
@client.make_request :post,
auth_path('logout_device'),
values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logout\n payload = delete_session(params[:user_id], params[:session_token], params[:csrf_token])\n if payload == :SESSION_DELETED\n notify_session(\"SESSION_END_NOTICE\", {reason: \"LOGOUT\"}, params[:session_token])\n render status: 200, json: {error: false}\n elsif ... | [
"0.73393244",
"0.72954905",
"0.7245259",
"0.72362214",
"0.7230493",
"0.7220199",
"0.7214888",
"0.7201316",
"0.71871454",
"0.7144895",
"0.7144895",
"0.71425354",
"0.71425354",
"0.71138537",
"0.7065046",
"0.705101",
"0.70470345",
"0.7044669",
"0.7018928",
"0.69745725",
"0.69735... | 0.9059286 | 0 |
Request a new password, given a user name or email address /api/v1/auth/request_new_password ==== Attributes +name+ (required) A valid user name or email address (String) ==== Examples client.auth.request_new_password('John') | def request_new_password(name)
values = {
name: name
}
@client.make_request :post,
auth_path('request_new_password'),
values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_new_password\n pass = generate_password\n set_password(pass)\n pass\n end",
"def new_password(user, new_password)\n setup_email(user)\n @subject += 'This is your new password'\n @body[:url] = \"http://#{get_domain_name}/login\" \n @body[:new_password] = new_password\n end",
... | [
"0.67875797",
"0.6645142",
"0.6472687",
"0.6471071",
"0.6253265",
"0.6249369",
"0.61111903",
"0.60953724",
"0.6082117",
"0.6064208",
"0.5996979",
"0.5963883",
"0.59583086",
"0.5917956",
"0.59037876",
"0.587287",
"0.5872193",
"0.58476305",
"0.584749",
"0.5845756",
"0.58416027"... | 0.8757145 | 0 |
Login by PIN and Device ID /api/v1/auth/login_pin ==== Attributes +pin+ (required) PIN code (String) +device_id+ (required) Device ID (String) +push_token+ (required) Push Token (String) | def login_by(pin, device_id, push_token)
values = {
pin: pin,
device_id: device_id,
push_token: push_token
}
@client.make_request :post,
auth_path('login_pin'),
values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_with_pin(partner_id, pin, udid=KalturaNotImplemented, secret=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'partnerId', partner_id)\n\t\t\tclient.add_param(kparams, 'pin', pin)\n\t\t\tclient.add_param(kparams, 'udid', udid)\n\t\t\tclient.add_param(kparams, 'secret', secret)\... | [
"0.6890939",
"0.6648367",
"0.6598764",
"0.6212219",
"0.60114175",
"0.6008993",
"0.5988264",
"0.5957295",
"0.59546316",
"0.59536177",
"0.5861338",
"0.5827177",
"0.576302",
"0.57524526",
"0.56961274",
"0.56302166",
"0.562242",
"0.56200784",
"0.5614429",
"0.56042",
"0.5596598",
... | 0.89085823 | 0 |
Set user pin /api/v1/auth/pin ==== Attributes +pin+ (required) PIN code (String) | def update_user_pin(pin)
values = {
pin: pin
}
@client.make_request :post,
auth_path('pin'),
values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pin=(pin)\n if pin.match(/\\d{4}/)\n self.pin_salt = Digest::SHA1.hexdigest([Time.now, rand].join)\n self.pin_hash = encrypt_pin(pin)\n end\n end",
"def set_pin\n\t @pin = current_user.pins.find(params[:id])\n\tend",
"def pin\n password = $pin\n end",
"def set_pin ... | [
"0.7808459",
"0.7729108",
"0.76883274",
"0.7666806",
"0.7656168",
"0.75971603",
"0.75971603",
"0.75971603",
"0.75971603",
"0.75971603",
"0.75971603",
"0.75971603",
"0.75971603",
"0.75971603",
"0.75971603",
"0.7477107",
"0.7459572",
"0.74284506",
"0.7377318",
"0.7362057",
"0.7... | 0.88739294 | 0 |
Get token (Refresh token) /api/v1/auth/token ==== Attributes +pin+ (required) PIN code (String) +device_id+ (required) Device ID (String) | def refresh_token(pin, device_id)
values = {
pin: pin,
device_id: device_id
}
@client.make_request :post,
auth_path('token'),
values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_token(params = {}, opts = {})\n hash = build_request(params)\n @client.get_token(hash, opts.merge('refresh_token' => nil))\n end",
"def get_token\n get(TOKEN_URL)\n end",
"def refresh_token(code=nil)\n body = {}\n body[:code] = code unless code.nil?\n\n ... | [
"0.7108373",
"0.6969975",
"0.69670916",
"0.69582343",
"0.6826249",
"0.678745",
"0.6783509",
"0.67447937",
"0.6712393",
"0.66973",
"0.6628646",
"0.65956295",
"0.6587173",
"0.6577133",
"0.65365577",
"0.65354115",
"0.6518081",
"0.65014595",
"0.6475271",
"0.64540774",
"0.6446251"... | 0.8205419 | 0 |
Process one time login link and return the pass_reset /api/v1/auth/user_pass_reset ==== Attributes +uid+ (required) The uid of the user in the operation. (Number) +timestamp+ (required) The timestamp value from the reset password link. (Number) +hashed_pass+ (required) The hashed pass value from the reset password link... | def pass_reset_token(uid, timestamp, hashed_pass)
values = {
uid: uid,
timestamp: timestamp,
hashed_pass: hashed_pass
}
@client.make_request :post,
auth_path('user_pass_reset'),
values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_pass\n username = params[:user][:account_name]\n email = params[:user][:email]\n resp = LinkedData::Client::HTTP.post(\"/users/create_reset_password_token\", {username: username, email: email})\n\n if resp.nil?\n redirect_to login_index_path, notice: \"Please check your email for a messag... | [
"0.6348124",
"0.6337644",
"0.63076574",
"0.63067144",
"0.6280153",
"0.619927",
"0.61968863",
"0.6190365",
"0.61768925",
"0.61584246",
"0.61495835",
"0.6137173",
"0.61362606",
"0.61362606",
"0.61362606",
"0.61362606",
"0.61362606",
"0.61362606",
"0.61362606",
"0.61166626",
"0.... | 0.7774914 | 0 |
Set push token api/v1/auth/push_token ==== Attributes +token+ (required) Push token (String) +os_type+ (required) OS type (String) | def update_push_token(token, os_type)
values = {
token: token,
os: os_type
}
@client.make_request :post,
auth_path('push_token'),
values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_device_push_token(push_token)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'pushToken', push_token)\n\t\t\tclient.queue_service_action_call('notification', 'setDevicePushToken', 'bool', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\te... | [
"0.7087585",
"0.65148747",
"0.6409435",
"0.6216822",
"0.60378784",
"0.60378784",
"0.6028221",
"0.6015392",
"0.5748653",
"0.5697865",
"0.56744593",
"0.565864",
"0.5527865",
"0.55184364",
"0.5481734",
"0.54593337",
"0.5425067",
"0.5410622",
"0.53721356",
"0.53721327",
"0.532332... | 0.8739277 | 0 |
Password reset /api/v1/auth/uid/password_reset ==== Attributes +uid+ (required) The id of the user (Number) | def reset_password(uid)
values = {
uid: uid
}
@client.make_request :post,
auth_path("#{uid}/password_reset"),
values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_reset\n user = User.first\n user.reset_token = SecureRandom.uuid\n user.e_token = User.digest(user.email)\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.create_reset_digest\n UserMailer.password_reset(user.id, user.reset_token)\n end",... | [
"0.74820447",
"0.74351287",
"0.7424368",
"0.74072176",
"0.7387463",
"0.73766965",
"0.7347118",
"0.7313671",
"0.73132",
"0.73132",
"0.73132",
"0.73132",
"0.73132",
"0.73132",
"0.73132",
"0.7288375",
"0.7280318",
"0.7244431",
"0.7225455",
"0.7225455",
"0.71989375",
"0.7154961... | 0.8880879 | 0 |
What questions did this user write? | def authored_questions
Question.find_by_author_id(@id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def questions\n \n end",
"def ask\n \"@all Question '#{@question}'\"\n end",
"def questions_explanation\n puts \"Time to do the quiz!.\"\n puts \"\"\n puts \"Each question will be printed to the screen.\"\n puts \"Once you see it, simply type in your answer and hit the enter/return key.\"\n... | [
"0.6817331",
"0.67921895",
"0.667864",
"0.64680725",
"0.64680725",
"0.64495903",
"0.64016557",
"0.64010113",
"0.6363979",
"0.63141114",
"0.63123095",
"0.63081056",
"0.62627476",
"0.61815846",
"0.61012006",
"0.60736626",
"0.6062516",
"0.6061069",
"0.6051348",
"0.6048049",
"0.6... | 0.563755 | 57 |
What replies did this user write? | def authored_replies
Replies.find_by_user_id(@id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authored_replies\n Reply.find_by_user_id(self.id)\n end",
"def replies\n Reply.find_by_question_id(@id)\n end",
"def replies\n Reply.find_by_question_id(self.id)\n end",
"def replies\n @user = User.find(params[:id])\n end",
"def replies\n messages.joins(:reply_relationships).distin... | [
"0.6851875",
"0.6714269",
"0.66351634",
"0.64403397",
"0.64283705",
"0.63533676",
"0.62486774",
"0.62467355",
"0.6185735",
"0.61752635",
"0.6117736",
"0.6117736",
"0.6111851",
"0.60427004",
"0.60323864",
"0.60244834",
"0.5964398",
"0.5964398",
"0.5934978",
"0.5929221",
"0.592... | 0.6850218 | 1 |
What questions does this user follow? | def followed_questions
QuestionFollower.followed_questions_for_user_id(@id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform(user, questions)\n \n end",
"def show_user_questions\n\t\tif logged_in?\n\t\t\t@user_questions = @current_user.question\n\t\tend\n\tend",
"def ask\n \"@all Question '#{@question}'\"\n end",
"def questions\n \n end",
"def answered_questionnaire?(user)\n answered_users.include?(use... | [
"0.6543128",
"0.64988464",
"0.6304269",
"0.62948376",
"0.6280744",
"0.6184424",
"0.614753",
"0.6123284",
"0.6052021",
"0.6044057",
"0.6029134",
"0.60266334",
"0.6017261",
"0.60150254",
"0.601393",
"0.6010703",
"0.60027224",
"0.5960309",
"0.59401745",
"0.5936938",
"0.59235483"... | 0.6708322 | 0 |
Avg number of likes for a user's questions | def average_karma
average = QuestionsDatabase.instance.execute(<<-SQL,@id,@id)
SELECT (CASE
WHEN numquestions.questions = 0
THEN NULL
ELSE
numlikes.likes/numquestions.questions
END) avg
FROM
( SELECT COUNT(*) likes
FROM ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_karma\n my_questions = QuestionsDatabase.instance.execute(<<-SQL)\n SELECT DISTINCT\n (CAST(COUNT(question_likes.id) AS FLOAT) / COUNT(DISTINCT(questions.id))) AS average_likes\n FROM\n questions\n LEFT OUTER JOIN\n question_likes ON question_likes.questions_id = ... | [
"0.7772521",
"0.7746009",
"0.7723189",
"0.72161895",
"0.7161898",
"0.7082075",
"0.687791",
"0.6833083",
"0.6798241",
"0.6798241",
"0.6784559",
"0.67442983",
"0.6718085",
"0.66994065",
"0.6663071",
"0.6591681",
"0.6587408",
"0.65561485",
"0.6497656",
"0.6494159",
"0.6489779",
... | 0.756034 | 3 |
for libraries that implicitly need current user | def current_user
current_customer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_user\n end",
"def current_user\n@current_user ||= (login_from_session || login_from_basic_auth || login_from_cookie) unless @current_user == false\nend",
"def so_user; @_so_user ||= path_to_class('test/platform/sz/so_user'); end",
"def current_cephuser\n raise NotImplementedError\n e... | [
"0.6298188",
"0.6248046",
"0.62362206",
"0.62074816",
"0.62057775",
"0.62057775",
"0.6196723",
"0.6195969",
"0.6155802",
"0.61405444",
"0.61252904",
"0.6122266",
"0.61196995",
"0.6100196",
"0.6098006",
"0.60965437",
"0.6073491",
"0.6068762",
"0.60479784",
"0.60478306",
"0.604... | 0.0 | -1 |
format phone numbers remove any nondigit characters | def phone_number=(value)
super(value.blank? ? nil : value.gsub(/[^\d]/, ''))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reformat_phone\n phone = self.phone.to_s \n phone.gsub!(/[^0-9]/,\"\") \n self.phone = phone \n end",
"def reformat_phone\n phone = self.phone.to_s # change to string in case input as all numbers \n phone.gsub!(/[^0-9]/,\"\") # strip all non-digits\n self.phone =... | [
"0.83707404",
"0.81517076",
"0.81257117",
"0.81257117",
"0.81257117",
"0.81257117",
"0.8125147",
"0.8117867",
"0.8117553",
"0.8081162",
"0.8075382",
"0.8075382",
"0.8075382",
"0.8075382",
"0.80262446",
"0.7950543",
"0.7913698",
"0.79126453",
"0.7910023",
"0.79075783",
"0.7870... | 0.70271575 | 84 |
1 2 3 4 5 6 7 | def invert_tree root
temp_pointer = root.left
root.left = root.right
root.right = temp_pointer
invert_tree(root.left) if root.left
invert_tree(root.right) if root.right
root
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def given\n [6,5,3,1,8,7,2,3]\nend",
"def left_numbers\n numbers[1,6]\n end",
"def numbers(n)\n\nend",
"def range(arr)\n\nend",
"def seventh_puzzle\n ret = []\n 10.times { ret.push(sixth_puzzle) }\n return ret\nend",
"def many_results(n)\r\n\treturn 1, n /2, n\r\nend",
"def sequence4(... | [
"0.6757743",
"0.6038244",
"0.59505713",
"0.5944317",
"0.59117615",
"0.5906716",
"0.58974415",
"0.58476514",
"0.5829733",
"0.5820295",
"0.5819633",
"0.58154124",
"0.58016634",
"0.57477087",
"0.5745541",
"0.5741014",
"0.5732786",
"0.57274264",
"0.5713361",
"0.57104343",
"0.5709... | 0.0 | -1 |
returns a number with its digits reversed zeros get dropped if they trail other digits eg. 12000 => 21 | def reversed_number(number)
number.to_s.reverse.to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reversed_number(number)\n reversed = []\n leading = true\n\n number.digits.each do |digit|\n unless leading && digit == 0\n leading = false\n reversed.push(digit)\n end\n end\n\n reversed.join.to_i\nend",
"def reversed_number(integer)\n p integer.digits.join.to_i # .to_i automatically o... | [
"0.8200561",
"0.8142786",
"0.78731924",
"0.7760503",
"0.7717821",
"0.77116305",
"0.7702589",
"0.75467193",
"0.7531664",
"0.7527711",
"0.75176096",
"0.7484274",
"0.7472908",
"0.745302",
"0.7437387",
"0.7360535",
"0.73554796",
"0.7353451",
"0.72847307",
"0.72832423",
"0.7280867... | 0.7426832 | 17 |
override this method to define permitted keys | def permitted_params
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permitted_keys\n @permitted_keys ||= properties.map(&:to_sym)\n end",
"def permitted_keys\n self.class.instance_variable_get(:@permitted_keys) || []\n end",
"def allow_keys(keys)\n @allow_keys = keys\n end",
"def key_params\n params.require(:key).permit(:name, :value)\n... | [
"0.7697187",
"0.74535966",
"0.70901984",
"0.6848846",
"0.68088096",
"0.6718958",
"0.6703022",
"0.65566015",
"0.65268856",
"0.6503042",
"0.64094615",
"0.63746166",
"0.6334476",
"0.63183045",
"0.6281498",
"0.62616646",
"0.62252593",
"0.62105376",
"0.6210206",
"0.6203151",
"0.61... | 0.600861 | 41 |
get every test to pass before coding runner below | def runner
welcome
card_sum = initial_round
until card_sum > 21
new_value = hit?(card_sum)
card_sum = new_value
display_card_total(card_sum)
end
end_game(card_sum)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do |plugin|\n result = @expectation.check(plugin, response, test_case)\n if no... | [
"0.7274132",
"0.7200911",
"0.71905994",
"0.7134598",
"0.7127439",
"0.70358455",
"0.6860759",
"0.68229115",
"0.68049264",
"0.6790065",
"0.6790065",
"0.6768047",
"0.65728307",
"0.65551996",
"0.65487796",
"0.65460235",
"0.65293026",
"0.64595217",
"0.6447049",
"0.6447049",
"0.644... | 0.0 | -1 |
A permutation is a sequence containing each element from 1 to N once, and only once. For example, array A such that: A[0] = 4 A[1] = 1 A[2] = 3 A[3] = 2 is a permutation, but array A such that: A[0] = 4 A[1] = 1 A[2] = 3 is not a permutation, because value 2 is missing. The goal is to check whether array A is a permuta... | def solution(array)
result = Array.new(array.length, 0)
array.each do |element|
if result[element - 1]
result[element - 1] += 1
else
result[element - 1] = 1
end
end
result.uniq.size == 1 ? 1 : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution(a)\n # write your code in Ruby 2.2\n permutation = Array(1..a.size)\n # puts permutation\n return 1 if permutation - a == []\n 0\nend",
"def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break... | [
"0.7668518",
"0.73590195",
"0.6920349",
"0.6719137",
"0.65788835",
"0.65404737",
"0.6538413",
"0.64942765",
"0.64459604",
"0.64377123",
"0.6370765",
"0.636409",
"0.635945",
"0.63501483",
"0.6323703",
"0.6286175",
"0.627474",
"0.62716895",
"0.626719",
"0.621907",
"0.621873",
... | 0.6248852 | 19 |
callseq: sym.capitalize > symbol Same as sym.to_s.capitalize.intern. | def capitalize
(self.to_s.capitalize! || self).to_sym
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capitalize!() end",
"def titleize_symbol symbol\n title = symbol.to_s.split('_')\n title.each { |word| word.capitalize! }.join(' ')\nend",
"def downcase\n (self.to_s.downcase! || self).to_sym\n end",
"def spy_name(real_name)\n capitalize(next_letter(swap(real_name)))\nend",
"def upcase\n (sel... | [
"0.7125186",
"0.7082268",
"0.70681983",
"0.705701",
"0.7018369",
"0.6978878",
"0.6972372",
"0.6901388",
"0.6896981",
"0.68742776",
"0.68526626",
"0.6835985",
"0.6769322",
"0.67686296",
"0.6723063",
"0.6672614",
"0.667025",
"0.6632161",
"0.66268253",
"0.66268253",
"0.66040885"... | 0.76337963 | 0 |
callseq: sym.downcase > symbol Same as sym.to_s.downcase.intern. | def downcase
(self.to_s.downcase! || self).to_sym
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symbolize(string)\n string.split.map(&:downcase).map(&:to_sym)\n end",
"def symbolize(s)\n s.to_s.gsub(/\\s+/,\"_\").gsub(/\\W+/,\"\").downcase.to_sym\n end",
"def conform_to_symbol(text_or_symbol)\n underscore(text_or_symbol.to_s).downcase.to_sym\n end",
"def symbolize(str)\n st... | [
"0.705239",
"0.7029235",
"0.6763837",
"0.6754364",
"0.673656",
"0.6645174",
"0.6618908",
"0.6553776",
"0.65437186",
"0.65034837",
"0.6496402",
"0.6494205",
"0.6462554",
"0.63978916",
"0.63754255",
"0.63647795",
"0.6363963",
"0.63634235",
"0.63442296",
"0.6319463",
"0.6304301"... | 0.7165238 | 0 |
callseq: sym.upcase > symbol Same as sym.to_s.upcase.intern. | def upcase
(self.to_s.upcase! || self).to_sym
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def downcase\n (self.to_s.downcase! || self).to_sym\n end",
"def upcase!() end",
"def upcase(input); end",
"def downcase!() end",
"def upcase() end",
"def bar(s)\n s.upcase\nend",
"def swapcase!() end",
"def downcase(input); end",
"def downcase() end",
"def symbolize(s)\n s.to_s.gsub(... | [
"0.6901897",
"0.6804858",
"0.66489893",
"0.6629327",
"0.65847707",
"0.6568887",
"0.6512585",
"0.650913",
"0.64829606",
"0.6474574",
"0.6445342",
"0.64214224",
"0.6418404",
"0.6412107",
"0.6389348",
"0.6380819",
"0.63772106",
"0.634919",
"0.6338562",
"0.6325943",
"0.631096",
... | 0.7544194 | 0 |
callseq: sym.casecmp(other) > 1, 0, +1 or nil Caseinsensitive version of Symbol. | def casecmp(other)
return nil unless other.kind_of?(Symbol)
lhs = self.to_s; lhs.upcase!
rhs = other.to_s.upcase
lhs <=> rhs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def casecmp?(sym)\n c = self.casecmp(sym)\n return nil if c.nil?\n return c == 0\n end",
"def ==(other)\n self.symbol == other.symbol \n end",
"def <=>(other)\n name.casecmp other.name\n end",
"def ==(other)\n case other\n when Symbol\n self.to_sym == conver... | [
"0.7855544",
"0.64678663",
"0.61806905",
"0.6092368",
"0.60515755",
"0.6014449",
"0.59703785",
"0.5872831",
"0.5842294",
"0.5833548",
"0.57723635",
"0.57543623",
"0.5693498",
"0.56887424",
"0.55953586",
"0.55953425",
"0.556945",
"0.5566934",
"0.5539055",
"0.55090314",
"0.5499... | 0.74387455 | 1 |
callseq: sym.casecmp?(other) > true, false, or nil Returns true if sym and other_sym are equal after case folding, false if they are not equal, and nil if other_sym is not a string. | def casecmp?(sym)
c = self.casecmp(sym)
return nil if c.nil?
return c == 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def casecmp(other)\n return nil unless other.kind_of?(Symbol)\n lhs = self.to_s; lhs.upcase!\n rhs = other.to_s.upcase\n lhs <=> rhs\n end",
"def react? a, b\n a != b && a.casecmp(b) == 0\nend",
"def str_cmp(str1, str2)\n return if !str1.is_a?(String) || !str2.is_a?(String)\n\n puts str1.d... | [
"0.74167514",
"0.6436457",
"0.6339587",
"0.6149453",
"0.6063849",
"0.5964449",
"0.5899604",
"0.577914",
"0.576663",
"0.57631814",
"0.57467645",
"0.5741156",
"0.5650083",
"0.5632857",
"0.5610757",
"0.55864304",
"0.55624545",
"0.55605793",
"0.55605793",
"0.55605793",
"0.5540573... | 0.8238863 | 0 |
callseq: sym.empty? > true or false Returns that _sym_ is :"" or not. | def empty?
self.length == 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty?() @symbols.empty? end",
"def is_symbol\n <<-CODE\n t1 = stack_pop();\n stack_push(SYMBOL_P(t1) ? Qtrue : Qfalse);\n CODE\n end",
"def valid_symbol?(symbol)\n return false if [].include?(symbol)\n true\n end",
"def only_symbols?(text)\n text.is_a?(String) && text.present? && ... | [
"0.75780797",
"0.6530473",
"0.64930713",
"0.6446048",
"0.6445243",
"0.64353704",
"0.6398763",
"0.63746387",
"0.6280215",
"0.62525576",
"0.6212632",
"0.62120223",
"0.6181901",
"0.61783314",
"0.61783314",
"0.61783314",
"0.6175083",
"0.6154315",
"0.61447185",
"0.6130975",
"0.610... | 0.0 | -1 |
The return value should be arranged in order from shortest to longest substring. INPUT string OUTPUT array of strings RULES return an array of substrings of a string return order should be shortest to longest ALGORITHM start from first character of a string add one more character each time a character is added, add the... | def substrings_at_start(string)
substrings = []
counter = 1
until counter > string.size
substrings << string[0, counter]
counter += 1
end
substrings
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def substrings(string)\n results = []\n (0...string.size).each do |start_index|\n this_substring = string[start_index..-1]\n results.concat(leading_substrings(this_substring))\n end\n results\nend",
"def substrings(string)\n results = []\n (0...string.size).each do |start_index|\n this_substring =... | [
"0.80466723",
"0.80466723",
"0.80466723",
"0.80242324",
"0.7962631",
"0.79215264",
"0.7861108",
"0.7841375",
"0.7838209",
"0.7825656",
"0.78120726",
"0.7801896",
"0.7735658",
"0.771769",
"0.7697405",
"0.7680363",
"0.7679551",
"0.76692736",
"0.7666499",
"0.76172835",
"0.761218... | 0.72487575 | 59 |
on custom validate its singular | def shorten
self.url_short = SecureRandom.hex(5)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validation; end",
"def validation; end",
"def validate\n \n \n end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validator; end",
"def validate!; end",
"def validate!; end",
"def validate!; end",
"def validated?; end",
"def subclass_valida... | [
"0.7094406",
"0.7094406",
"0.7091963",
"0.707483",
"0.707483",
"0.707483",
"0.707483",
"0.70629823",
"0.70261306",
"0.70261306",
"0.70261306",
"0.6976909",
"0.6947834",
"0.6932513",
"0.69324905",
"0.69071245",
"0.69071245",
"0.69071245",
"0.6905996",
"0.68685645",
"0.68419886... | 0.0 | -1 |
Defines methods to list buildings | def list_buildings
seperator; seperator
puts "Current buildings: "
seperator; seperator
$current_buildings.each { |building|
number = 1
print number
print ") "
puts building
number += 1
}
seperator
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_buildings\n \n end",
"def list_buildings(buildings)\n \tbuildings.each do |place|\n\t\tputs \"#{buildings.index(place)}: #{place}\"\n\tend\nend",
"def build_list(hero)\n\t\tbuilds = hero.builds\n\t\t#This Line is just to limit the initial amount of builds shown. Possibly implement a way to sea... | [
"0.771156",
"0.7215144",
"0.65859747",
"0.6468954",
"0.6467456",
"0.64413846",
"0.634697",
"0.630611",
"0.62609017",
"0.62609017",
"0.62609017",
"0.62056214",
"0.62056214",
"0.62056214",
"0.6174258",
"0.6174258",
"0.6174258",
"0.6174258",
"0.6174258",
"0.61597455",
"0.6157495... | 0.0 | -1 |
Behold my supersophisticated argument parser!!!1! | def print_help
puts "gem_dep_tree gemname [version]"
exit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_options=(_arg0); end",
"def parse_options=(_arg0); end",
"def normalize_args(string, options_hash); end",
"def parse_args\n\t\t@args = @args_a.each_slice(2).to_a.inject({}) { |h, k| h[k[0]] = k[1]; h }\n\t\tkeys = @skeys + @lkeys\n\t\t@args.each do |k, v|\n\t\t\tif !keys.include?(k)\n\t\t\t\tputs \... | [
"0.74376196",
"0.74376196",
"0.731624",
"0.72971344",
"0.7044649",
"0.70425206",
"0.6980271",
"0.69744045",
"0.6972744",
"0.69628793",
"0.6924329",
"0.6919858",
"0.6916672",
"0.69048816",
"0.6896129",
"0.68947285",
"0.6873769",
"0.6861533",
"0.6851112",
"0.6808667",
"0.680101... | 0.0 | -1 |
this should redirect to the show_by_text so that from an FB ad ID, we can get to the show_by_text. | def show
if params[:archive_id]
@some_kind_of_ad = Ad.find_by(archive_id: params[:archive_id])
elsif params[:ad_id]
@some_kind_of_ad = FbpacAd.find_by(id: params[:ad_id])
end
raise ActiveRecord::RecordNotFound if @some_kind_of_ad.nil?
ad_text = @some_ki... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def legacy_show\n # grab the id from slugged urls like \"3818-cops-bust-frat-boys-for\"\n # skip the account part of the URL - this only runs on deployed Hot Ink\n redirect_to \"/articles/#{params[:id].split(\"-\")[0]}\", :status=>:moved_permanently\n end",
"def show\n if params.has_key? 'fb_action_... | [
"0.58591396",
"0.5701559",
"0.5681836",
"0.5675188",
"0.56053424",
"0.56015396",
"0.55989563",
"0.5589446",
"0.5493084",
"0.549195",
"0.5459177",
"0.54413855",
"0.5392215",
"0.53582656",
"0.53579795",
"0.53363615",
"0.5333037",
"0.5326403",
"0.5325303",
"0.5319736",
"0.53038"... | 0.644178 | 0 |
GET /child_dupa2s/1 GET /child_dupa2s/1.xml | def show
@child_dupa2 = ChildDupa2.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @child_dupa2 }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @child_dupa2 = ChildDupa2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @child_dupa2 }\n end\n end",
"def create\n @child_dupa2 = ChildDupa2.new(params[:child_dupa2])\n\n respond_to do |format|\n if @child_dupa2.save\n f... | [
"0.64825124",
"0.59723353",
"0.57594895",
"0.55181503",
"0.54970956",
"0.54509926",
"0.54392385",
"0.53925884",
"0.5279564",
"0.52474344",
"0.52025414",
"0.5175081",
"0.51721936",
"0.51698977",
"0.5159057",
"0.5152955",
"0.5149374",
"0.5136821",
"0.51277494",
"0.51197106",
"0... | 0.70230395 | 0 |
GET /child_dupa2s/new GET /child_dupa2s/new.xml | def new
@child_dupa2 = ChildDupa2.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @child_dupa2 }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @child_dupa2 = ChildDupa2.new(params[:child_dupa2])\n\n respond_to do |format|\n if @child_dupa2.save\n format.html { redirect_to(@child_dupa2, :notice => 'Child dupa2 was successfully created.') }\n format.xml { render :xml => @child_dupa2, :status => :created, :location => ... | [
"0.7288421",
"0.66254866",
"0.6500945",
"0.6499266",
"0.6427485",
"0.6313832",
"0.62019354",
"0.61878234",
"0.615861",
"0.60798806",
"0.60797006",
"0.60524213",
"0.60437036",
"0.6029794",
"0.60109943",
"0.6001074",
"0.59716064",
"0.5948363",
"0.5936467",
"0.5925288",
"0.59056... | 0.7950044 | 0 |
POST /child_dupa2s POST /child_dupa2s.xml | def create
@child_dupa2 = ChildDupa2.new(params[:child_dupa2])
respond_to do |format|
if @child_dupa2.save
format.html { redirect_to(@child_dupa2, :notice => 'Child dupa2 was successfully created.') }
format.xml { render :xml => @child_dupa2, :status => :created, :location => @child_dupa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @child_dupa2 = ChildDupa2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @child_dupa2 }\n end\n end",
"def destroy\n @child_dupa2 = ChildDupa2.find(params[:id])\n @child_dupa2.destroy\n\n respond_to do |format|\n format.html ... | [
"0.6205388",
"0.57261336",
"0.56875503",
"0.5599252",
"0.54524803",
"0.53766364",
"0.5330046",
"0.52850765",
"0.5273924",
"0.5269574",
"0.5184146",
"0.51668555",
"0.5155571",
"0.51460606",
"0.513701",
"0.51216584",
"0.51216584",
"0.5114835",
"0.50928754",
"0.5085354",
"0.5074... | 0.70511484 | 0 |
PUT /child_dupa2s/1 PUT /child_dupa2s/1.xml | def update
@child_dupa2 = ChildDupa2.find(params[:id])
respond_to do |format|
if @child_dupa2.update_attributes(params[:child_dupa2])
format.html { redirect_to(@child_dupa2, :notice => 'Child dupa2 was successfully updated.') }
format.xml { head :ok }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @child_dupa2 = ChildDupa2.new(params[:child_dupa2])\n\n respond_to do |format|\n if @child_dupa2.save\n format.html { redirect_to(@child_dupa2, :notice => 'Child dupa2 was successfully created.') }\n format.xml { render :xml => @child_dupa2, :status => :created, :location => ... | [
"0.60322016",
"0.58202326",
"0.55844784",
"0.5536559",
"0.5506482",
"0.540338",
"0.5400156",
"0.53163123",
"0.5313063",
"0.5298635",
"0.5298635",
"0.5298635",
"0.5294747",
"0.52902526",
"0.5274928",
"0.52606624",
"0.52606535",
"0.52400833",
"0.517628",
"0.5131812",
"0.5130486... | 0.67863804 | 0 |
DELETE /child_dupa2s/1 DELETE /child_dupa2s/1.xml | def destroy
@child_dupa2 = ChildDupa2.find(params[:id])
@child_dupa2.destroy
respond_to do |format|
format.html { redirect_to(child_dupa2s_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def delete_all(xpath); end",
"def destroy\n @child = Child.find(params[:id])\n @child.destroy\n\n respond_to do |format|\n format.html { redir... | [
"0.6859428",
"0.6104533",
"0.6039415",
"0.5937822",
"0.5908418",
"0.58950394",
"0.5874134",
"0.5872313",
"0.585759",
"0.5849316",
"0.58477634",
"0.57850647",
"0.57504195",
"0.57453823",
"0.57293",
"0.57271296",
"0.5721954",
"0.56880534",
"0.5679745",
"0.567381",
"0.5658517",
... | 0.7346373 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_nonprofit
@nonprofit = Nonprofit.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 |
Only allow a trusted parameter "white list" through. | def nonprofit_params
params.require(:nonprofit).permit(:name, :location, :description, :contact_info, :link, :category_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Fetch & Show all of the site records using the api_params [GET] /sites.json => sitesindex def index | def index
@sites = site_search.results
respond_to do |format|
format.json
format.geojson
format.pdf {
render pdf: 'Imiq_Site_List', layout: 'pdf.html'
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n... | [
"0.80960685",
"0.80960685",
"0.7969793",
"0.79552835",
"0.7943348",
"0.78437",
"0.78437",
"0.78437",
"0.78437",
"0.78437",
"0.78437",
"0.7718956",
"0.7656003",
"0.764552",
"0.7605071",
"0.75403833",
"0.75403833",
"0.75403833",
"0.75403833",
"0.75403833",
"0.752544",
"0.7457... | 0.6712785 | 79 |
Fetch & Show an individual site record [GET] /sites/1.json [GET] /sites/1.html | def show
@site = Site.find(params[:id])
respond_to do |format|
format.html { render layout: false }
format.json
format.geojson
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @site = Site.find(params[:id])\n\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n \n end\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json... | [
"0.7558918",
"0.7500083",
"0.7492601",
"0.7492601",
"0.7492601",
"0.7362605",
"0.7215117",
"0.71837187",
"0.71443504",
"0.71125835",
"0.70338166",
"0.7024655",
"0.7010794",
"0.6955047",
"0.6907182",
"0.6905945",
"0.68868184",
"0.6815311",
"0.6790331",
"0.67647177",
"0.6713359... | 0.63569134 | 43 |
Use hardcoded endpoint (default) AWS::SQS::Client.new(XXXXXXXXXXXXXX,XXXXXXXXXXXXXXXXXXXXX) Specify endpoint AWS::SQS::Client.new(XXXXXXXXXXXXXX,XXXXXXXXXXXXXXXXXXXXX, :endpoint => ' | def initialize( aws_access_key_id, aws_secret_access_key, options = {} )
@aws_access_key_id, @aws_secret_access_key = aws_access_key_id, aws_secret_access_key
opts = DEFAULT_SQS_OPTIONS.merge(options)
@endpoint = opts[:endpoint]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoint(endpoint)\n @endpoint = endpoint\n self\n end",
"def set_endpoint(endpoint)\n @client.instance_variable_set(\"@endpoint\", endpoint)\n end",
"def get_endpoint()\n end",
"def initialize(options = {})\n @endpoint = options[:endpoint]\n end",
"def set_endpoint\n @... | [
"0.6694109",
"0.6660307",
"0.6618021",
"0.64832616",
"0.64771706",
"0.64693946",
"0.6465348",
"0.6465348",
"0.6373668",
"0.62773",
"0.6260794",
"0.61608726",
"0.61594695",
"0.6142016",
"0.6111",
"0.6077691",
"0.60596776",
"0.6056455",
"0.60494953",
"0.60479707",
"0.60359186",... | 0.7217012 | 0 |
Get an array of queues | def list_queues()
result = make_request('ListQueues')
if result['ListQueuesResult']
value = result['ListQueuesResult']
elsif result['ListQueuesResponse']
value = result['ListQueuesResponse']['ListQueuesResult']
else
value = nil
end
unless v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queues\n @gem_queue = get_queue 'gem'\n @md5_queue = get_queue 'md5'\n @sha512_queue = get_queue 'sha512'\n end",
"def queues\n Thread.current[:queues] == \"*\" ? Resque.queues.sort : Thread.current[:queues].split(',')\n end",
"def queues\n Thread.current[:queues] == \"*\" ... | [
"0.788603",
"0.78702205",
"0.78702205",
"0.77752733",
"0.7729723",
"0.7671444",
"0.75545",
"0.7538203",
"0.7390208",
"0.727034",
"0.72423553",
"0.7109269",
"0.70845735",
"0.7074894",
"0.70658535",
"0.704299",
"0.70016474",
"0.6997966",
"0.698273",
"0.69434917",
"0.69380736",
... | 0.64630145 | 39 |
Create a new queue | def create_queue(name)
params = {}
params['QueueName'] = name
result = make_request('CreateQueue', nil, params)
unless result.include?('Error')
queue_url = result['CreateQueueResult'][0]['QueueUrl'][0]
return AWS::SQS::Queue.new(name, queue_url, self)
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_queues\n queue\n exchange\n end",
"def build_queue(queue_name)\n QC::Queue.new(queue_name)\n end",
"def create\n profile = calc_profile\n entries = @resource[:entries].join '\", \"'\n raise 'Array of entries can not be empty' if entries.empty?\n entries = format(... | [
"0.7720434",
"0.763552",
"0.7533078",
"0.75255835",
"0.74751496",
"0.7435147",
"0.73838395",
"0.7375723",
"0.7369324",
"0.72783464",
"0.72783464",
"0.7246262",
"0.7197282",
"0.7182561",
"0.71426964",
"0.71370834",
"0.70987755",
"0.7048045",
"0.70472634",
"0.6977577",
"0.69725... | 0.6738914 | 33 |
Send a query request and return a SimpleXML object | def make_request(action, queue_url = nil, params = {})
# Add Actions
params['Action'] = action
params['Version'] = '2009-02-01'
params['AWSAccessKeyId'] = @aws_access_key_id
params['Expires']= (Time.now + 10).gmtime.iso8601
params['SignatureMethod'] = 'HmacSHA1'
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query\n {:xml => xml}\n end",
"def query input\n response = @http.get request_url(input).request_uri\n document = Nokogiri::XML response.body\n\n if document.root.name == \"queryresult\"\n Response.new document\n else\n raise \"Invalid response\"\n end\n ... | [
"0.74999565",
"0.720057",
"0.68284947",
"0.64800936",
"0.6443788",
"0.62952626",
"0.62803173",
"0.61764544",
"0.61707205",
"0.6162703",
"0.614164",
"0.60737795",
"0.60621333",
"0.6046435",
"0.6044036",
"0.60351074",
"0.6033789",
"0.60076445",
"0.6007012",
"0.59865993",
"0.594... | 0.0 | -1 |
puts list_transactions as reference before running edit method: def edit_account and double check that choice is correct end the next two methods will be selected by the category of data chosen by user | def edit_transaction_amount
puts "Choose the number of the transaction to be edited:"
x = gets.chomp.i #should prompt the user to verify the selection before editing
puts "Transaction to be edited:"
puts @transaction[x] #if incorrect, give option to select again
puts "Enter the new amount for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alter_account\n action = Dialog::how_can_we_help_you_man\n case action\n when \"new account\"\n show_man_balance\n choice = Dialog::which_customer\n if bank.find_customer_by_customer_id(choice).length > 0\n @customer_id = choice\n do_new_account\n else\n Dialog... | [
"0.6640759",
"0.6578215",
"0.64212656",
"0.6267219",
"0.6018637",
"0.601399",
"0.599728",
"0.59289896",
"0.58723474",
"0.58316886",
"0.5810716",
"0.57867795",
"0.57804626",
"0.57691723",
"0.5752868",
"0.5752868",
"0.5752868",
"0.5752868",
"0.5752868",
"0.5752868",
"0.5752868"... | 0.59882516 | 7 |
Called after every test method runs. Can be used to tear down fixture information. | def teardown
# Do nothing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_teardown; end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def tear... | [
"0.80261725",
"0.7953777",
"0.7953777",
"0.7856355",
"0.784488",
"0.784488",
"0.784488",
"0.784488",
"0.784488",
"0.784488",
"0.784488",
"0.784488",
"0.78328496",
"0.78328496",
"0.77501464",
"0.77479887",
"0.77479887",
"0.7733529",
"0.771271",
"0.77113944",
"0.77113944",
"0... | 0.0 | -1 |
Same as +render_to_string+ but writes the processed template to +output_path+. | def render_to_file(output_path, context, properties = {})
File.open(output_path, 'wb') do |f|
f.write render_to_string(context, properties)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n prepare if respond_to?(:prepare)\n render(@template_path || compile_template_path)\n end",
"def render(output)\n output = output.to_s.strip\n # or should this use a Template so we can eliminate the block args?\n output = @render.call(output) if @render\n output\n... | [
"0.72226524",
"0.7131264",
"0.6966095",
"0.6908883",
"0.6789561",
"0.66985166",
"0.66729367",
"0.66729367",
"0.658886",
"0.65803",
"0.6504193",
"0.64911234",
"0.6421664",
"0.64194304",
"0.64107215",
"0.640946",
"0.63974345",
"0.6391072",
"0.6387708",
"0.6355788",
"0.6340671",... | 0.7195724 | 1 |
Process the template. The +context+ hash will be available in the template. | def render_to_string(context, properties = {})
render(context, properties).string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_template(context, options); end",
"def process_context context\n\n # Add your own data organisation here\n\n # If you wish, you can examine context[:src_filename] to determine\n # which view you are preparing. Alternatively, you can just give\n # every view an identical con... | [
"0.69043946",
"0.646911",
"0.6404229",
"0.6398281",
"0.63563097",
"0.62096876",
"0.61066043",
"0.60856587",
"0.6007548",
"0.5985299",
"0.5980482",
"0.5941739",
"0.59259033",
"0.5920184",
"0.5914533",
"0.5894296",
"0.5894296",
"0.5870043",
"0.5856923",
"0.5848604",
"0.58477336... | 0.0 | -1 |
process the sablon xml template with the given +context+. IMPORTANT: Open Office does not ignore whitespace around tags. We need to render the xml without indent and whitespace. | def process(content, context, *args)
document = Nokogiri::XML(content)
Processor.process(document, context, *args).to_xml(indent: 0, save_with: 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_process_variables_xml (variables)\n\n OpenWFE::Xml.to_xml(variables, :indent => 2)\n end",
"def generate\n begin\n xml_string = ''\n ERB.new(template,0).result(bind { xml_string })\n rescue Exception => e\n puts \"XML CONTENT CREATION ERROR => \"\n puts e\n Outpu... | [
"0.5781774",
"0.52602524",
"0.523786",
"0.5125697",
"0.51235586",
"0.51174235",
"0.5037132",
"0.49834958",
"0.49583402",
"0.49349925",
"0.49248284",
"0.49118185",
"0.48809248",
"0.48750293",
"0.4874436",
"0.4855597",
"0.4855597",
"0.48430553",
"0.47741747",
"0.47688773",
"0.4... | 0.62564987 | 0 |
Show a circular transition (circle reduce it size or increase it) | def circular(direction = -1)
sp1 = ShaderedSprite.new
sp1.bitmap = Bitmap.new(Graphics.width, Graphics.height)
sp1.shader = shader = Shader.create(:yuki_circular)
shader.set_float_uniform('xfactor', sp1.bitmap.width.to_f / (h = sp1.bitmap.height))
0.upto(NB_Frame) do |i|
yield(i, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_circle(circle)\n circle.opacity -= 10\n circle.zoom_x += 0.04\n circle.zoom_y += 0.04\n if circle.zoom_x > 3\n circle.opacity = 255\n circle.zoom_x = 0.0\n circle.zoom_y = 0.0\n end\n end",
"def render_circle(cx, cy, d, color)\n @app.stroke color\n @app.nofill \n ... | [
"0.6622431",
"0.6122514",
"0.58194464",
"0.5817867",
"0.5803641",
"0.5728209",
"0.5632578",
"0.5616877",
"0.559416",
"0.5581536",
"0.55408615",
"0.5489352",
"0.5471964",
"0.54558694",
"0.54447335",
"0.54422086",
"0.5391019",
"0.5378851",
"0.53235424",
"0.5320764",
"0.5310961"... | 0.5738683 | 5 |
Transition that goes from up > down or right > left | def directed(direction = -1)
w = Graphics.width
w2 = w * 2.0
gp = $game_player
dx = gp.direction.between?(4, 6) ? w2 / NB_Frame : 0
dy = dx == 0 ? w2 / NB_Frame : 0
dx *= -1 if gp.direction == 6
dy *= -1 if gp.direction == 2
d = gp.direction * direction
sp1 = Shader... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transitions; end",
"def move_down\n\t\tmove([0,1])\n\tend",
"def move_forward\n case @direction\n when 2\n move_down(false)\n when 4\n move_left(false)\n when 6\n move_right(false)\n when 8\n move_up(false)\n end\n end",
"def forward_move\n case @facing\n when... | [
"0.67356396",
"0.65952367",
"0.65720713",
"0.6339127",
"0.6232519",
"0.6223252",
"0.6202359",
"0.62020856",
"0.6148394",
"0.6081033",
"0.60745543",
"0.60655975",
"0.60572946",
"0.60552144",
"0.6048334",
"0.6048334",
"0.6041435",
"0.6039016",
"0.6022809",
"0.6013825",
"0.60106... | 0.0 | -1 |
Display a weird transition (for battle) | def weird_transition(nb_frame = 60, radius = 0.25, max_alpha = 0.5, min_tau = 0.07, delta_tau = 0.07, bitmap: nil)
sp = ShaderedSprite.new
sp.bitmap = bitmap || $scene.snap_to_bitmap
sp.zoom = Graphics.width / sp.bitmap.width.to_f
sp.shader = shader = Shader.create(:yuki_weird)
sp.set_orig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_transition\r\n Graphics.transition(120)\r\n end",
"def main_transition\r\n Graphics.transition\r\n end",
"def transitions; end",
"def main_transition\r\n # Execute transition\r\n if $data_system.battle_transition == \"\"\r\n Graphics.transition(20)\r\n else\r\n Graphics.tr... | [
"0.7384052",
"0.7143926",
"0.7093677",
"0.7032142",
"0.68317604",
"0.6770279",
"0.64306206",
"0.64306206",
"0.6350432",
"0.6343882",
"0.61969155",
"0.61322874",
"0.6046105",
"0.6034262",
"0.60031855",
"0.59701395",
"0.5912567",
"0.5875848",
"0.5841919",
"0.5815358",
"0.581026... | 0.0 | -1 |
Display a BW in>out Transition | def bw_zoom(transition_sprite)
60.times do
transition_sprite.zoom_x = (transition_sprite.zoom_y *= 1.005)
Graphics.update
end
30.times do
transition_sprite.zoom_x = (transition_sprite.zoom_y *= 1.01)
transition_sprite.opacity -= 9
Graphics.update
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_transition\r\n Graphics.transition(120)\r\n end",
"def main_transition\r\n Graphics.transition\r\n end",
"def transitions; end",
"def render_Transition t\n return if @rendered[t]\n @rendered[t] = true\n\n # Do not render Transition if source and target States are both rendered... | [
"0.6117253",
"0.5851116",
"0.5720651",
"0.56058526",
"0.55013955",
"0.547998",
"0.53865236",
"0.5376074",
"0.53648543",
"0.5304943",
"0.52848047",
"0.52524704",
"0.5214785",
"0.519402",
"0.5175444",
"0.5175444",
"0.5147152",
"0.51420194",
"0.513285",
"0.513285",
"0.5132623",
... | 0.0 | -1 |
Terminate an instance by id | def terminate_instance!(id=nil)
raise RemoteException.new(:method_not_defined, "terminate_instance!")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def terminate_instance!(instance_id)\n instances.select {|a| a[:instance_id] == instance_id}[0][:status] = \"terminating\"\n end",
"def terminate_instance(instance_id)\n return if instance_id.nil? || !configured?\n\n @client.terminate_instances(instance_ids: [instance_id])\n nil\n end",
"def ... | [
"0.75745595",
"0.7494596",
"0.7477889",
"0.71500653",
"0.71115506",
"0.71044564",
"0.70662296",
"0.6936605",
"0.6714693",
"0.6696216",
"0.6670276",
"0.66555715",
"0.66100454",
"0.653904",
"0.6521039",
"0.6483736",
"0.6454139",
"0.64277333",
"0.64277333",
"0.64142805",
"0.6410... | 0.84263915 | 0 |
Describe an instance's status | def describe_instance(id=nil)
raise RemoteException.new(:method_not_defined, "describe_instance")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aws_instance_status(opts)\n opts[:instance].status\n end",
"def status\n instance_get(:status)\n end",
"def status_of(instance)\n description.instances.select{ |e| e.instance_id == instance}\n end",
"def instances_status\n @instances.each do |i_id, meta|\n status = AWS::CLI_In... | [
"0.84802556",
"0.80172217",
"0.7954035",
"0.79156905",
"0.7784319",
"0.7410004",
"0.7343665",
"0.7326811",
"0.72748053",
"0.7258897",
"0.7177353",
"0.7177353",
"0.7167696",
"0.7167696",
"0.7167696",
"0.7167696",
"0.70940816",
"0.7092714",
"0.70843655",
"0.70695126",
"0.706951... | 0.0 | -1 |
Get instances The instances must have a status associated with them on the hash | def describe_instances
raise RemoteException.new(:method_not_defined, "describe_instances")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end",
"def instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving active instances\"\n fetch_instances\n end",
... | [
"0.73154074",
"0.71600837",
"0.66633046",
"0.6583306",
"0.648759",
"0.64778274",
"0.6470809",
"0.64569026",
"0.6435703",
"0.6435703",
"0.64035875",
"0.6359929",
"0.6323723",
"0.6304677",
"0.6300554",
"0.6220699",
"0.6195561",
"0.6189194",
"0.6156283",
"0.6150217",
"0.613754",... | 0.0 | -1 |
Get a list of the pending instances | def list_of_pending_instances(list = list_of_nonterminated_instances)
list.select {|a| a.pending? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_of_pending_instances(list = list_of_nonterminated_instances)\n list.select {|a| a if a.pending? }\n end",
"def not_created_instances\n pending_instances_count = wanted_instances - filtered_pods_by_track.count\n\n return [] if pending_instances_count <= 0\n\n Array.new(pendin... | [
"0.8093115",
"0.6993657",
"0.6781459",
"0.67419535",
"0.6714917",
"0.66184604",
"0.6613177",
"0.6572264",
"0.65676355",
"0.6567524",
"0.6549853",
"0.64741623",
"0.6449495",
"0.64459914",
"0.6410454",
"0.64047456",
"0.6397479",
"0.6316833",
"0.63084537",
"0.6265943",
"0.625069... | 0.81258255 | 0 |
list of shutting down instances | def list_of_terminating_instances(list = remote_instances_list)
list.reject {|i| true if !i.terminating? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_of_terminating_instances(list = remote_instances_list)\n list.reject {|i| true if !i.terminating? }\n end",
"def instances\n @instances ||= init_instances.reject(&:terminated?)\n end",
"def shutdown()\n \n #shutdown all the instances we have.\n ids = id()\n ... | [
"0.69679725",
"0.68048394",
"0.66978",
"0.6514819",
"0.6510996",
"0.648368",
"0.6463507",
"0.63514155",
"0.63444877",
"0.6343137",
"0.6218244",
"0.62176925",
"0.62029207",
"0.6186159",
"0.61721057",
"0.6167306",
"0.61671335",
"0.61671335",
"0.6135978",
"0.6118833",
"0.6103401... | 0.69226754 | 1 |
Get the instances that are nonmaster instances | def nonmaster_nonterminated_instances(list = list_of_nonterminated_instances)
list_of_nonterminated_instances.reject {|i| i.master? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nonmaster_nonterminated_instances(list = list_of_nonterminated_instances)\n list_of_nonterminated_instances.reject {|i| i.master? }\n end",
"def other_instances\n\t\tinstances.reject { |i| i == self }\n\tend",
"def instances\n @instances ||= init_instances.reject(&:terminated?)\n end",
... | [
"0.7740622",
"0.7155978",
"0.7151329",
"0.6820202",
"0.6771303",
"0.676711",
"0.6610101",
"0.6600553",
"0.6595612",
"0.65897816",
"0.65845144",
"0.6483468",
"0.6451479",
"0.63897765",
"0.63877094",
"0.6383185",
"0.6371339",
"0.6369894",
"0.6352256",
"0.63421",
"0.63177335",
... | 0.7765072 | 0 |
list all the nonterminated instances | def list_of_nonterminated_instances(list = remote_instances_list)
list.reject {|i| i.terminating? || i.terminated? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_of_nonterminated_instances(list = remote_instances_list)\n list.reject {|i| i.terminating? || i.terminated? }\n end",
"def nodes\n @nodes ||= list_of_nonterminated_instances.collect_with_index do |inst, i|\n RemoteInstance.new(inst.merge({:number => i}))\n end\n end",
"def ... | [
"0.75107133",
"0.6627899",
"0.6621074",
"0.6617248",
"0.6602446",
"0.63989806",
"0.6398079",
"0.63632107",
"0.63631",
"0.6362877",
"0.62617016",
"0.62617016",
"0.6246165",
"0.62321156",
"0.6222227",
"0.62003195",
"0.6190425",
"0.6167643",
"0.61579484",
"0.60214186",
"0.602033... | 0.752663 | 0 |
Get instance by number | def get_instance_by_number(i=0, list = remote_instances_list)
name = (i.zero? ? "master" : "node#{i}")
list.select {|i| i.name == name }.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_instance_by_number(i=0, list = remote_instances_list) \n name = ((i.nil? || i.zero?) ? \"master\" : \"node#{i}\")\n list.select {|i| i.name == name }.first\n end",
"def get_instance(payload)\n NumberInstance.new(@version, payload, )\n end",
"def get_item(num)\n... | [
"0.72785914",
"0.6646169",
"0.64614594",
"0.6390763",
"0.63207",
"0.62514687",
"0.6197323",
"0.61759675",
"0.61339045",
"0.60839087",
"0.6053848",
"0.6029615",
"0.5943606",
"0.5929203",
"0.5921052",
"0.59132093",
"0.5904558",
"0.5888984",
"0.584009",
"0.5827045",
"0.5827045",... | 0.72835135 | 0 |
List the instances for the current key pair, regardless of their states If no keypair is passed, select them all | def list_of_instances(keyp=nil)
key = keyp ? keyp : keypair
describe_instances.select {|a| key ? a[:keypair] == key : true } if describe_instances
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_of_instances(keyp=nil)\n tmp_key = (keyp ? keyp : nil)\n \n unless @describe_instances\n tmpInstanceList = remote_base.describe_instances(options).select {|a| a if (tmp_key.nil? || tmp_key.empty? ? true : a[:keypair] == tmp_key) }\n has_master = !tmpInstanceList.select {|a| a[... | [
"0.65681696",
"0.65282446",
"0.6269113",
"0.6206775",
"0.57580894",
"0.56835836",
"0.55773765",
"0.5575338",
"0.55263186",
"0.5492356",
"0.5492356",
"0.5489736",
"0.54736066",
"0.5465079",
"0.5461115",
"0.54019445",
"0.5375463",
"0.5360042",
"0.5316789",
"0.5305717",
"0.52974... | 0.75003296 | 0 |
Instances Get the master from the cloud | def master
# remote_instances_list.select {|a| a.master }.first
@list = list_from_remote
@list.reject {|a| a unless a.name =~ /master/ }.first if @list.class != String
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving active instances\"\n fetch_instances\n end",
"def get_instances\n instances = [ ]\n get_clouds.each do |cloud|\n instances += cloud.instances.index(:filter => [], :view => 'tiny')\n end\n instances\n ... | [
"0.7171947",
"0.7138955",
"0.69924426",
"0.6797402",
"0.66962534",
"0.6645486",
"0.66249245",
"0.659326",
"0.6485639",
"0.64380544",
"0.6427355",
"0.64187044",
"0.6404966",
"0.63841194",
"0.6375506",
"0.6291796",
"0.62603927",
"0.6254346",
"0.62537134",
"0.6238062",
"0.621018... | 0.72389984 | 0 |
Reset the cache of descriptions | def reset!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset!\n @cached_descriptions = nil\n @nodes = nil\n @cloud_nodes = nil\n end",
"def reset(data)\n if @collection.include? data\n @description = data\n else\n raise \"Unable to find Objective Description: #{data} in class #{self.class.to_s}\"\n end\n end",
... | [
"0.68874985",
"0.6598861",
"0.6462385",
"0.6333296",
"0.6304484",
"0.6244092",
"0.62217206",
"0.61548454",
"0.6138864",
"0.61111015",
"0.6061076",
"0.60407454",
"0.60291547",
"0.6024875",
"0.6018012",
"0.6014374",
"0.5968594",
"0.5941899",
"0.59304565",
"0.59173036",
"0.58721... | 0.0 | -1 |
Custom installation tasks Allow the remoter bases to attach their own tasks on the installation process | def custom_install_tasks_for(a=nil)
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_install_tasks_for(a=nil)\n []\n end",
"def install_tasks\n load 'falkorlib/tasks/git.rake'\n load 'falkorlib/tasks/gitflow.rake'\n end",
"def install\n AdminModule.configuration.credentials.keys.each do |e|\n valid_actions.each do |action|\n AdminModule::Rak... | [
"0.7017739",
"0.6838085",
"0.6710355",
"0.66869897",
"0.659061",
"0.6348303",
"0.63104373",
"0.6141963",
"0.61354786",
"0.61347556",
"0.6134266",
"0.61253905",
"0.6096361",
"0.6093196",
"0.6091276",
"0.60910827",
"0.60910827",
"0.60671055",
"0.6063888",
"0.6059518",
"0.605602... | 0.70072407 | 1 |
Custom configure tasks Allows the remoter bases to attach their own custom configuration tasks to the configuration process | def custom_configure_tasks_for(a=nil)
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_tasks\n end",
"def before_configuration_tasks \n end",
"def setup_config\n # To be Extended\n end",
"def configure\n load_all_configs \n end",
"def build_reconfigure_instances_script_for(node)\n write_to_file_for(\"configuration\", node) do\n open(A... | [
"0.767404",
"0.66823506",
"0.6553882",
"0.65508974",
"0.65299076",
"0.65062577",
"0.6484232",
"0.6483322",
"0.6327542",
"0.6327542",
"0.63073677",
"0.6293749",
"0.6293717",
"0.6240755",
"0.6231932",
"0.62125844",
"0.6193545",
"0.61838335",
"0.61605775",
"0.6145509",
"0.612367... | 0.64929533 | 6 |
only allow these params. prevents giving URL queries that could mess with app. | def trip_params
params.require(:trip).permit(:name, :start_date, :end_date, :location)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_params_authentication!; end",
"def valid_params_request?; end",
"def allowed_query_params\n %w[include fields filter sort page]\n end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def valid_for_params_auth?; end",
"def safe_params\n params.except(:host, :port, :protocol).permit... | [
"0.7009865",
"0.6907725",
"0.68762165",
"0.67449814",
"0.6664416",
"0.66429645",
"0.6564818",
"0.6564818",
"0.6529811",
"0.6519879",
"0.64551723",
"0.6426446",
"0.641618",
"0.6398293",
"0.6391364",
"0.63818175",
"0.6375704",
"0.6374101",
"0.63728845",
"0.6346159",
"0.63407487... | 0.0 | -1 |
=================== Collection Actions ==================== | def daily
respond_with PostDailyList.last_or_create
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collection; end",
"def collection; end",
"def collections; end",
"def collection\n @collector.collection\n end",
"def initialize\n @collection = []\n end",
"def initialize\n @collection={}\n end",
"def collection\n klass.collection\n end",
"def collection\n ... | [
"0.79056156",
"0.79056156",
"0.78369856",
"0.6778673",
"0.67329663",
"0.67175806",
"0.6697287",
"0.6663201",
"0.66461474",
"0.6643502",
"0.66303897",
"0.65839803",
"0.65839803",
"0.6561718",
"0.65331656",
"0.65331656",
"0.6526165",
"0.6523127",
"0.6520504",
"0.650952",
"0.650... | 0.0 | -1 |
==================== Member Actions ======================= | def post_relation
if user = current_user
respond_with PostRelation.find_or_create(post_id:params[:id],user_id:user.id)
else
head :unauthorized
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def member; end",
"def member; end",
"def member; end",
"def member; end",
"def member; end",
"def member\n super\n end",
"def member\n super\n end",
"def member\n end",
"def members; end",
"def members; end",
"def members; end",
"def members; end",
"d... | [
"0.7586371",
"0.75258857",
"0.75258857",
"0.75258857",
"0.75258857",
"0.75258857",
"0.72900236",
"0.72900236",
"0.72541374",
"0.69980145",
"0.69980145",
"0.69980145",
"0.69980145",
"0.69980145",
"0.69980145",
"0.69980145",
"0.6931693",
"0.6931693",
"0.6931693",
"0.6931693",
"... | 0.0 | -1 |
called by the Rack server | def each # :nodoc:
begin
time, all = @rdmon.wait_snapshot
stats = all[@addr] or next
stats.queued >= @queued_min or next
stats.active >= @active_min or next
body = sprintf(@fmt, time.iso8601, @addr, stats.active, stats.queued)
body = "#{body.size.to_s(16)}\r\n#{body... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rack_builder; end",
"def server; end",
"def server; end",
"def server; end",
"def server; end",
"def server; end",
"def server; end",
"def server; end",
"def server; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def reques... | [
"0.6699739",
"0.65294015",
"0.65294015",
"0.65294015",
"0.65294015",
"0.65294015",
"0.65294015",
"0.65294015",
"0.65294015",
"0.646943",
"0.646943",
"0.646943",
"0.646943",
"0.646943",
"0.646943",
"0.646943",
"0.646943",
"0.646943",
"0.646943",
"0.646943",
"0.64360374",
"0.... | 0.0 | -1 |
shuts down the background thread, only for tests | def shutdown
@socket = nil
@thr.join if @thr
@thr = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_thread; end",
"def teardown\n evicting_thread.kill\n end",
"def shut_down\n @keep_running = false\n if (RUBY_PLATFORM == \"java\")\n @mp.stop\n else\n wipe_out\n @thread.exit\n end\n end",
"def shutdown\n shutdown_proxy\n exit_thread\n super\n ... | [
"0.7352128",
"0.7243311",
"0.70118815",
"0.69480205",
"0.6874422",
"0.68429595",
"0.6825741",
"0.68077844",
"0.6805715",
"0.6802201",
"0.67863834",
"0.67863834",
"0.67863834",
"0.67863834",
"0.67863834",
"0.67863834",
"0.67863834",
"0.6782398",
"0.6776913",
"0.67666256",
"0.6... | 0.67257744 | 23 |
Insert command index : index to add the command command : command to add resize : resize flag to resize window | def insert_command(index, command, resize=true)
@commands.insert(index, command)
@item_max = @commands.size
refresh_command(resize)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pbCommandMenu(index)\n commands=[\"FIGHT\",\"Jermon\",\"BAG\",\"RUN\"]\n cw = Window_Command.new(192, commands)\n cw.x=0\n cw.y=256\n cw.index=@lastcmd[index]\n pbRefresh\n loop do\n Graphics.update\n Input.update\n pbFrameUpdate(cw)\n if Input.trigger?(Input::C)\n ... | [
"0.6676029",
"0.6342321",
"0.63333154",
"0.6321253",
"0.62561405",
"0.62504834",
"0.59882647",
"0.59465384",
"0.59296405",
"0.59002143",
"0.58989704",
"0.5885213",
"0.5865502",
"0.5795477",
"0.57162964",
"0.56736803",
"0.56549096",
"0.56444335",
"0.5632214",
"0.5619933",
"0.5... | 0.80378693 | 0 |
Remove command command : command to remove resize : resize flag to resize window | def remove_command(command, resize=true)
@commands.delete(command)
@item_max = @commands.size
refresh_command(resize)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unbind_resize_child_windows\n API.unbind \"\\\\\", @mash\nend",
"def refresh_command(resize)\n if resize\n self.height = [self.height, row_max * WLH + 32].max\n end\n create_contents\n refresh\n end",
"def resizable?; true; end",
"def resize\n trigger(:_clear_)\n\n trigger(:_... | [
"0.6893768",
"0.63502806",
"0.6194846",
"0.6186395",
"0.6026255",
"0.58725446",
"0.58011454",
"0.5684993",
"0.5669968",
"0.56285375",
"0.55947095",
"0.55130255",
"0.5495099",
"0.549451",
"0.547782",
"0.54540664",
"0.5421444",
"0.5412323",
"0.5407374",
"0.5393088",
"0.5392301"... | 0.7285709 | 0 |
////////////////////////////////////////////////////////////////////////// Private Methods ////////////////////////////////////////////////////////////////////////// Refresh command resize : resize flag to resize window | def refresh_command(resize)
if resize
self.height = [self.height, row_max * WLH + 32].max
end
create_contents
refresh
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize\n trigger(:_clear_)\n\n trigger(:_refresh_)\n\n true\n end",
"def resize new_width, new_height\n win.resize new_width, new_height\n end",
"def resize width, height\n @widgets[@index].width = width\n @widgets[@index].height = height\n @widgets[@index].repaint\... | [
"0.7935148",
"0.68164545",
"0.6710931",
"0.64762384",
"0.6449226",
"0.6360609",
"0.6269637",
"0.6233852",
"0.62283313",
"0.61869776",
"0.61445093",
"0.6127325",
"0.60945773",
"0.6091847",
"0.6090799",
"0.60686904",
"0.60429466",
"0.6040533",
"0.60286087",
"0.60286087",
"0.601... | 0.8435376 | 0 |
Show invalid properties with the reasons. Usually used together with valid? | def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.... | [
"0.76497203",
"0.76497203",
"0.76497203",
"0.76497203",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7356452",
"0.7334807",
"0.72685325",
"0.7238964",
"0.7231359",
"0.72258264",
"0.7208294",
"0.71760833"
] | 0.7170241 | 98 |
Check to see if the all the properties in the model are valid | def valid?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_properties\n true\n end",
"def validate_properties\n true\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :... | [
"0.78992486",
"0.78992486",
"0.70971805",
"0.70782334",
"0.7032205",
"0.7031276",
"0.69510347",
"0.6869891",
"0.6858077",
"0.6858077",
"0.68287027",
"0.6823878",
"0.6820306",
"0.68144894",
"0.6794656",
"0.6752167",
"0.66843414",
"0.6676546",
"0.6667755",
"0.66296124",
"0.6618... | 0.0 | -1 |
Checks equality by comparing each attribute. | def ==(o)
return true if self.equal?(o)
self.class == o.class &&
account_id == o.account_id &&
active == o.active &&
avalara_oid == o.avalara_oid &&
company_id == o.company_id &&
enable_upc == o.enable_upc &&
estimate_only == o.estimate_only &&
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n attributes == other.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en... | [
"0.7291717",
"0.7188103",
"0.70395297",
"0.7007927",
"0.68874705",
"0.6861532",
"0.6707156",
"0.6660597",
"0.66147524",
"0.658478",
"0.6584619",
"0.6580019",
"0.65543133",
"0.6543933",
"0.65068495",
"0.6479513",
"0.6456241",
"0.6415999",
"0.6412208",
"0.6412208",
"0.6412208",... | 0.0 | -1 |
Calculates hash code according to all attributes. | def hash
[account_id, active, avalara_oid, company_id, enable_upc, estimate_only, guest_customer_code, last_test_dts, license_key, sandbox, send_test_orders, service_url, test_results].hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ... | [
"0.7118691",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.68960655",
"0.67847186",
"0.6707762",
"0.670052",
"0.6688737",
"0.66705376",
"0.6489735",
"0.6462376",
"0.6462376",
"0.64444333",
"0.6413127",
"0.6395483",
"0.638... | 0.0 | -1 |
Builds the object from hash | def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the attribute
# is documented as an array but the input is not
if at... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end",
"def build_from_hash(attributes)\n\n end",
"def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically ... | [
"0.8011074",
"0.7470833",
"0.7457607",
"0.7256629",
"0.72455454",
"0.70060325",
"0.6973257",
"0.6955014",
"0.69459796",
"0.69398683",
"0.69363195",
"0.6917627",
"0.6872358",
"0.6796184",
"0.6783521",
"0.67575246",
"0.67575246",
"0.67560464",
"0.67514306",
"0.67136854",
"0.666... | 0.0 | -1 |
Deserializes the data based on type | def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s... | [
"0.7330926",
"0.7274019",
"0.72504056",
"0.7245751",
"0.7218884",
"0.7213926",
"0.71909",
"0.7183136",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71... | 0.72291344 | 13 |
Returns the string representation of the object | def to_s
to_hash.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @object.to_s\n end",
"def to_s\n object.to_s\n end",
"def serialize(object)\n object.to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"de... | [
"0.901024",
"0.89506465",
"0.84703195",
"0.83409667",
"0.8337169",
"0.8337169",
"0.8332247",
"0.82546586",
"0.8145818",
"0.8144667",
"0.81357557",
"0.812714",
"0.8093436",
"0.8086725",
"0.8073356",
"0.8039774",
"0.80308646",
"0.80064154",
"0.80064154",
"0.80064154",
"0.800641... | 0.0 | -1 |
to_body is an alias to to_hash (backward compatibility) | def to_body
to_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_body\r\n to_hash\r\n end",
"def to_body\n to_hash\nend",
"def to_body\n to_hash\nend"
] | [
"0.84287274",
"0.8345594",
"0.8345594"
] | 0.0 | -1 |
Returns the object in the form of hash | def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n object\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n to_a.hash\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n return to_s.hash\n end",
"def hash\n @hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n ... | [
"0.8270299",
"0.78767854",
"0.78726953",
"0.7802364",
"0.7789188",
"0.77806795",
"0.7775915",
"0.7767511",
"0.7760525",
"0.7760525",
"0.77559966",
"0.7731286",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",... | 0.0 | -1 |
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value | def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n value.hash\n end",
"def hash\n @value.hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def to_hash\n @value\n end",
"def to_hash\n @va... | [
"0.6719518",
"0.6719518",
"0.666832",
"0.66565555",
"0.6586841",
"0.6452931",
"0.6414911",
"0.6414911",
"0.6382046",
"0.6346188",
"0.6302933",
"0.62237245",
"0.6151989",
"0.6101756",
"0.60795677",
"0.60795677",
"0.60717124",
"0.6035991",
"0.6021168",
"0.5936472",
"0.5903488",... | 0.0 | -1 |
Ask question with using return to exit the loop and removing answer variable | def ASK question
while true
puts question
reply = gets.chomp.downcase
if reply == "yes"
return true
end
if reply == "no"
return false
end
puts "Please answer yes or no !"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ask question\n while true\n puts question\n reply = gets.chomp.downcase\n return true if reply == 'yes'\n return false if reply == 'no'\n puts 'Please answer \"yes\" or \"no\".'\n end\nend",
"def ask question \n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\tif (reply... | [
"0.7988072",
"0.79322094",
"0.7845748",
"0.7826986",
"0.7817559",
"0.7793473",
"0.775976",
"0.77583027",
"0.76618165",
"0.7600467",
"0.74904275",
"0.7392232",
"0.7351292",
"0.7320193",
"0.7284017",
"0.72371614",
"0.7209292",
"0.71379304",
"0.7115789",
"0.71119845",
"0.7065831... | 0.7954821 | 1 |
roman numerals, Old_ Roman_Numeral 4 = IIII | def old_roman_numeral number
numeral = ""
numeral = numeral + "M" * (number / 1000)
numeral = numeral + "D" * (number % 1000/500)
numeral = numeral + "C" * (number % 500/ 100)
numeral = numeral + "L" * (number % 100/ 50)
numeral = numeral + "X" * (number % 50/ 10)
numeral = numeral + "V" * (number %... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def old_roman_numeral num\nnumerals = \"\"\nnumerals << \"M\" * (num / 1000)\nnumerals << \"D\" * (num % 1000 /500)\nnumerals << \"C\" * (num % 500 / 100)\nnumerals << \"L\" * (num % 100 / 50)\nnumerals << \"X\" * (num % 50 / 10)\nnumerals << \"V\" * (num % 10 / 5)\nnumerals << \"I\" * (num % 5 / 1)\nnumerals\nend... | [
"0.8137905",
"0.8063251",
"0.80577266",
"0.801429",
"0.7998423",
"0.7994523",
"0.79910535",
"0.7943335",
"0.7904476",
"0.7904476",
"0.7871421",
"0.7812059",
"0.7810013",
"0.77988",
"0.77613366",
"0.7759564",
"0.7752849",
"0.7751973",
"0.7744137",
"0.77376217",
"0.7734397",
... | 0.8022265 | 3 |
"MODERN" Roman Numeral Stone Carver Theory Problem | def modern_roman_numeral number
numeral = ""
numeral_1 = (number / 1000)
numeral_2 = (number % 1000/100)
numeral_3 = (number % 100/ 10)
numeral_4 = (number % 10)
roman = "M" * numeral_1
if numeral_2 == 9
roman = roman + "CM"
elsif numeral_2 == 4
roman = roman + "CD"
else
roman = roman + "D"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution(number)\n\nm, r_1 = number.divmod(1000)\ncd, r_2 = r_1.divmod(100)\nlx, r_3 = r_2.divmod(10)\nvi, r_4 = r_3.divmod(1)\n\nroman = []\n\nm.times { roman << \"M\" }\n\nif cd <= 3\n\tcd.times { roman << \"C\" }\nelsif cd == 4\n\troman << \"CD\"\nelsif cd == 5\n\troman << \"D\"\nelsif cd > 5 && cd < 9\n\tr... | [
"0.72556573",
"0.7164992",
"0.70102024",
"0.69252634",
"0.6786901",
"0.6757547",
"0.67394817",
"0.6705",
"0.6695964",
"0.66898185",
"0.6651175",
"0.6635998",
"0.6625001",
"0.6571763",
"0.65610933",
"0.65301096",
"0.6529048",
"0.6526249",
"0.65079045",
"0.64983135",
"0.6492905... | 0.6350369 | 38 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.