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 |
|---|---|---|---|---|---|---|
Creates the body of a +:hash_def+ object | def parse_hash_def
ref, hash = parse_hash
[ref, hash, parse]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_hash(&block); end",
"def create_hash(&block); end",
"def body= exp\n expect :defn, :defs, :class, :module\n @my_hash_value = nil\n\n case self.node_type\n when :defn, :class\n index = 3\n when :defs\n index = 4\n when :module\n index = 2\n end\n\n self.slice!(i... | [
"0.61097753",
"0.61097753",
"0.6043597",
"0.5926026",
"0.58906543",
"0.57946694",
"0.5757864",
"0.57483006",
"0.57291204",
"0.57076067",
"0.57076067",
"0.56492",
"0.56492",
"0.56492",
"0.56492",
"0.56492",
"0.56492",
"0.56492",
"0.56492",
"0.56492",
"0.56492",
"0.56492",
... | 0.57934076 | 6 |
Instance variables contain an object followed by a count of instance variables and their contents | def parse_instance_variables
instance_variables = []
pairs = @tokens.next
instance_variables << pairs
pairs.times do
instance_variables << get_symbol
instance_variables << parse
end
instance_variables
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance_variables() end",
"def instance_variables; end",
"def class_variables() end",
"def class_variables; end",
"def instance_variable_names; end",
"def class_variables\n end",
"def ivar_descriptions\n\t\tself.instance_variables.sort.collect do |ivar|\n\t\t\tnext unless ivar.respond_to?( :lengt... | [
"0.79095757",
"0.7559216",
"0.7484455",
"0.72354597",
"0.7151961",
"0.6896283",
"0.65262854",
"0.65262806",
"0.65134454",
"0.64710253",
"0.6468529",
"0.64176697",
"0.6416752",
"0.6416752",
"0.64108425",
"0.6397813",
"0.6299028",
"0.62771446",
"0.62768334",
"0.62192327",
"0.62... | 0.62802875 | 17 |
Creates an object saved by _dump | def parse_user_defined
name = get_symbol
data = @tokens.next
[object_ref, name, data]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(object) end",
"def create objid\n DataObj.new @repo, self, objid, true\n end",
"def save_object\n end",
"def _dump() end",
"def _create\n @save_mixin.json_dict = @json_dict\n @save_mixin._deleted = @_deleted\n @save_mixin._create\n @json_dict = @save_mixin.json_dict... | [
"0.6681429",
"0.6541694",
"0.64356625",
"0.6434814",
"0.64060277",
"0.63330054",
"0.6327264",
"0.6310187",
"0.6272572",
"0.626238",
"0.62506604",
"0.62306327",
"0.622316",
"0.6219101",
"0.62189126",
"0.62189126",
"0.6218809",
"0.6215956",
"0.6211251",
"0.6193551",
"0.619268",... | 0.0 | -1 |
Creates an object saved by marshal_dump | def parse_user_marshal
name = get_symbol
[object_ref, name, parse]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marshal_dump; end",
"def marshal_dump\n dump\n end",
"def marshal_load(serialised); end",
"def marshall_dump\n end",
"def marshall_dump\n end",
"def serialize(object) end",
"def marshal\n Marshal.dump self\n end",
"def marshal\n Marshal.dump self\n end",
"def marshal... | [
"0.7688824",
"0.74245995",
"0.71365523",
"0.70218426",
"0.6965523",
"0.69555056",
"0.68669546",
"0.68669546",
"0.68669546",
"0.684479",
"0.66943127",
"0.6605896",
"0.6601413",
"0.65825385",
"0.6565504",
"0.6534339",
"0.64482075",
"0.64482075",
"0.63885427",
"0.6381205",
"0.63... | 0.0 | -1 |
Creates a new symbol reference | def symbol_ref
@symbols += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sym(name)\n SymEngine::Symbol.new(name)\nend",
"def def_symbol(name, address, memory_type = nil)\n @symbol_set.def_symbol name, address, memory_type\n end",
"def create_symbols\n # creates all named symbols, including vector references\n @expressions.map { |a| a.create_symbols }\n p... | [
"0.6813567",
"0.6769185",
"0.6620816",
"0.6582092",
"0.6582092",
"0.651113",
"0.63900524",
"0.6322469",
"0.61812574",
"0.6164425",
"0.6091454",
"0.6057525",
"0.6002202",
"0.59711635",
"0.595853",
"0.59405726",
"0.5901571",
"0.5890792",
"0.58712304",
"0.58679134",
"0.58597887"... | 0.65612864 | 5 |
Constructs a Symbol from the token stream | def get_symbol
token = @tokens.next
case token
when :symbol then
[:symbol, *parse_symbol]
when :symbol_link then
[:symbol_link, @tokens.next]
else
raise ArgumentError, "expected SYMBOL or SYMLINK, got #{token.inspect}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symbol\n Util.from_bytes :symbol, value\n end",
"def on_symbol(node)\n node = node[0] if node.is_a?(Array)\n\n return Node.new(:symbol, node.children, metadata(node))\n end",
"def create_initial_symbol(sym)\n m = sym.internal.to_s.match /^_?([_A-Z]+)(\\d+)?/\n s = $1.... | [
"0.64983",
"0.6316585",
"0.6200693",
"0.6138722",
"0.61356455",
"0.6127135",
"0.6088863",
"0.60477597",
"0.6029399",
"0.6029399",
"0.602799",
"0.6025056",
"0.5984961",
"0.5973641",
"0.59479535",
"0.58880645",
"0.5838417",
"0.5824666",
"0.5817728",
"0.5775621",
"0.5767059",
... | 0.6812719 | 0 |
Returns a hash containing all user attributes | def to_hash
hash = {}
instance_variables.each do |var|
hash[var.to_s.delete('@')] = instance_variable_get(var)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes_from_user\n return {} unless @current_user&.loa3?\n\n {\n 'first_name' => @current_user.first_name,\n 'last_name' => @current_user.last_name,\n 'birth_date' => @current_user.birth_date,\n 'ssn' => @current_user.ssn,\n 'icn' => @current_user.... | [
"0.7640047",
"0.75183225",
"0.728809",
"0.72172695",
"0.7171623",
"0.71095985",
"0.707403",
"0.70468146",
"0.70327604",
"0.6986172",
"0.6947087",
"0.692214",
"0.69140244",
"0.68869936",
"0.68789756",
"0.687442",
"0.6853448",
"0.68309444",
"0.68309444",
"0.68309444",
"0.681200... | 0.0 | -1 |
Returns a hash containing all user attributes | def to_hash
hash = {}
instance_variables.each do |var|
hash[var.to_s.delete('@')] = instance_variable_get(var)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes_from_user\n return {} unless @current_user&.loa3?\n\n {\n 'first_name' => @current_user.first_name,\n 'last_name' => @current_user.last_name,\n 'birth_date' => @current_user.birth_date,\n 'ssn' => @current_user.ssn,\n 'icn' => @current_user.... | [
"0.7640047",
"0.75183225",
"0.728809",
"0.72172695",
"0.7171623",
"0.71095985",
"0.707403",
"0.70468146",
"0.70327604",
"0.6986172",
"0.6947087",
"0.692214",
"0.69140244",
"0.68869936",
"0.68789756",
"0.687442",
"0.6853448",
"0.68309444",
"0.68309444",
"0.68309444",
"0.681200... | 0.0 | -1 |
Initialize a new +Contract+. | def initialize(instructions = nil, balance: 50, &block)
if block_given?
@instructions = InstructionBuilder.new(&block).instructions
else
@instructions = instructions
end
@balance = balance
@storage = Storage.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize()\n super\n @odata_type = \"#microsoft.graph.contract\"\n end",
"def initialize(options={})\r\n @contract = options[:symbol]\r\n @contract_type = options[:contract_type]\r\n end",
"def initialize(repository = ContractRepository.new)\n @reposit... | [
"0.7190052",
"0.6999834",
"0.6352813",
"0.6352813",
"0.62502384",
"0.62297505",
"0.62297505",
"0.61223745",
"0.606145",
"0.606145",
"0.606145",
"0.606145",
"0.606145",
"0.606145",
"0.606145",
"0.606145",
"0.606145",
"0.606145",
"0.606145",
"0.606145",
"0.606145",
"0.606145"... | 0.0 | -1 |
Execute the script in the context of the contract. | def run_script
Script.new(instructions, storage, self).execute
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute script\n native.execute_script script\n end",
"def execute\n\t\traise RuntimeError, \":#{self} is not defined\" unless @definition\n\t\t@definition.execute\n\tend",
"def eval script\n # native function. this stub is for documenting only\n end",
"def call(config: {}, args: {})\n ... | [
"0.6428389",
"0.609243",
"0.60828996",
"0.6049964",
"0.6025905",
"0.60035294",
"0.59667104",
"0.5965693",
"0.59521204",
"0.594909",
"0.594909",
"0.59429246",
"0.5931554",
"0.5832768",
"0.58316904",
"0.58316904",
"0.5831211",
"0.58303416",
"0.58012813",
"0.57967335",
"0.579186... | 0.70038235 | 0 |
Skip nil, empty array and empty hash. | def skip_value?(value)
value.nil? || ((value.is_a?(Array) || value.is_a?(Hash)) && value.empty?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_empty_arrays\n @fields = {}.with_indifferent_access if @fields.length == 0\n @link_fields = {}.with_indifferent_access if @link_fields.length == 0\n end",
"def handle_empty_arrays\n @fields = {}.with_indifferent_access if @fields.length == 0\n @link_fields = {}.with_indifferent_... | [
"0.65514725",
"0.65514725",
"0.6182856",
"0.6179093",
"0.6161849",
"0.60812217",
"0.6051354",
"0.6027021",
"0.6020739",
"0.60145164",
"0.59802014",
"0.5904902",
"0.58565027",
"0.5852088",
"0.58399403",
"0.5838129",
"0.58360356",
"0.580796",
"0.5805643",
"0.5796526",
"0.57386"... | 0.69219446 | 0 |
setup and return an authed xen api instance | def xapi
@xapi ||= begin
ui.fatal 'Must provide a xapi host with --host ' unless locate_config_value(:xapi_host)
verify = :verify_none
verify = :verify_peer if locate_config_value(:xapi_ssl_verify) == true
session = XenApi::Client.new(locate_config_value(:xapi_host), 10, verify)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xapi\n @xapi ||= begin \n\n session = XenApi::Client.new( Chef::Config[:knife][:xenserver_host] )\n \n # get the password from the user\n password = Chef::Config[:knife][:xenserver_password] || nil\n username = Chef::Config[:knife][:xenserver_username] || \"root\"\n ... | [
"0.7296881",
"0.6649278",
"0.6649278",
"0.6517127",
"0.62388605",
"0.62012875",
"0.60145843",
"0.59489006",
"0.591755",
"0.59004915",
"0.58803177",
"0.58781636",
"0.5774009",
"0.5760868",
"0.5751078",
"0.5751078",
"0.57233846",
"0.5709409",
"0.5703977",
"0.57033414",
"0.57021... | 0.70683914 | 1 |
get template by name_label | def get_template(template)
xapi.VM.get_by_name_label(template).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_content(name)\n templates.select { |t| t[:name] = name || 'index' }.first[:template]\n end",
"def template(name)\n @conn.templates.get(name)\n end",
"def find(name)\n Template.find(name)\n end",
"def lookup_template(name)\n @templates.fetch(name.to_s) { |k| @parent ? @parent... | [
"0.7337035",
"0.7164645",
"0.7130932",
"0.70599294",
"0.6886516",
"0.67277527",
"0.6668454",
"0.6644507",
"0.6570703",
"0.6494935",
"0.63884765",
"0.6328406",
"0.63190377",
"0.62144727",
"0.61859363",
"0.61849594",
"0.61763185",
"0.61763185",
"0.6116581",
"0.6094707",
"0.6076... | 0.6786441 | 6 |
find a template matching what the user provided returns a ref to the vm or nil if nothing found | def find_template(template)
template = locate_config_value(:template_regex) if template.nil?
# if we got a string then try to find that template exact
# if no exact template matches, search
if template.is_a?(String)
found = get_template(template)
return found if found
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_template(template=XAPI_TEMP_REGEX)\n # if we got a string then try to find that template exact \n # if no exact template matches, search\n if template.is_a?(String)\n found = get_template(template)\n return found if found\n end\n\n # make sure our nil template gets... | [
"0.81149757",
"0.74114877",
"0.74114877",
"0.65950406",
"0.64218354",
"0.63918567",
"0.63918567",
"0.6391291",
"0.6365641",
"0.63087195",
"0.6295348",
"0.62927914",
"0.62826985",
"0.6253243",
"0.62141985",
"0.6202143",
"0.6181158",
"0.6166286",
"0.6165992",
"0.6135252",
"0.60... | 0.8011158 | 1 |
present a list of options for a user to select return the selected item | def user_select(items)
h.choose do |menu|
menu.index = :number
menu.prompt = 'Please Choose One:'
menu.select_by = :index_or_name
items.each do |item|
menu.choice item.to_sym do |command|
ui.msg "Using: #{command}"
selected = command.to_s
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selected_options; end",
"def selected_options; end",
"def user_select(items)\n choose do |menu|\n menu.index = :number\n menu.prompt = \"Please Choose One:\"\n menu.select_by = :index_or_name\n items.each do |item|\n menu.choice item.to_sym do |command| \n ... | [
"0.74085927",
"0.74085927",
"0.7317928",
"0.72944754",
"0.71260816",
"0.70598996",
"0.70092756",
"0.6941871",
"0.68958443",
"0.686225",
"0.6836899",
"0.678314",
"0.67641",
"0.6746727",
"0.6690688",
"0.66878587",
"0.6676449",
"0.6671398",
"0.6669875",
"0.6653944",
"0.6642505",... | 0.7597772 | 0 |
destroy/remove VM refs and exit | def cleanup(vm_ref)
# shutdown and dest
unless xapi.VM.get_power_state(vm_ref) == 'Halted'
ui.msg 'Shutting down Guest'
task = xapi.Async.VM.hard_shutdown(vm_ref)
get_task_ref(task) unless task == 'Halted'
end
ui.msg 'Removing disks attached to Guest'
Chef::Log.deb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup(vm_ref)\n ui.warn \"Clenaing up work and exiting\"\n xapi.VM.destroy(vm_ref)\n exit 1 \n end",
"def destroy\n vm.destroy\n FileUtils.rm_rf dir\n end",
"def shutdown_vms()\n @vm_manager.shutdown_vms()\n end",
"def free_resources\n\t\tunset_vim_event_ho... | [
"0.82115495",
"0.70042837",
"0.6665374",
"0.6663562",
"0.6641876",
"0.66348284",
"0.6512091",
"0.6509763",
"0.648554",
"0.6480976",
"0.6349479",
"0.6341895",
"0.6331703",
"0.63259923",
"0.6310877",
"0.63105476",
"0.62988544",
"0.62986946",
"0.62960863",
"0.62695783",
"0.62651... | 0.67904466 | 2 |
cleanup a vm and exit (fail) | def fail(ref = nil)
ui.warn 'Error encountered clenaing up and exiting'
cleanup ref if ref
exit 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup(vm_ref)\n ui.warn \"Clenaing up work and exiting\"\n xapi.VM.destroy(vm_ref)\n exit 1 \n end",
"def destroy\n vm.destroy\n FileUtils.rm_rf dir\n end",
"def cleanup\n vm_id = VMHelper.get_vm(service_manager.vapi_config, vm_name)\n status = vm_power_svc.ge... | [
"0.84670633",
"0.73307616",
"0.71438444",
"0.68722016",
"0.68499714",
"0.6698766",
"0.66610205",
"0.6601877",
"0.6535604",
"0.6518471",
"0.65036315",
"0.64443785",
"0.64322317",
"0.6426881",
"0.6407738",
"0.6407738",
"0.63855207",
"0.63855207",
"0.63855207",
"0.63855207",
"0.... | 0.0 | -1 |
generate a random mac address | def generate_mac
if locate_config_value(:macaddress).nil?
('%02x' % (rand(64) * 4 | 2)) + (0..4).reduce('') { |s, _x|s + ':%02x' % rand(256) }
else
locate_config_value(:macaddress)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_mac \n (\"%02x\"%(rand(64)*4|2))+(0..4).inject(\"\"){|s,x|s+\":%02x\"%rand(256)}\n end",
"def mac_address\n unless @mac\n octets = 3.times.map { rand(255).to_s(16) }\n @mac = \"525400#{octets[0]}#{octets[1]}#{octets[2]}\"\n end\n @mac\n end",
"de... | [
"0.86014366",
"0.8422662",
"0.82588875",
"0.8197847",
"0.8024737",
"0.7575176",
"0.7172173",
"0.70558286",
"0.6996246",
"0.69906986",
"0.69515294",
"0.69515294",
"0.69515294",
"0.6951478",
"0.69384605",
"0.6920688",
"0.68982375",
"0.686574",
"0.6798367",
"0.67851627",
"0.6784... | 0.8629708 | 0 |
add a new vif | def add_vif_by_name(vm_ref, dev_num, net_name)
Chef::Log.debug "Looking up vif for: #{h.color(net_name, :cyan)}"
network_ref = xapi.network.get_by_name_label(net_name).first
if network_ref.nil?
if net_name =~ /Network (\d)+$/ # special handing for 'Network X' As displayed by XenCenter
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vif_by_name(vm_ref, dev_num, net_name)\n puts \"Looking up vif for: #{h.color(net_name, :cyan)}\"\n network_ref = xapi.network.get_by_name_label(net_name).first\n if network_ref.nil? \n ui.warn \"#{h.color(net_name,:red)} not found, moving on\"\n return \n end\n\n mac... | [
"0.7036182",
"0.6567766",
"0.6131278",
"0.61267024",
"0.5580999",
"0.5557015",
"0.552016",
"0.5402582",
"0.5193733",
"0.5173705",
"0.513487",
"0.51302683",
"0.50930846",
"0.50735533",
"0.5059188",
"0.50513065",
"0.50409335",
"0.5038882",
"0.5029085",
"0.5023179",
"0.5017406",... | 0.6888695 | 1 |
remove all vifs on a record | def clear_vm_vifs(record)
record['VIFs'].each do |vif|
Chef::Log.debug "Removing vif: #{h.color(vif, :red, :bold)}"
xapi.VIF.destroy(vif)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_vm_vifs(record)\n record[\"VIFs\"].each do |vif|\n Chef::Log.debug \"Removing vif: #{h.color(vif, :red, :bold)}\"\n xapi.VIF.destroy(vif)\n end\n end",
"def remove_record(record)\n atoms = condense_record(record)\n load_atoms(atoms)\n atoms.each do ... | [
"0.79600316",
"0.65310246",
"0.6513316",
"0.6513316",
"0.5889857",
"0.5869592",
"0.577571",
"0.5755324",
"0.57514834",
"0.57197124",
"0.56945366",
"0.5670835",
"0.5670835",
"0.5670835",
"0.5670835",
"0.5621269",
"0.5573456",
"0.55483955",
"0.55230933",
"0.5472909",
"0.5460182... | 0.79696035 | 0 |
returns true if uuid is a uuid | def is_uuid?(uuid)
uuid =~ /[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}/i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uuid?(uuid)\n uuid_regex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/\n uuid_regex.match?(uuid.to_s.downcase)\nend",
"def uuid?(item)\n item.to_s.match?(UUID_FORMAT)\n end",
"def uuid?(str)\n !!(str && str.size == 36 && str.match(/\\A\\h{8}-\\h{4}-\\h{4}-\\h{4}-\\h{12}\\z/)... | [
"0.85143405",
"0.817398",
"0.81112134",
"0.7888385",
"0.78314865",
"0.7507196",
"0.73482895",
"0.7306703",
"0.7263651",
"0.72297096",
"0.70660615",
"0.6983303",
"0.6829201",
"0.6529873",
"0.6500843",
"0.6470383",
"0.64519155",
"0.63339204",
"0.62591803",
"0.6248251",
"0.62222... | 0.87068355 | 0 |
returns sr_ref to the default sr on pool | def find_default_sr
xapi.pool.get_default_SR(xapi.pool.get_all[0])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_default_sr()\n xapi.pool.get_default_SR( xapi.pool.get_all()[0] ) \n end",
"def default_pool_name\n super\n end",
"def get_sr_by_name(name)\n sr_ref = xapi.SR.get_by_name_label(name)[0]\n if sr_ref.empty? || sr_ref.nil?\n ui.error \"SR name #{h.color(name) } not found\... | [
"0.80243576",
"0.6163244",
"0.6123942",
"0.59259945",
"0.5847667",
"0.57653797",
"0.5693877",
"0.5637356",
"0.5591739",
"0.55242133",
"0.551131",
"0.54621875",
"0.5435539",
"0.5322566",
"0.5270316",
"0.523766",
"0.5237447",
"0.52192295",
"0.5215333",
"0.5212007",
"0.52075714"... | 0.8070641 | 0 |
return an SR record from the name_label | def get_sr_by_name(name)
sr_ref = xapi.SR.get_by_name_label(name)[0]
if sr_ref.empty? || sr_ref.nil?
ui.error "SR name #{h.color(name) } not found"
return nil
end
sr_ref
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sr_by_name(name)\n sr_ref = xapi.SR.get_by_name_label(name)\n if sr_ref.empty? or sr_ref.nil?\n ui.error \"SR name #{h.color( name ) } not found\"\n return nil\n end\n sr = xapi.SR.get_record( sr_ref )\n end",
"def name_record() @records.get(GRT_STRNAME); end",
"def... | [
"0.7043629",
"0.6789592",
"0.6548529",
"0.5866814",
"0.575229",
"0.56317264",
"0.5490827",
"0.545733",
"0.5446437",
"0.5395684",
"0.5369494",
"0.5343122",
"0.5328882",
"0.5327027",
"0.5316214",
"0.5311753",
"0.52693725",
"0.52467054",
"0.519386",
"0.51892275",
"0.51868284",
... | 0.67711616 | 2 |
return SR record from uuid | def get_sr_by_uuid(uuid)
sr_ref = xapi.SR.get_by_uuid(uuid)
if sr_ref.empty? || sr_ref.nil?
ui.error "SR not found #{h.color(uuid)} "
return nil
end
sr_ref
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(uuid, options = {})\n if uuid.nil?\n # Should we raise an ArgumentError, instead?\n raise NotFound, \"can't find a record with nil identifier\"\n end\n\n uri = uuid =~ /^http/ ? uuid : member_path(uuid)\n attributes = @records[uri] || raise(NotFound, \"No #{se... | [
"0.64977133",
"0.6374855",
"0.624605",
"0.61889243",
"0.6120016",
"0.6114452",
"0.60872245",
"0.5915463",
"0.5915463",
"0.5913772",
"0.5905216",
"0.5895278",
"0.58780843",
"0.5792729",
"0.5746038",
"0.5712881",
"0.57085013",
"0.57049084",
"0.56898415",
"0.5678902",
"0.5678902... | 0.74986136 | 0 |
convert 1g/1m/1t to bytes rounds to whole numbers | def input_to_bytes(size)
case size
when /m|mb/i
size.to_i * (1024**2)
when /t|tb/i
size.to_i * (1024**4)
else
# default is gigabytes
size.to_i * (1024**3)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_bytes(size, unit)\n size.to_f * UNITS_FACTOR[unit]\n end",
"def transform_byte(byte) \n byte = byte.to_f\n return two_digits(byte / 1073741824).to_s << \" GB\" if byte > 1073741824\n return two_digits(byte / 1048576).to_s << \" MB\" if byte > 1048576\n return two_digits(byte / 1024).to_s <... | [
"0.6517277",
"0.6507288",
"0.6507288",
"0.65046185",
"0.6477154",
"0.64518493",
"0.63573855",
"0.6258298",
"0.62181985",
"0.61263007",
"0.6109469",
"0.60839087",
"0.605243",
"0.6035999",
"0.60353243",
"0.60115737",
"0.5991819",
"0.59743506",
"0.5951716",
"0.59475094",
"0.5902... | 0.6032074 | 15 |
create a vdi return ref | def create_vdi(name, sr_ref, size)
vdi_record = {
'name_label' => "#{name}",
'name_description' => "Root disk for #{name} created by #{ENV['USER']} with knfie xapi",
'SR' => sr_ref,
'virtual_size' => input_to_bytes(size).to_s,
'type' => 'system',
'sharable' => false... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_vdi(name, sr_ref, size)\n vdi_record = {\n \"name_label\" => \"#{name}\",\n \"name_description\" => \"Root disk for #{name} created by knfie xapi\",\n \"SR\" => sr_ref,\n \"virtual_size\" => input_to_bytes(size).to_s,\n \"type\" => \"system\",\n \"sharable\... | [
"0.6083944",
"0.5751635",
"0.5751635",
"0.5616778",
"0.5566383",
"0.548016",
"0.5474211",
"0.5458642",
"0.5392618",
"0.53670365",
"0.53618044",
"0.5323938",
"0.5226588",
"0.52252865",
"0.5221681",
"0.51218593",
"0.50210077",
"0.5020231",
"0.5005895",
"0.49465358",
"0.49463937... | 0.6123681 | 0 |
sit and wait for taks to exit pending state | def wait_on_task(task)
while xapi.task.get_status(task) == 'pending'
xapi.task.get_progress(task)
sleep 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait; end",
"def wait; end",
"def wait; end",
"def waiting; end",
"def waiting; end",
"def wait_until_not_full; end",
"def wait\n @t.each{|t| t.join}\n end",
"def wait_done\n sleep 0.01 until done?\n end",
"def wait_until_complete\n tries = 0\n status = nil\n sleep 1\... | [
"0.6472466",
"0.6472466",
"0.6472466",
"0.63633025",
"0.63633025",
"0.62337244",
"0.6201287",
"0.61847425",
"0.6135775",
"0.61011803",
"0.6090849",
"0.60807955",
"0.60440254",
"0.60332215",
"0.6003726",
"0.59872586",
"0.5983445",
"0.59820515",
"0.59428203",
"0.59381855",
"0.5... | 0.0 | -1 |
return the opaque ref of the task that was run by a task record if it succeded. else it returns nil | def get_task_ref(task)
Chef::Log.debug "Waiting on task #{task}"
wait_on_task(task)
status_ = xapi.task.get_status(task)
case status_
when 'success'
puts "#{h.color "#{status_}", :green }"
# xapi task record returns result as <value>OpaqueRef:....</value>
# we wan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_task_ref(task)\n wait_on_task(task)\n case xapi.task.get_status(task) \n when \"success\"\n # xapi task record returns result as <value>OpaqueRef:....</value> \n # we want the ref. this way it will work if they fix it to return jsut the ref\n ref = xapi.task.get_result... | [
"0.7656254",
"0.65583205",
"0.65439487",
"0.61340433",
"0.60836595",
"0.59657973",
"0.59603757",
"0.58937997",
"0.5878938",
"0.5774637",
"0.5690893",
"0.56645215",
"0.56610113",
"0.56391364",
"0.56311613",
"0.5600672",
"0.5599991",
"0.55475247",
"0.5546749",
"0.55447036",
"0.... | 0.7310457 | 1 |
create vbd and return a ref defaults to bootable | def create_vbd(vm_ref, vdi_ref, position, boot = true)
vbd_record = {
'VM' => vm_ref,
'VDI' => vdi_ref,
'empty' => false,
'other_config' => { 'owner' => '' },
'userdevice' => position.to_s,
'bootable' => boot,
'mode' => 'RW',
'qos_algorithm_type' => ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_vbd(vm_ref, vdi_ref, position)\n vbd_record = {\n \"VM\" => vm_ref,\n \"VDI\" => vdi_ref,\n \"empty\" => false,\n \"other_config\" => {\"owner\"=>\"\"},\n \"userdevice\" => position.to_s,\n \"bootable\" => true,\n \"mode\" => \"RW\",\n \"qos_a... | [
"0.7230204",
"0.61682117",
"0.6147121",
"0.5973062",
"0.584638",
"0.57457197",
"0.56166166",
"0.5611677",
"0.56080747",
"0.5606464",
"0.55662644",
"0.5559343",
"0.5511773",
"0.5509474",
"0.54712963",
"0.54413307",
"0.54111075",
"0.5404672",
"0.53963566",
"0.53831685",
"0.5363... | 0.75152326 | 0 |
try to get a guest ip and return it | def get_guest_ip(vm_ref)
guest_ip = 'unknown'
vgm = xapi.VM.get_guest_metrics(vm_ref)
unless 'OpaqueRef:NULL' == vgm
networks = xapi.VM_guest_metrics.get_networks(vgm)
if networks.key?('0/ip')
guest_ip = networks['0/ip']
end
end
guest_ip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_guest_ip\n execute(:get_network_config, VmId: vm_id)\n end",
"def ssh_ip\n 5.times do\n ip = read_guest_ip_dhcp\n return ip unless ip.empty?\n\n ip = read_guest_ip_prlctl\n return ip unless ip.empty?\n\n sleep 2\n end\n... | [
"0.7347585",
"0.73376334",
"0.7271319",
"0.71906894",
"0.7133324",
"0.70859295",
"0.6873038",
"0.6809857",
"0.67915004",
"0.67886907",
"0.67865574",
"0.673578",
"0.6717963",
"0.6691913",
"0.6639309",
"0.66137826",
"0.66009116",
"0.65943074",
"0.6559412",
"0.65440184",
"0.6537... | 0.77779114 | 0 |
return true (yes) false (no) to the asked question | def yes_no?(msg)
answer = ui.ask("#{msg} yes/no ? ") do |res|
res.case = :down
res.validate = /y|n|yes|no/
res.responses[:not_valid] = "Use 'yes', 'no', 'y', 'n':"
end
case answer
when 'y', 'yes'
true
when 'n', 'no'
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def will_answer?\n return true\n end",
"def accept?(question)\n ! (ask(\"#{question} [YES/no] >\") =~ /n/i)\n end",
"def ask_boolean(question)\n yes? ask(question, true, ['y/n'])\n end",
"def answer?\n return @answer\n end",
"def yes_no reply\n\tif reply == 'yes'\n\t\treturn true\t\n\te... | [
"0.7957218",
"0.7877566",
"0.7862156",
"0.7674413",
"0.76101226",
"0.75920624",
"0.75802916",
"0.7480803",
"0.7441359",
"0.7387836",
"0.7381492",
"0.7377744",
"0.73309034",
"0.7328515",
"0.730632",
"0.73006654",
"0.7271092",
"0.72591555",
"0.7242832",
"0.72398496",
"0.7238055... | 0.0 | -1 |
rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/MethodLength | def i18n_location_title_key
holding = current_request.holdings.first
if holding
if holding.checked_out?
'CHECKEDOUT'
elsif holding.on_order?
'ON-ORDER'
elsif holding.missing?
'MISSING'
elsif holding.processing?
'INPROCESS'
else
current_reques... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def refutal()\n end",
"def strategy; end",
"def used?; end",
"def offences_by; end",
"def isola... | [
"0.76761746",
"0.6400676",
"0.63731337",
"0.63731337",
"0.61646897",
"0.6152987",
"0.6152987",
"0.6152987",
"0.6152987",
"0.61223286",
"0.60601026",
"0.6020423",
"0.60147595",
"0.59232235",
"0.59232235",
"0.5889465",
"0.58724165",
"0.58724165",
"0.58556306",
"0.58424836",
"0.... | 0.0 | -1 |
rubocop:enable Metrics/MethodLength rubocop:enable Metrics/PerceivedComplexity | def i18n_library_title_key
current_request.origin
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def schubert; end",
"def offences_by; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def used?; end",
"def refutal()\n end",
"def suivre; end",
"def strateg... | [
"0.7548178",
"0.63631064",
"0.62408304",
"0.62408304",
"0.6136252",
"0.6011869",
"0.60107946",
"0.60107946",
"0.60107946",
"0.60107946",
"0.5979617",
"0.59667945",
"0.58986413",
"0.58833295",
"0.5848726",
"0.5848726",
"0.58313376",
"0.58313376",
"0.5824842",
"0.5803489",
"0.5... | 0.0 | -1 |
bij het zetten van de chef wordt ook de afdeling van die chef goed gezet. Het veranderen van die afdeling wordt beschermd in het onderdeel werknemer. | def chef=(werknemer)
if (werknemer.instance_of?(Werknemer))
@chef = werknemer
werknemer.afdeling = self
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zuruecksetzen()\n end",
"def bewegen(key)\n \n # Bewegung nach Rechts \n if key == :right then \n\t\t\n\t\tif @feld[@position_y][@position_x +1] == 0 or \t\t\t# FALL: Gärtner fährt auf leeres Feld\n\t\t @feld[@position_y][@position_x +1] == 5 then \t\t# FALL: Gärtner fährt gegen Ecke\n\t\t\t\t@posit... | [
"0.64693224",
"0.6272851",
"0.6026434",
"0.6013076",
"0.5949069",
"0.59049964",
"0.5836411",
"0.57846546",
"0.5771315",
"0.5737704",
"0.57331616",
"0.571527",
"0.56845605",
"0.5644767",
"0.562895",
"0.56254584",
"0.5611327",
"0.5582538",
"0.5571345",
"0.55635",
"0.55455923",
... | 0.5229779 | 64 |
Parse command line arguments | def parse_args(args)
options = OpenStruct.new
options[:html] = false
options[:directory] = './'
options[:ext] = '.jpg'
opt_parser = OptionParser.new do |opts|
opts.banner = 'Usage: main.rb [options]'
opts.separator ''
opts.separator 'Options:'
opts.on('-f', '--filename FIL... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_command_line args\n args.options do |opt|\n opt.on(\"rutema v#{Version::STRING}\")\n opt.on(\"Options:\")\n opt.on(\"--config FILE\", \"-c FILE\",String,\"Loads the configuration from FILE\") { |config_file| @config_file=config_file}\n opt.on(\"--check\",\"Runs just the s... | [
"0.7295732",
"0.7222856",
"0.7186892",
"0.7182332",
"0.71750516",
"0.71655226",
"0.7115532",
"0.7114558",
"0.7089483",
"0.708755",
"0.7087541",
"0.70142186",
"0.6983003",
"0.694971",
"0.69486547",
"0.69220555",
"0.6883271",
"0.6880376",
"0.6866374",
"0.6858988",
"0.68574244",... | 0.679751 | 22 |
Recursively searches the specified directory for files matching an extension Returns an array of fully qualified filenames | def matches(directory, extension)
matches = []
Find.find(directory) do |path|
ext = File.extname(path)
matches << path if ext && ext.downcase == extension
end
matches
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code_files_in_recursive(some_dir, extensions)\n raise ArgumentError, 'some_dir is not a Pathname' unless some_dir.is_a? Pathname\n return [] unless some_dir.exist? && some_dir.directory?\n\n Find.find(some_dir).map { |p| Pathname.new(p) }.select(&:directory?).map { |d| code_files_in(d, extension... | [
"0.77085966",
"0.7605847",
"0.7448714",
"0.7131968",
"0.70411086",
"0.70196927",
"0.70041436",
"0.69917256",
"0.6979456",
"0.6917384",
"0.69161934",
"0.68454397",
"0.6838172",
"0.6826777",
"0.68209815",
"0.681543",
"0.6785049",
"0.67785275",
"0.6764299",
"0.6748223",
"0.67342... | 0.7368427 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_friend
@friend = Friend.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 friend_params
params.require(:friend).permit(:requester_id, :destiny_id, :status)
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 |
Specialized proxy for set_get the key is the method name | def context_params(data=nil)
set_get __method__, data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method,val=nil)\n if val.nil?\n get(method)\n else\n method = method.to_s[0..-2].to_sym # get rid of = sign\n set(method,val)\n end\n end",
"def method_missing(key, *args, &block)\n key = key.to_s\n if key[-1] == '='\n # This is a set met... | [
"0.7682811",
"0.7594391",
"0.7508087",
"0.7409714",
"0.7328158",
"0.7188376",
"0.7073554",
"0.70224047",
"0.6982471",
"0.69816875",
"0.69163793",
"0.69148153",
"0.6912699",
"0.68864805",
"0.6885413",
"0.68794",
"0.68714494",
"0.68714494",
"0.68714494",
"0.68714494",
"0.686746... | 0.0 | -1 |
Specialized proxy for set_get the key is the method name | def current_uid(data=nil)
set_get __method__, data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method,val=nil)\n if val.nil?\n get(method)\n else\n method = method.to_s[0..-2].to_sym # get rid of = sign\n set(method,val)\n end\n end",
"def method_missing(key, *args, &block)\n key = key.to_s\n if key[-1] == '='\n # This is a set met... | [
"0.7682811",
"0.7594391",
"0.7508087",
"0.7409714",
"0.7328158",
"0.7188376",
"0.7073554",
"0.70224047",
"0.6982471",
"0.69816875",
"0.69163793",
"0.69148153",
"0.6912699",
"0.68864805",
"0.6885413",
"0.68794",
"0.68714494",
"0.68714494",
"0.68714494",
"0.68714494",
"0.686746... | 0.0 | -1 |
Specialized proxy for set_get the key is the method name | def previous_sender(data=nil)
set_get __method__, data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method,val=nil)\n if val.nil?\n get(method)\n else\n method = method.to_s[0..-2].to_sym # get rid of = sign\n set(method,val)\n end\n end",
"def method_missing(key, *args, &block)\n key = key.to_s\n if key[-1] == '='\n # This is a set met... | [
"0.7682811",
"0.7594391",
"0.7508087",
"0.7409714",
"0.7328158",
"0.7188376",
"0.7073554",
"0.70224047",
"0.6982471",
"0.69816875",
"0.69163793",
"0.69148153",
"0.6912699",
"0.68864805",
"0.6885413",
"0.68794",
"0.68714494",
"0.68714494",
"0.68714494",
"0.68714494",
"0.686746... | 0.0 | -1 |
Specialized proxy for set_get the key is the method name | def sent_to(data=nil)
set_get __method__, data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method,val=nil)\n if val.nil?\n get(method)\n else\n method = method.to_s[0..-2].to_sym # get rid of = sign\n set(method,val)\n end\n end",
"def method_missing(key, *args, &block)\n key = key.to_s\n if key[-1] == '='\n # This is a set met... | [
"0.7682811",
"0.7594391",
"0.7508087",
"0.7409714",
"0.7328158",
"0.7188376",
"0.7073554",
"0.70224047",
"0.6982471",
"0.69816875",
"0.69163793",
"0.69148153",
"0.6912699",
"0.68864805",
"0.6885413",
"0.68794",
"0.68714494",
"0.68714494",
"0.68714494",
"0.68714494",
"0.686746... | 0.0 | -1 |
Specialized proxy for set_get the key is the method name | def reply_to(data=nil)
set_get __method__, data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method,val=nil)\n if val.nil?\n get(method)\n else\n method = method.to_s[0..-2].to_sym # get rid of = sign\n set(method,val)\n end\n end",
"def method_missing(key, *args, &block)\n key = key.to_s\n if key[-1] == '='\n # This is a set met... | [
"0.7682811",
"0.7594391",
"0.7508087",
"0.7409714",
"0.7328158",
"0.7188376",
"0.7073554",
"0.70224047",
"0.6982471",
"0.69816875",
"0.69163793",
"0.69148153",
"0.6912699",
"0.68864805",
"0.6885413",
"0.68794",
"0.68714494",
"0.68714494",
"0.68714494",
"0.68714494",
"0.686746... | 0.0 | -1 |
Return the value stored into the corresponding thread.current key only if no data is passed | def set_get(key, data=nil)
Thread.current[key] = data if data
Thread.current[key]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [] key\n Thread.current[key]\n end",
"def job_key; Thread.current[:job_key]; end",
"def value_for(thread)\n if (array = get_threadlocal_array(thread))\n value = array[@index]\n if value.nil?\n get_default\n elsif value.equal?(NULL)\n nil\n else... | [
"0.7099817",
"0.6935349",
"0.68401015",
"0.6356222",
"0.6253977",
"0.61871505",
"0.61831295",
"0.6140798",
"0.6130637",
"0.6069791",
"0.6057121",
"0.6041927",
"0.5979298",
"0.59394103",
"0.5915518",
"0.5829292",
"0.5823481",
"0.56957805",
"0.56668603",
"0.5661696",
"0.5651181... | 0.7110254 | 0 |
GET /trips or /trips.json | def index
if current_user.admin?
@itineraries = Itinerary.all
else
@itineraries = current_user.itineraries.where(user_id: current_user)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trips\n get '/gtfs/trips'\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def index\n @trips = Trip.all\n\n render json: @t... | [
"0.7942741",
"0.76750875",
"0.7234676",
"0.7234676",
"0.7204999",
"0.7198039",
"0.68950343",
"0.68571347",
"0.6856659",
"0.68305236",
"0.6786947",
"0.6785633",
"0.6780788",
"0.67786545",
"0.67786545",
"0.67786545",
"0.67786545",
"0.67786545",
"0.67786545",
"0.67786545",
"0.67... | 0.0 | -1 |
GET /trips/1 or /trips/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def trips\n get '/gtfs/trips'\n end",
"def index\n @trips = Trip.desc.all\n @latest_trip... | [
"0.7568279",
"0.7421914",
"0.7171391",
"0.70248514",
"0.70248514",
"0.6991419",
"0.68120444",
"0.6771522",
"0.66547",
"0.663672",
"0.6608222",
"0.66026926",
"0.655355",
"0.65530074",
"0.6542404",
"0.6512025",
"0.6512025",
"0.6512025",
"0.6512025",
"0.6512025",
"0.6512025",
... | 0.0 | -1 |
POST /trips or /trips.json | def create
@itinerary = Itinerary.new(itinerary_params)
@itinerary.user_id = current_user.id
respond_to do |format|
if @itinerary.save
format.html { redirect_to @itinerary, notice: "Itinerary was successfully created." }
format.json { render :show, status: :created, loca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trips\n get '/gtfs/trips'\n end",
"def create\n trip = current_user.trips.new(trip_params)\n if trip.save\n render json: {\n status: :created,\n trip: trip\n }\n else\n render json: {\n status: 500,\n errors: trip.errors.full_messages\n }\n ... | [
"0.6968034",
"0.69003",
"0.67271745",
"0.6662049",
"0.6568326",
"0.6507587",
"0.65042585",
"0.6424119",
"0.64216846",
"0.6371305",
"0.6371305",
"0.63510054",
"0.6317743",
"0.6317743",
"0.6300685",
"0.6263536",
"0.62299037",
"0.62297136",
"0.6223888",
"0.62047946",
"0.6171944"... | 0.0 | -1 |
PATCH/PUT /trips/1 or /trips/1.json | def update
respond_to do |format|
if @itinerary.update(itinerary_params)
format.html { redirect_to @itinerary, notice: "Itinerary was successfully updated." }
format.json { render :show, status: :ok, location: @itinerary }
else
format.html { render :edit, status: :unp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n... | [
"0.6774224",
"0.6749246",
"0.6749246",
"0.6738994",
"0.6732593",
"0.65848625",
"0.6527355",
"0.6527355",
"0.65194947",
"0.65178245",
"0.6499068",
"0.6486496",
"0.6458981",
"0.64549184",
"0.64225495",
"0.64023745",
"0.6402264",
"0.6402264",
"0.6402264",
"0.6402264",
"0.6402264... | 0.0 | -1 |
DELETE /trips/1 or /trips/1.json | def destroy
@itinerary.destroy
respond_to do |format|
format.html { redirect_to itineraries_url, notice: "Itinerary was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to find_trips_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @trip = Trips.find_trip( params[ :id ])\n end",
"def destroy\n @trip = Trip.find(par... | [
"0.730204",
"0.7236177",
"0.7178437",
"0.7178437",
"0.7178437",
"0.7168813",
"0.7168813",
"0.70904976",
"0.7089029",
"0.7089029",
"0.7089029",
"0.70620096",
"0.70620096",
"0.70620096",
"0.7033504",
"0.7026715",
"0.6983625",
"0.6841827",
"0.6814147",
"0.6737534",
"0.6729836",
... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_itinerary
@itinerary = Itinerary.friendly.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 list of trusted parameters through. | def itinerary_params
params.require(:itinerary).permit(:which_team, :airline, :flight_number, :arrival, :depart, :transportation, :user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Read the monotonic clock. It avoid horrors of leap seconds and NTP. | def clock_time
Process.clock_gettime(Process::CLOCK_MONOTONIC)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monotonic_now\n Process.clock_gettime(Process::CLOCK_MONOTONIC)\n end",
"def monotonic_timestamp\n return nil unless @ctx.key?(:monotonic_ts)\n @monotonic_timestamp ||= Time.at(0, @ctx[:monotonic_ts].first)\n end",
"def system_clock_tick\n @@system_clock_tick ||= LibC::sysco... | [
"0.69306725",
"0.59026",
"0.5888831",
"0.5611865",
"0.5534751",
"0.5534751",
"0.54006004",
"0.53512347",
"0.5148812",
"0.51423776",
"0.5127355",
"0.5113809",
"0.5073027",
"0.5072517",
"0.50038266",
"0.493953",
"0.49384087",
"0.4881293",
"0.48585743",
"0.48565078",
"0.48515856... | 0.5866352 | 3 |
returns an array of paths which can be used to get ticket messages or to dive further down and get the attachments | def get_ticket_message_entries ticket_no
if( ticket_no.is_a?( ARINcli::Registration::Ticket ) )
ticket_no = ticket_no.ticket_no
end
ticket_area = prepare_ticket_area(ticket_no)
retval = []
dir = Dir.new( ticket_area )
dir.each do |file_name|
retval << ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attachments\n parts.attachments\n end",
"def client_attachments\n self.messages.where(location_submitted: Message::CLIENT_EMAIL_LOCATIONS).collect { |message| message.attachments }.flatten\n end",
"def attachments\n @attachments ||= []\n end",
"def attachments\n mail&.attachmen... | [
"0.7024851",
"0.69186354",
"0.6886219",
"0.6818571",
"0.6811438",
"0.67893034",
"0.67893034",
"0.67893034",
"0.6780056",
"0.6761101",
"0.67601305",
"0.6727686",
"0.66483545",
"0.6580347",
"0.657486",
"0.64612746",
"0.6434715",
"0.63974935",
"0.63801587",
"0.6347469",
"0.63300... | 0.67106324 | 12 |
GET /zip_files GET /zip_files.json | def index
@zip_files = ZipFile.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def files\n return @files if @files and not @files.empty?\n\n @files = []\n\n each_zip_entry do |entry|\n @files << entry.name\n end\n\n @files\n end",
"def show\n @zip_upload = ZipUpload.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json... | [
"0.70388246",
"0.65555924",
"0.65430516",
"0.6484254",
"0.6458376",
"0.63963485",
"0.6367111",
"0.62707835",
"0.6238929",
"0.6231816",
"0.6149236",
"0.6147227",
"0.61443067",
"0.6112649",
"0.6073191",
"0.6060533",
"0.604945",
"0.59890074",
"0.5984347",
"0.5983065",
"0.5980798... | 0.7300466 | 0 |
GET /zip_files/1 GET /zip_files/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @zip_files = ZipFile.all\n end",
"def show\n @zip_upload = ZipUpload.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zip_upload }\n end\n end",
"def get_zip_file\n string = response.body\n pseudo_file = Tempfile.... | [
"0.71437573",
"0.70150703",
"0.6540065",
"0.6509208",
"0.6496414",
"0.64325815",
"0.6242403",
"0.62351346",
"0.62032366",
"0.61959535",
"0.61137444",
"0.61105543",
"0.6078646",
"0.6006791",
"0.597376",
"0.5932328",
"0.59032923",
"0.5883114",
"0.58740973",
"0.5870531",
"0.5864... | 0.0 | -1 |
POST /zip_files POST /zip_files.json | def create
@zip_file = ZipFile.new(zip_file_params)
@zip_file.save!
redirect_to admin_zip_files_path
#respond_to do |format|
# if @zip_file.save
# format.html { redirect_to @zip_file, notice: 'Zip file was successfully created.' }
# format.json { render :show, status: :created, locati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zip_download\n download_zip_file if request.post?\n end",
"def create\n zip.attributes = zip_params\n\n respond_to do |format|\n if zip.save\n format.html { redirect_to admin_zips_path, notice: 'Zip was successfully created.' }\n format.json { render :show, status: :created, loca... | [
"0.64725775",
"0.6357627",
"0.634178",
"0.6245829",
"0.6163593",
"0.6137411",
"0.61245793",
"0.6073483",
"0.60206527",
"0.60152686",
"0.59939635",
"0.5992899",
"0.5939192",
"0.58830816",
"0.58771944",
"0.5847421",
"0.58425224",
"0.58410275",
"0.58311594",
"0.5810566",
"0.5808... | 0.64643234 | 1 |
PATCH/PUT /zip_files/1 PATCH/PUT /zip_files/1.json | def update
@zip_file.update(zip_file_params)
redirect_to admin_zip_files_path
#respond_to do |format|
# if @zip_file.update(zip_file_params)
# format.html { redirect_to @zip_file, notice: 'Zip file was successfully updated.' }
# format.json { render :show, status: :ok, location: @zip_file... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @zip_upload = ZipUpload.find(params[:id])\n respond_to do |format|\n if @zip_upload.update_attributes(params[:zip_upload])\n format.html { redirect_to @zip_upload, notice: 'Zip upload was successfully updated.' }\n format.json { head :ok }\n else\n format.html { re... | [
"0.67199063",
"0.6453671",
"0.61826885",
"0.6104557",
"0.5935183",
"0.5924085",
"0.5895551",
"0.58205247",
"0.57944775",
"0.57708603",
"0.5732908",
"0.57245636",
"0.570296",
"0.56851053",
"0.56749684",
"0.5664164",
"0.5661961",
"0.5659141",
"0.56272215",
"0.56162506",
"0.5574... | 0.640223 | 2 |
DELETE /zip_files/1 DELETE /zip_files/1.json | def destroy
@zip_file.destroy
redirect_to admin_zip_files_path
#respond_to do |format|
# format.html { redirect_to zip_files_url, notice: 'Zip file was successfully destroyed.' }
# format.json { head :no_content }
#end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @zip_upload = ZipUpload.find(params[:id])\n @zip_upload.destroy\n\n respond_to do |format|\n format.html { redirect_to zip_uploads_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @zip = Zip.find(params[:id])\n current_user.vendor.zips.find(@zip).destroy\n\... | [
"0.7450016",
"0.7104363",
"0.709719",
"0.707212",
"0.673305",
"0.67247987",
"0.66545045",
"0.6630526",
"0.6594004",
"0.6583329",
"0.65243506",
"0.65112543",
"0.6511045",
"0.64934367",
"0.64360225",
"0.64126474",
"0.6409298",
"0.6409298",
"0.6363397",
"0.63552994",
"0.63491553... | 0.71348464 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_zip_file
@zip_file = ZipFile.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 zip_file_params
params.require(:zip_file).permit!
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 /credits/1 GET /credits/1.json | def show
@credit = Credit.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @credit }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credit\n handle_response(get(\"/credit.json\"))\n end",
"def credits\n return nil unless have_key?\n url = \"/v1/credits\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end",
"def credit\n handle_response(self.class.get(\"/credit.jso... | [
"0.7978349",
"0.7758969",
"0.7725789",
"0.74512076",
"0.700334",
"0.700334",
"0.6916776",
"0.6887186",
"0.68461686",
"0.6713434",
"0.6667245",
"0.66103184",
"0.66103184",
"0.65994763",
"0.657797",
"0.657797",
"0.65630156",
"0.6554851",
"0.65454125",
"0.6479826",
"0.6463105",
... | 0.7171683 | 4 |
GET /credits/new GET /credits/new.json | def new
@credit = Credit.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @credit }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @credit = Credit.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @credit }\n end\n end",
"def new\n @credito = Credito.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @credito }\n end\... | [
"0.7947493",
"0.7594115",
"0.7529858",
"0.74306",
"0.7387378",
"0.7287117",
"0.7276232",
"0.7261587",
"0.7261587",
"0.7254972",
"0.72525704",
"0.72437334",
"0.7231357",
"0.7207922",
"0.71796054",
"0.7159447",
"0.7143854",
"0.7110103",
"0.70971644",
"0.7084705",
"0.7084705",
... | 0.7954711 | 1 |
POST /credits POST /credits.json | def create
@credit = Credit.new(params[:credit])
respond_to do |format|
if @credit.save
format.html { redirect_to @credit, notice: 'Credit was successfully created.' }
format.json { render json: @credit, status: :created, location: @credit }
else
format.html { render action:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credits\n authenticated_post(\"credits\").body\n end",
"def credits\n return nil unless have_key?\n url = \"/v1/credits\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end",
"def credit\n handle_response(get(\"/credit.json\"))\n e... | [
"0.80405635",
"0.7712409",
"0.7600873",
"0.72534555",
"0.6818945",
"0.67689764",
"0.6623953",
"0.6606297",
"0.660368",
"0.660368",
"0.65946996",
"0.6552097",
"0.64766794",
"0.64505166",
"0.6425787",
"0.63636994",
"0.6344961",
"0.6336764",
"0.6335841",
"0.628641",
"0.62817174"... | 0.6953711 | 4 |
PUT /credits/1 PUT /credits/1.json | def update
@credit = Credit.find(params[:id])
respond_to do |format|
if @credit.update_attributes(params[:credit])
format.html { redirect_to @credit, notice: 'Credit was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_credits(person_id, uri_person)\n credits = get_credits_for_person_with_id person_id\n update_casts credits, uri_person\n update_crews credits, uri_person\n end",
"def update\n puts ('entro al update')\n @credit_line = CreditLine.find(params[:id])\n\n respond_to do |format|\n if... | [
"0.63922036",
"0.63810563",
"0.63399523",
"0.6339642",
"0.63187367",
"0.63013893",
"0.62857574",
"0.6263671",
"0.6247993",
"0.6236971",
"0.6215787",
"0.62041944",
"0.6170852",
"0.61670744",
"0.61569333",
"0.6151889",
"0.613934",
"0.6130367",
"0.6087454",
"0.60743064",
"0.6067... | 0.6839425 | 1 |
DELETE /credits/1 DELETE /credits/1.json | def destroy
@credit = Credit.find(params[:id])
@credit.destroy
respond_to do |format|
format.html { redirect_to credits_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @credito = Credito.find(params[:id])\n @credito.destroy\n\n respond_to do |format|\n format.html { redirect_to creditos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_credit.destroy\n respond_to do |format|\n format.html { redirect_to u... | [
"0.7236378",
"0.71634185",
"0.7084149",
"0.7061531",
"0.7051977",
"0.6946125",
"0.68794876",
"0.6863842",
"0.6827741",
"0.67924446",
"0.67663753",
"0.67549556",
"0.67549556",
"0.6739523",
"0.67294747",
"0.67202526",
"0.6696017",
"0.6694155",
"0.66927576",
"0.66909415",
"0.668... | 0.7571508 | 2 |
Compare table values against the expected_models' methods Use '' as a wild card. Assumes: Header = method name the first column in each row is the default identifier for that row. | def assert_models(expected_models, table, should_not = false)
model_klass = expected_models.first && expected_models.first.class.base_class rescue expected_models.first.class
map_table_columns!(table)
rows = map_table_headers(table).hashes
if should_not
expected_models.count.should_not == rows.size
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_header_names(key, models_columns, header)\n normalized_header = []\n\n got_error = false\n header.each_with_index do |h, i|\n logger.debug \"verify header: #{h}\"\n if h == \"id\"\n error(cur_sheet_name, 1, \"Header column #{h} not allowed, update not supported yet\")\n next\n end\... | [
"0.5748727",
"0.55671406",
"0.55054456",
"0.5457578",
"0.53054047",
"0.5279908",
"0.52242625",
"0.510453",
"0.5089284",
"0.50743115",
"0.5019622",
"0.5017546",
"0.5006638",
"0.49673736",
"0.49566275",
"0.4954797",
"0.4922563",
"0.48822144",
"0.48707741",
"0.48599586",
"0.4816... | 0.6228453 | 0 |
polymorphic associations are handled during 'assign_to_parent' | def create_requested_model_associations(model_under_test, association_quantity, requested_association_name, array_of_requested_params = [], default_params = {})
model = model_under_test.class
association_model = requested_model_to_model(requested_association_name)
association_name = model_to_association_method(r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_orphans_to_parent\n orphan_questions = Question.where(qset_id: self.id)\n orphan_questions.update_all(qset_id: self.parent.id)\n end",
"def attach parent\n\n # the ordinary *able table\n parent.send( self.class.to_s.underscore.pluralize) << self\n\n # case child.class.to_s\n # when \"... | [
"0.6612903",
"0.6602529",
"0.64132255",
"0.63825923",
"0.63703126",
"0.6303668",
"0.6277083",
"0.6242256",
"0.6226255",
"0.6149494",
"0.61409724",
"0.6140454",
"0.6122733",
"0.6088995",
"0.60605013",
"0.60547644",
"0.60456306",
"0.6038107",
"0.6020963",
"0.6017528",
"0.601394... | 0.0 | -1 |
converts model or model name to symbol for factory Examples: image > :image Image > :image Images > :image Images(for scene A) > :image_for_scene_a | def model_to_factory_symbol(model_or_name)
model_name =
case model_or_name
when /^(.+)[(](.+)[)]$/ #handle model(with associations), model(for scene A)
model_name = $1.singularize
factory_suffix = $2
"#{model_name}_#{factory_suffix}"
when String
model_or_name
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_sym() name_singular.to_sym end",
"def ar_model_symbol\n ar_model.to_s.underscore.gsub(/\\//, '_')\n end",
"def model(name)\n name.gsub(/\\W+/, '_').classify.constantize\n end",
"def model_name_to_constant(name)\n name = name.gsub(/_/,' ') if name =~ /_/ # convert <underscore> to <sp... | [
"0.658688",
"0.6358166",
"0.6189221",
"0.6154767",
"0.6109847",
"0.6109847",
"0.60959166",
"0.60669863",
"0.5957911",
"0.5952796",
"0.591032",
"0.58872944",
"0.58647686",
"0.58572185",
"0.5855119",
"0.5842899",
"0.583473",
"0.5817153",
"0.57590795",
"0.57536787",
"0.57308435"... | 0.8227879 | 0 |
converts model or model name to association method Examples: image > .image Image > .image Images > .images Images(for scene A) > .images.for_scene_a | def model_to_association_method(model_or_name, include_scope = false)
requested_association =
case model_or_name
when /^(.+)[(](.+)[)]$/ #handle model(with associations), i.e. Image(for scene A)
association = $1
scope = $2
include_scope ? "#{association}.#{scope}" : association
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def association_method\n self[:name]\n end",
"def association_method\n self[:name]\n end",
"def association(association_name); end",
"def model_association_name\n full_implementation_class_name.pluralize.ns_underscore.to_sym\n end",
"def association\n @association ||= m... | [
"0.6760944",
"0.6702833",
"0.652018",
"0.6249399",
"0.61681825",
"0.602417",
"0.6008021",
"0.60045743",
"0.5987373",
"0.5938857",
"0.59347606",
"0.5922746",
"0.58364165",
"0.58236694",
"0.57796866",
"0.5760281",
"0.5760281",
"0.5723444",
"0.56993985",
"0.56569284",
"0.5628099... | 0.8023893 | 0 |
Retrieves requested models examples: image > Image.all Image > Image.all Images > Image.all Images(for scene A) > Image.for_scene_a Images(active, for scene A) > Image.active.for_scene_a | def requested_models(requested_model)
case requested_model
when /^(.+)[(](.+)[)]$/ #handle model(with associations), i.e. Image(for scene A)
base_model = $1.classify.constantize
scopes = $2.split(',')
models = base_model
scopes.each do |scope|
models = models.send(scope.strip)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end",
"def image_models\n @image_models ||= []\n end",
"def images_across_projs\n # return a list of Images (only) that are linked through Imag... | [
"0.6016173",
"0.5997089",
"0.5774087",
"0.57055837",
"0.5640873",
"0.5636965",
"0.55976313",
"0.5583039",
"0.5557906",
"0.5525779",
"0.55164266",
"0.54994994",
"0.54886216",
"0.5480135",
"0.5471422",
"0.5463839",
"0.54557085",
"0.545143",
"0.54494613",
"0.5431478",
"0.5425020... | 0.63177615 | 0 |
TODO: extract concept for these | def requested_model_to_model(requested_model)
#move "cases" to mpr_model_steps.
case requested_model
when /^Site[s]?$/i, /^PhosphorylationSite[s]?$/i
return StySiteAbstractGene
when /^(.+)[(](.+)[)]$/ #handle model(with associations), model(for scene a)
return requested_model_to_model($1)
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def private; end",
"def requirements=(_arg0); end",
"def requirements=(_arg0); end",
"def anatomy; end",
"def alter... | [
"0.65520525",
"0.65520525",
"0.65520525",
"0.65520525",
"0.62607324",
"0.62607324",
"0.62607324",
"0.62607324",
"0.62279254",
"0.5910273",
"0.5910273",
"0.589049",
"0.5881138",
"0.58661103",
"0.58621967",
"0.58553475",
"0.5837275",
"0.58332783",
"0.5804879",
"0.5800821",
"0.5... | 0.0 | -1 |
GET /company_profiles/1 GET /company_profiles/1.xml | def show
@company_profile = CompanyProfile.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @company_profile }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @companyprofile = Companyprofile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @companyprofile }\n end\n end",
"def xml_query_profile(xml) \n if current_user \n profile_name = (xml.root.get_elements('AccessProfile'... | [
"0.7227339",
"0.65279436",
"0.65097564",
"0.64792335",
"0.64728475",
"0.6425611",
"0.6358879",
"0.6358879",
"0.6358879",
"0.6328001",
"0.6287046",
"0.62733024",
"0.626747",
"0.6249472",
"0.619188",
"0.61877507",
"0.6174874",
"0.6145769",
"0.6141887",
"0.61021847",
"0.6093941"... | 0.7215387 | 1 |
GET /company_profiles/new GET /company_profiles/new.xml | def new
@company_profile = CompanyProfile.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @company_profile }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @companyprofile = Companyprofile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @companyprofile }\n end\n end",
"def create\n @company_profile = CompanyProfile.new(params[:company_profile])\n\n respond_to do |format|\n if @compa... | [
"0.7831483",
"0.71922934",
"0.7191283",
"0.7191283",
"0.7191283",
"0.7175497",
"0.7147296",
"0.71299106",
"0.7027078",
"0.6987584",
"0.6987584",
"0.6987584",
"0.6987584",
"0.6987584",
"0.6987584",
"0.6987584",
"0.69821453",
"0.6940981",
"0.6845691",
"0.6752139",
"0.67394924",... | 0.7775701 | 1 |
POST /company_profiles POST /company_profiles.xml | def create
@company_profile = CompanyProfile.new(params[:company_profile])
respond_to do |format|
if @company_profile.save
format.html { redirect_to(@company_profile, :notice => 'Company profile was successfully created.') }
format.xml { render :xml => @company_profile, :status => :creat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @companyprofile = Companyprofile.new(params[:companyprofile])\n\n respond_to do |format|\n if @companyprofile.save\n format.html { redirect_to(@companyprofile, :notice => 'Companyprofile was successfully created.') }\n format.xml { render :xml => @companyprofile, :status => :... | [
"0.6656345",
"0.6009561",
"0.5917743",
"0.57936656",
"0.5787355",
"0.572783",
"0.5706073",
"0.56895405",
"0.568834",
"0.5663628",
"0.5663628",
"0.5663628",
"0.565777",
"0.56572306",
"0.56551665",
"0.5626855",
"0.56053525",
"0.5600756",
"0.5560819",
"0.5526227",
"0.55145407",
... | 0.6700856 | 0 |
PUT /company_profiles/1 PUT /company_profiles/1.xml | def update
@company_profile = CompanyProfile.find(params[:id])
respond_to do |format|
if @company_profile.update_attributes(params[:company_profile])
format.html { redirect_to(@company_profile, :notice => 'Company profile was successfully updated.') }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @companyprofile = Companyprofile.find(params[:id])\n\n respond_to do |format|\n if @companyprofile.update_attributes(params[:companyprofile])\n format.html { redirect_to(@companyprofile, :notice => 'Companyprofile was successfully updated.') }\n format.xml { head :ok }\n ... | [
"0.6950503",
"0.6227196",
"0.6126274",
"0.60166025",
"0.59470147",
"0.5927965",
"0.59234214",
"0.59234214",
"0.5896286",
"0.58943206",
"0.586598",
"0.58605015",
"0.5854586",
"0.58389974",
"0.58343375",
"0.5814952",
"0.579686",
"0.5785544",
"0.57669",
"0.5755371",
"0.57541317"... | 0.7036037 | 0 |
DELETE /company_profiles/1 DELETE /company_profiles/1.xml | def destroy
@company_profile = CompanyProfile.find(params[:id])
@company_profile.destroy
respond_to do |format|
format.html { redirect_to(company_profiles_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @companyprofile = Companyprofile.find(params[:id])\n @companyprofile.destroy\n\n respond_to do |format|\n format.html { redirect_to(companyprofiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_company_profile.destroy\n respond_to do |format|\n ... | [
"0.73067397",
"0.66506755",
"0.6533467",
"0.65088433",
"0.65088433",
"0.6469245",
"0.6429469",
"0.6429469",
"0.6429469",
"0.6429469",
"0.6429469",
"0.6383287",
"0.63570225",
"0.6330232",
"0.63250744",
"0.6321028",
"0.6317302",
"0.6313199",
"0.630504",
"0.6298451",
"0.6284608"... | 0.7300061 | 1 |
GET /ships GET /ships.json | def index
@ships = Ship.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @clientships = current_user.clientships.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientships }\n end\n end",
"def show\n @clientship = current_user.clientships.find(params[:id]) \n\n respond_to do |format|\n form... | [
"0.72493356",
"0.71349585",
"0.7048503",
"0.70205504",
"0.6938064",
"0.68856764",
"0.68455976",
"0.6726377",
"0.65500593",
"0.65224373",
"0.6480991",
"0.64778113",
"0.6474911",
"0.64569885",
"0.64404064",
"0.6409889",
"0.63631004",
"0.6357567",
"0.634412",
"0.6324745",
"0.630... | 0.7506376 | 1 |
GET /ships/1 GET /ships/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @clientship = current_user.clientships.find(params[:id]) \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientship }\n end\n end",
"def index\n @ships = Ship.all\n end",
"def index\n @ships = Ship.all\n end",
"def show\n @s... | [
"0.7293898",
"0.7271398",
"0.7271398",
"0.72482324",
"0.71218574",
"0.7011341",
"0.68805856",
"0.68385285",
"0.6747988",
"0.6711098",
"0.667679",
"0.65856063",
"0.65781397",
"0.6491383",
"0.6468603",
"0.6467482",
"0.645546",
"0.6389678",
"0.6338788",
"0.6324014",
"0.62573224"... | 0.0 | -1 |
an array example => subsets([1,2,3]) should return => [ [], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3] ] | def subsets(array)
return [[]] if array.empty?
subs = subsets(array[0..-2])
subs.concat(subs.map{|el| el += [array.last]})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subsets(arr)\n return [arr] if arr.empty?\n # p arr\n # if arr.length == 1\n # return subsets(arr[0...0]) + [arr]\n # end\n\n arr.each {|ele| subsets(arr -[ele]) } + [arr]\nend",
"def subsets (arr)\n return [[]] if arr.length == 0\n\n interim = subsets(arr[0...-1])\n interim + interim.map do |el|\... | [
"0.8834806",
"0.8796639",
"0.87819636",
"0.8746261",
"0.87430614",
"0.8733877",
"0.8693241",
"0.8665394",
"0.8652075",
"0.863972",
"0.86356515",
"0.8633867",
"0.8604684",
"0.8604684",
"0.8604684",
"0.8594861",
"0.85754555",
"0.85413504",
"0.8535079",
"0.8532832",
"0.8529189",... | 0.84658927 | 23 |
Min out getter, setter | def min_out
@min_out ||= time_out.min
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getters; end",
"def setter_to_getter(node); end",
"def name\n return @name\nend\ndef age\n return @age\nend\n#setters, allows you to change or set something\ndef name=(name)\n @name = name\nend",
"def real_mined_reader\n @real_mined\n end",
"def to_getter\n\t\t\t\tis_setter? ? self.to_s[0...-1].... | [
"0.7018374",
"0.64786464",
"0.64654946",
"0.6345078",
"0.62167835",
"0.60799766",
"0.60372263",
"0.6015371",
"0.6015371",
"0.6015371",
"0.6015371",
"0.6015371",
"0.6015371",
"0.6015371",
"0.60120744",
"0.5953515",
"0.59390235",
"0.5931754",
"0.5928001",
"0.5920789",
"0.591402... | 0.0 | -1 |
Hour out getter, setter | def hour_out
@hour_out ||= time_out.hour
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hour() end",
"def hour\n @hour\n end",
"def getHour\r\n\t\t\t\t\treturn @hour\r\n\t\t\t\tend",
"def hour\n self.range('hour')\n end",
"def hour\n hour? ? at_hour : super\n end",
"def hour\n return @t_hour\n end",
"def hour\n return self.to_a[IDX_HOUR]\n end",
"def hour... | [
"0.8212067",
"0.81573576",
"0.7953101",
"0.7950995",
"0.7926818",
"0.78646135",
"0.7777153",
"0.77649194",
"0.77292526",
"0.76675844",
"0.76659787",
"0.7647337",
"0.7615457",
"0.75850564",
"0.75850564",
"0.75850564",
"0.758265",
"0.74879754",
"0.7388814",
"0.7370754",
"0.7368... | 0.7268842 | 24 |
Min in getter, setter | def min_in
@min_in ||= time_in.min
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_min\n @min\n end",
"def get_min()\n @min \n end",
"def get_min()\n @min\n end",
"def get_min\n @min ||= calculate_min\n end",
"def get_min()\n end",
"def min\n @min || 0;\n end",
"def min() end",
"def find_min()\r\n self.min\r\n end",
"def min; end",
"def... | [
"0.8311966",
"0.8224512",
"0.8083314",
"0.80140305",
"0.7897258",
"0.7861903",
"0.7838699",
"0.7821895",
"0.7795189",
"0.7795189",
"0.7757752",
"0.7757752",
"0.76501495",
"0.7638427",
"0.7596478",
"0.7515577",
"0.75135845",
"0.75053674",
"0.7460477",
"0.7460024",
"0.74324244"... | 0.0 | -1 |
Hour in getter, setter | def hour_in
@hour_in ||= time_in.hour
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hour\n @hour\n end",
"def hour() end",
"def getHour\r\n\t\t\t\t\treturn @hour\r\n\t\t\t\tend",
"def hour\n self.range('hour')\n end",
"def hour\n return @t_hour\n end",
"def setHour(hour)\r\n\t\t\t\t\t@hour = hour\r\n\t\t\t\tend",
"def hour\n hour? ? at_hour : super\n end",
... | [
"0.83089715",
"0.8116482",
"0.8091365",
"0.80558324",
"0.7908964",
"0.78868777",
"0.7883469",
"0.7788586",
"0.77625567",
"0.77305293",
"0.77305293",
"0.77305293",
"0.7690534",
"0.76838934",
"0.7682432",
"0.7658554",
"0.7653748",
"0.75599545",
"0.74821365",
"0.74163526",
"0.73... | 0.71963286 | 28 |
Before_update actions Sets the new times | def set_new_time
@dt_in = time_in.to_datetime
update_column(:time_in, @dt_in.change(hour: hour_in.to_i, min: min_in.to_i))
@dt_out = time_out.to_datetime
update_column(:time_out, @dt_out.change(hour: hour_out.to_i, min: min_out.to_i))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_times\n\t\t@today = Time.now\n\t\t@current_start_day = @today - MONTH\n\t\t@previous_start_day = @current_start_day - MONTH\n\tend",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @update_time = args[:update_time] if args.key?(:update_time)\n ... | [
"0.686645",
"0.67991525",
"0.67991525",
"0.67991525",
"0.67991525",
"0.67991525",
"0.67991525",
"0.67991525",
"0.67991525",
"0.67991525",
"0.67883307",
"0.67092836",
"0.67053396",
"0.6704344",
"0.66870517",
"0.6668968",
"0.66420054",
"0.6556156",
"0.6549277",
"0.6542426",
"0.... | 0.6265758 | 72 |
Method used to show upcoming events in footer partial | def upcoming_events
[] || Event.where('event_start_date > :date AND event_end_date > :date AND status = :status', {date: Time.now.strftime('%Y-%m-%d'), status: Event.statuses.ready}).limit(3)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upcoming_events\n @events = Event.upcoming\n respond_to do |format|\n format.html { render :partial=>\"home/upcoming_events\", :locals=>{:upcoming_events=>@events} }\n format.json { render :layout => false, :json => @events }\n format.js\n end\n end",
"def index\n\n ... | [
"0.69239056",
"0.66187626",
"0.65922165",
"0.6418393",
"0.6392148",
"0.63547444",
"0.6343961",
"0.63263434",
"0.63188124",
"0.63112944",
"0.6261688",
"0.6261667",
"0.6261497",
"0.6247275",
"0.62239546",
"0.6217385",
"0.6214997",
"0.6203997",
"0.62038547",
"0.6200436",
"0.6177... | 0.0 | -1 |
blank out the setting | def blank_out
self.write_attribute(:value, nil )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setting; end",
"def clear\r\n self.value = \"\"\r\n end",
"def reset_defaults; end",
"def compact_blank; end",
"def clear\n reset_defaults\n self\n end",
"def reset!\n defaults = Settler.config[self.key]\n self.label = defaults['label']\n self.value =... | [
"0.63577485",
"0.61656934",
"0.6121718",
"0.61147225",
"0.6107345",
"0.6052616",
"0.60466146",
"0.6022868",
"0.6015686",
"0.6010618",
"0.5938551",
"0.59155387",
"0.58992016",
"0.58680207",
"0.5854061",
"0.5846722",
"0.5846722",
"0.5845104",
"0.58365726",
"0.5826533",
"0.58265... | 0.7006824 | 0 |
Add logic to run before the tests (i.e., a +setup+ method) before do | def before(period = :each, &block)
unless block_given?
block = period
period = :each
end
send("before_#{period}_callbacks") << block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(&block)\n before(:each, &block)\n end",
"def before_setup\n # do nothing by default\n end",
"def before_test(test); end",
"def before_test(test); end",
"def before_setup; end",
"def setup\n # noop\n end",
"def pre_setup_suite()\n @cfg['pre_setup'] =\"def... | [
"0.80319643",
"0.7966879",
"0.7754928",
"0.7754928",
"0.7742271",
"0.74577636",
"0.7430723",
"0.74236095",
"0.7338405",
"0.7304304",
"0.7261116",
"0.7260892",
"0.7229337",
"0.72120667",
"0.7208563",
"0.7161938",
"0.715216",
"0.715216",
"0.715216",
"0.715216",
"0.715216",
"0... | 0.0 | -1 |
Add logic to run after the tests (i.e., a +teardown+ method) after do User.delete_all end | def after(period = :each, &block)
unless block_given?
block = period
period = :each
end
send("after_#{period}_callbacks") << block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def teardown\n User.delete_all\n end",
"def teardown\n PersistentUser.new(TEST_USER).delete\n Time.use_system_time\n clear_change_log\n end",
"def teardown\n remove_user :login_id => @user.login_id\n end",
"def destroy_all_test_users\n test_users.each(&:destroy)\n ... | [
"0.83570355",
"0.73149467",
"0.72839516",
"0.7261965",
"0.72034967",
"0.7115337",
"0.7011971",
"0.69521165",
"0.69503057",
"0.69460016",
"0.6942773",
"0.69030964",
"0.6878691",
"0.682702",
"0.6761522",
"0.67601764",
"0.67601764",
"0.67601764",
"0.67601764",
"0.6744156",
"0.66... | 0.0 | -1 |
Wait until the subject's commit thread is done executing (if it exists). | def wait_for_commit(subject, expect_thread=false, commit_timeout=5)
queue = subject.get_queue
unless expect_thread
return if queue.commit_status != :running and queue.processed?
end
until queue.commit_unscheduled? and queue.processed?(true) or (queue.commit_status == :success and queue.processed?)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait; end",
"def wait; end",
"def wait; end",
"def tx_commit\n write_bytes FrameBytes.tx_commit(@id)\n expect :tx_commit_ok\n nil\n end",
"def wait\n if job = @queue.last\n EM::Synchrony.sync(job.request)\n EM::Synchrony.sync(job.response.body) if job.resp... | [
"0.6231241",
"0.6231241",
"0.6231241",
"0.621469",
"0.6152118",
"0.61514777",
"0.6139485",
"0.6125973",
"0.6068436",
"0.6068436",
"0.605771",
"0.60058075",
"0.59878355",
"0.5985477",
"0.59711134",
"0.59593284",
"0.59274614",
"0.5925313",
"0.5900975",
"0.5895772",
"0.5895772",... | 0.8039634 | 0 |
Initializes a DomoClient object from our test settings | def get_domo_client(test_settings)
client_config = Java::ComDomoSdkRequest::Config.with
.clientId(test_settings["client_id"])
.clientSecret(test_settings["client_secret"])
.apiHost("api.domo.com")
.useHttps(true)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n @client = @@client\n end",
"def initialize(nsx_client)\n super(nsx_client)\n # Construct base URLs\n @base_url = NSXConstants::NSXT_DFW_BASE\n @url_sections = @base_url + \\\n NSXConstants::NSXT_DFW_SECTIONS\n ... | [
"0.63960576",
"0.61280096",
"0.6117446",
"0.6111944",
"0.60970956",
"0.6034159",
"0.59819347",
"0.5974625",
"0.596697",
"0.5958078",
"0.59492904",
"0.59474295",
"0.59075713",
"0.59063864",
"0.59063864",
"0.58786225",
"0.58531874",
"0.5824331",
"0.58126175",
"0.5808426",
"0.58... | 0.7685493 | 0 |
Gets a Domo Stream by DatasetID | def get_stream(domo_client, dataset_id)
stream_list = domo_client.streamClient.java_method :list, [Java::int, Java::int]
limit = 500
offset = 0
stream = nil
# Loop through the Streams List endpoint until we find one matching our DatasetID
results = stream_list.call(limit, offset)
until resu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_datastream( pid, dsID )\n repository.find(pid).datastreams[dsID].content\n end",
"def get_datastream( pid, dsID )\n pid.include?(\"druid\") ? pid = pid : pid = \"druid:#{pid}\"\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID + '/content') \n RestClient.... | [
"0.7795436",
"0.72379524",
"0.6489067",
"0.5968908",
"0.5831644",
"0.5748258",
"0.57252365",
"0.5684556",
"0.55649775",
"0.55442446",
"0.54990137",
"0.5477324",
"0.54765224",
"0.54675066",
"0.54510945",
"0.54203874",
"0.53911096",
"0.5364753",
"0.5360594",
"0.53589046",
"0.53... | 0.8000621 | 0 |
Create the test Dataset | def bootstrap_dataset(domo_client, upload_timestamp=nil, partition_field=nil)
dsr = CreateDataSetRequest.new
dsr.setName "logstash-output-domo rspec test"
dsr.setDescription "Created by the rspec tests for the logstash-output-domo plugin"
dsr.setSchema(Schema.new(test_dataset_columns(upload_timestamp, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_from_data\n data = @test_record.all_text\n \n creation_test do |record|\n record.create_from_data('', data)\n end\n end",
"def build!(data_set_name)\n interface(data_set_name).create_empty_data_set\n library[data_set_name] = DataSet.new(data... | [
"0.70912963",
"0.67108417",
"0.6529418",
"0.64166343",
"0.6371639",
"0.6342148",
"0.63208735",
"0.62656945",
"0.6246216",
"0.62141967",
"0.61334324",
"0.6118647",
"0.6048331",
"0.60280234",
"0.6018074",
"0.59896964",
"0.59894174",
"0.5989263",
"0.59891135",
"0.5982397",
"0.59... | 0.6049817 | 12 |
Throw out Event data keys that are not being passed to Domo. The values we keep also need to be coerced to Strings since the Dataset Export API sends back CSV data. | def event_to_domo_hash(event)
new_event = {}
event.to_hash.each do |k, v|
if v.is_a? LogStash::Timestamp
v = DateTime.parse(v.to_s)
v = v.strftime("%Y-%m-%d %H:%M:%S")
end
unless k == "@version" or k == "@timestamp"
if v.nil?
new_event[k] = nil
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_event_data(event)\n column_names = @dataset_columns.map { |col| col[:name] }\n encode_options = {\n :headers => column_names,\n :write_headers => false,\n :return_headers => false,\n }\n\n csv_data = CSV.generate(String.new, encode_options) do |csv_obj|\n data = eve... | [
"0.73949516",
"0.6530869",
"0.6445017",
"0.563482",
"0.5460413",
"0.544767",
"0.53839636",
"0.5372106",
"0.5284063",
"0.52738327",
"0.5265042",
"0.52579033",
"0.5255658",
"0.52172637",
"0.5213223",
"0.5213223",
"0.5213095",
"0.5193924",
"0.5125707",
"0.51246816",
"0.5119889",... | 0.6161087 | 3 |
Map the name of a header in CSV data to a Domo Dataset's columns. | def csv_header_to_column(columns, header)
col = columns.select do |col|
col.getName == header
end
return if col.nil? or col.length <= 0
col[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_headers(data)\n headers = { :types => [], :names => [] }\n\n data.map do |header|\n name = Utils.unprefix(header['name'])\n type = header['dataType'].downcase.to_sym\n type = :date if name == :date\n\n headers[:types] << type\n headers[:names] << name\n ... | [
"0.6474251",
"0.6443553",
"0.6341859",
"0.6256698",
"0.6234808",
"0.6121182",
"0.61091924",
"0.6015174",
"0.5960696",
"0.59425133",
"0.59205425",
"0.58695066",
"0.585778",
"0.58419067",
"0.580505",
"0.58011955",
"0.57947844",
"0.5755837",
"0.568762",
"0.56640077",
"0.5658946"... | 0.60940516 | 7 |
Convert CSV strings embedded in a QueueJob into a Hash | def job_data_to_hash(job, upload_timestamp=nil, partition_field=nil)
columns = test_dataset_columns(upload_timestamp, partition_field)
col_names = columns.map(&:getName)
data = job.data.map do |d|
CSV.parse(d)
end
data = Hash[col_names.zip(data.flatten)]
data.reduce({}) do |memo, (k,v)|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_jobs\r\n @jobs.scan(/([a-z]) => ([a-z]|)/).inject({}) do |jobs_hash, pair|\r\n jobs_hash[pair.first] = pair.last.empty? ? '' : pair.last\r\n jobs_hash\r\n end\r\n end",
"def meta_to_hash(str)\n key_pairs = str.split(',')\n h_kp = {}\n key_pairs.each do | ... | [
"0.5961313",
"0.59483385",
"0.5772148",
"0.5713572",
"0.56861496",
"0.5617221",
"0.5604423",
"0.5543981",
"0.55387634",
"0.55094486",
"0.5502577",
"0.54783636",
"0.5476542",
"0.5467552",
"0.54168373",
"0.54154074",
"0.540616",
"0.53566915",
"0.533344",
"0.533344",
"0.5328637"... | 0.6304396 | 0 |
Convert a Logstash event to a CSV string while honoring the Domo schema | def event_to_csv(event)
# Convert the event to a hash that only has fields from the Domo schema
event = event_to_domo_hash(event)
# Read the column names into an Array
column_names = test_dataset_columns.map { |c| c.name }
encode_options = {
:headers => column_names,
:write_headers ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_event_data(event)\n column_names = @dataset_columns.map { |col| col[:name] }\n encode_options = {\n :headers => column_names,\n :write_headers => false,\n :return_headers => false,\n }\n\n csv_data = CSV.generate(String.new, encode_options) do |csv_obj|\n data = eve... | [
"0.6642719",
"0.6031006",
"0.5881448",
"0.5880748",
"0.57761985",
"0.57562286",
"0.5753286",
"0.5737674",
"0.5702581",
"0.56300414",
"0.5587081",
"0.5556512",
"0.54263014",
"0.5416585",
"0.53602916",
"0.52828455",
"0.52598345",
"0.5245021",
"0.52033544",
"0.519779",
"0.519774... | 0.77008086 | 0 |
Export a Domo Dataset's data to a CSV parsed Hash. | def export_dataset(domo_client, dataset_id)
# Sometimes there's lag on the Domo API so we'll retry a couple of times instead of failing tests for no reason.
attempts = 0
data = nil
data_stream = nil
loop do
begin
# @type [IO]
data_stream = domo_client.dataSetClient.exportData(d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_csv\n self.data.to_csv\n end",
"def write_to_simple_csv(filename, data)\n\tfile = filename\n\tdata_for_csv = prep_hash_for_csv(data)\n\tCSV.open(HOME + file, \"wb\") do |csv|\n\t\tdata_for_csv.each do |line|\n\t\t\tcsv << line\n\t\tend\n\tend\nend",
"def save_as_csv\n CSV.open(\"./db/#{@name}... | [
"0.66134775",
"0.6492049",
"0.6491035",
"0.64579886",
"0.638492",
"0.6383899",
"0.6367503",
"0.6367503",
"0.6353203",
"0.6208122",
"0.6183912",
"0.61337626",
"0.6093907",
"0.6091249",
"0.6084404",
"0.6061476",
"0.6059161",
"0.60519564",
"0.60049224",
"0.59843993",
"0.5981068"... | 0.63440156 | 9 |
Check that the fields in the Dataset match the fields in our expected data | def dataset_field_match?(domo_client, dataset_id, expected_data)
data = export_dataset(domo_client, dataset_id)
return false unless data
if expected_data.is_a? Array
expected_data_row = expected_data[0]
else
expected_data_row = expected_data
end
if data.is_a? Array
data_row = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataset_data_match?(domo_client, dataset_id, expected_data, should_fail=false)\n data = export_dataset(domo_client, dataset_id)\n\n if data.nil?\n unless expected_data.nil?\n puts \"Got no data back from Domo.\"\n puts \"Expected data: #{expected_data}\"\n return false\n en... | [
"0.6948515",
"0.63130903",
"0.6172714",
"0.6143159",
"0.6128814",
"0.6106773",
"0.6045902",
"0.59054834",
"0.59013957",
"0.58745134",
"0.5868552",
"0.5864221",
"0.5861678",
"0.5816895",
"0.5787532",
"0.57634604",
"0.5757316",
"0.57061696",
"0.5704731",
"0.5701114",
"0.5701",
... | 0.7664684 | 0 |
Compare expected data to what's actually in the provided Domo Dataset. | def dataset_data_match?(domo_client, dataset_id, expected_data, should_fail=false)
data = export_dataset(domo_client, dataset_id)
if data.nil?
unless expected_data.nil?
puts "Got no data back from Domo."
puts "Expected data: #{expected_data}"
return false
end
return tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datasets_equal?(other)\n other.is_a?(Linkage::MetaObject) && other.dataset == self.dataset\n end",
"def dataset_field_match?(domo_client, dataset_id, expected_data)\n data = export_dataset(domo_client, dataset_id)\n return false unless data\n\n if expected_data.is_a? Array\n expected_da... | [
"0.6515766",
"0.6197799",
"0.60868967",
"0.6083853",
"0.6042563",
"0.5950026",
"0.5726583",
"0.5678802",
"0.56628966",
"0.5620013",
"0.54004335",
"0.53782654",
"0.5377493",
"0.5365722",
"0.53087515",
"0.52937603",
"0.52910936",
"0.5248933",
"0.5237858",
"0.52223533",
"0.52205... | 0.7250126 | 0 |
GET /m_oils/1 GET /m_oils/1.json | def show
@m_oil = MOil.find(params[:id])
@check_del_flg = params[:input_check].to_i
respond_to do |format|
format.html # show.html.erb
format.json { render json: @m_oil }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @soils = Soil.where(:field_id => session[:field_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @soils }\n end\n end",
"def index\n @omims = Omim.all\n end",
"def index\n @oils = Oil.all\n\n respond_to do |format|\n form... | [
"0.6372285",
"0.6300094",
"0.62915325",
"0.62151",
"0.6127628",
"0.6031393",
"0.60146075",
"0.60146075",
"0.60102504",
"0.5995475",
"0.59817433",
"0.5951364",
"0.59485245",
"0.5943163",
"0.59267896",
"0.59120864",
"0.5906565",
"0.58944476",
"0.58889604",
"0.5880784",
"0.58667... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.