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 |
|---|---|---|---|---|---|---|
Maps provider with a lightweight resource. | def map_resource(file)
file_handle = File.open(File.expand_path(file), 'r')
file_handle.readlines.each do |line|
if line =~ /#\s@resource/
resource_name = line.split(%r{@resource })[1].strip
@resource = ChefObject.register(RESOURCE, resource_name, :resource)
@resource.providers.push(self) unless @resource.providers.include?(self)
break
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provider; end",
"def map_resource(*args, &block)\n map_enclosing_resource(*args, &block)\n end",
"def test_initialize_finds_records\n prov = mkprovider\n prov.default_target = :yayness\n\n prov.target_object(:yayness).write \"bill a c\\njill b d\"\n\n prov.prefetch\n\n # Now make a r... | [
"0.619483",
"0.6116507",
"0.61114836",
"0.59024763",
"0.59022415",
"0.58697927",
"0.5845976",
"0.58332676",
"0.57967645",
"0.57821023",
"0.5757989",
"0.57547903",
"0.57504916",
"0.57383555",
"0.5731324",
"0.5731324",
"0.5731324",
"0.5731324",
"0.57086384",
"0.5698226",
"0.569... | 0.58592755 | 6 |
Actions implemented in the lightweight provider. | def actions
children_by_type(:action)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions; end",
"def run_actions; end",
"def provider; end",
"def action_hook; end",
"def add_actions; end",
"def handlers; end",
"def handlers; end",
"def handlers; end",
"def handler; end",
"def handler; end",
"def methods() end",
"def operations; end",
"def operations; end",
"def ac... | [
"0.6830602",
"0.68000126",
"0.6506426",
"0.64876336",
"0.6398637",
"0.6345477",
"0.6345477",
"0.6345477",
"0.6256118",
"0.6256118",
"0.6222472",
"0.62031734",
"0.62031734",
"0.6193786",
"0.6193786",
"0.6193786",
"0.6193786",
"0.6193786",
"0.61442804",
"0.6126431",
"0.61225235... | 0.0 | -1 |
Create a new Ruby extension with a given name. This name will be the actual name of the extension, e.g. you'll have name.so and you will call require 'name' when using your new extension. This constructor can be standalone or take a block. | def initialize(name, &block)
@name = name
@modules = []
@writer_mode = :multiple
@requesting_console = false
@force_rebuild = false
@options = {
:include_paths => [],
:library_paths => [],
:libraries => [],
:cxxflags => [],
:ldflags => [],
:include_source_files => [],
:includes => []
}
@node = nil
parse_command_line
if requesting_console?
block.call(self) if block
start_console
elsif block
build_working_dir(&block)
block.call(self)
build
write
compile
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_module(name, &block)\n mod = Module.new(&block)\n @managed.const_set(name, mod)\n mod\n end",
"def initialize(name)\n @path, @name = nil\n\n if File.directory?(name)\n @path, @name = name, File.basename(name)\n\n elsif Main.respond_to?(:extensions_path)\n ... | [
"0.6536697",
"0.64527035",
"0.6447034",
"0.6431908",
"0.63207275",
"0.6304655",
"0.62451303",
"0.62451303",
"0.62451303",
"0.6201769",
"0.6179208",
"0.61736387",
"0.61668783",
"0.61409473",
"0.6065675",
"0.60537136",
"0.60520977",
"0.60520977",
"0.5981832",
"0.59575945",
"0.5... | 0.58629173 | 30 |
Define where we can find the header files to parse Can give an array of directories, a glob, or just a string. All file names should be full paths, not relative. Options can be any or all of the following: :include_paths Path(s) to be added as I flags :library_paths Path(s) to be added as L flags :libraries Path(s) to be added as l flags :cxxflags Flag(s) to be added to command line for parsing / compiling :ldflags Flag(s) to be added to command line for linking :includes Header file(s) to include at the beginning of each .rb.cpp file generated. :include_source_files C++ source files that need to be compiled into the extension but not wrapped. :include_source_dir A combination option for reducing duplication, this option will query the given directory for source files, adding all to :include_source_files and adding all h/hpp files to :includes | def sources(dirs, options = {})
parser_options = {
:includes => [],
:cxxflags => [
# Force castxml into C++ mode
"-x c++",
# Allow things like `<::`
"-fpermissive"
]
}
if (code_dir = options.delete(:include_source_dir))
options[:include_source_files] ||= []
options[:includes] ||= []
Dir["#{code_dir}/*"].each do |f|
next if File.directory?(f)
options[:include_source_files] << f
end
end
if (paths = options.delete(:include_paths))
@options[:include_paths] << paths
parser_options[:includes] << paths
end
if (lib_paths = options.delete(:library_paths))
@options[:library_paths] << lib_paths
end
if (libs = options.delete(:libraries))
@options[:libraries] << libs
end
if (flags = options.delete(:cxxflags))
@options[:cxxflags] << flags
parser_options[:cxxflags] << flags
end
if (flags = options.delete(:ldflags))
@options[:ldflags] << flags
end
if (files = options.delete(:include_source_files))
@options[:include_source_files] << files
options[:includes] ||= []
[files].flatten.each do |f|
options[:includes] << f if File.extname(f) =~ /hpp/i || File.extname(f) =~ /h/i
end
end
if (flags = options.delete(:includes))
includes = Dir.glob(flags)
if(includes.length == 0)
puts "Warning: There were no matches for includes #{flags.inspect}"
else
@options[:includes] += [*includes]
end
end
@options[:includes] += [*dirs]
@sources = Dir.glob dirs
Logger.info "Parsing #{@sources.inspect}"
@parser = RbGCCXML.parse(dirs, parser_options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header_include_paths\n cmd = RbConfig::MAKEFILE_CONFIG[\"CC\"]\n args = %w{-Wp,-v -xc /dev/null -fsyntax-only}\n paths = []\n reading_paths = false\n run_command(cmd, *args) do |line|\n line.chomp!\n if reading_paths\n if line == 'End of search list.'\n reading_paths = false\n elsif... | [
"0.6914934",
"0.6285592",
"0.60384244",
"0.58239883",
"0.5822146",
"0.57213515",
"0.5713939",
"0.5686055",
"0.5673936",
"0.5671525",
"0.5652372",
"0.56276816",
"0.55707955",
"0.5570621",
"0.5567354",
"0.55640113",
"0.55187756",
"0.5454527",
"0.5442466",
"0.5412935",
"0.540044... | 0.65172637 | 1 |
Set a namespace to be the main namespace used for this extension. Specifing a namespace on the Extension itself will mark functions, class, enums, etc to be globally available to Ruby (aka not in it's own module) To get access to the underlying RbGCCXML query system, save the return value of this method: node = namespace "lib::to_wrap" | def namespace(name)
@node = @parser.namespaces(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namespace=(ns); end",
"def namespace=(ns); end",
"def set_namespace(namespace)\n return unless namespace\n\n @namespace = namespace\n @ext.set_namespace(namespace)\n end",
"def namespace; end",
"def namespace; end",
"def namespace; end",
"def namespace; end",
"def namespace; end... | [
"0.66401315",
"0.66401315",
"0.6406295",
"0.6178743",
"0.6178743",
"0.6178743",
"0.6178743",
"0.6178743",
"0.6178743",
"0.6178743",
"0.6178743",
"0.61648786",
"0.6104583",
"0.60997504",
"0.6025059",
"0.6011422",
"0.60000217",
"0.592806",
"0.5899432",
"0.58949035",
"0.58898",
... | 0.54854494 | 54 |
Mark that this extension needs to create a Ruby module of a give name. Like Extension.new, this can be used with or without a block. | def module(name, &block)
m = RbModule.new(name, @parser, &block)
@modules << m
m
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_module(name, &block)\n mod = Module.new(&block)\n @managed.const_set(name, mod)\n mod\n end",
"def create(name)\n\t\t# Check to see if it has a module type prefix. If it does,\n\t\t# try to load it from the specific module set for that type.\n\t\tif (md = name.match(/^(#{MODULE_TYPE... | [
"0.70542896",
"0.63600147",
"0.63388777",
"0.6207249",
"0.6157514",
"0.6134244",
"0.5998924",
"0.5945504",
"0.5939234",
"0.592648",
"0.5912476",
"0.5887213",
"0.58512485",
"0.58236164",
"0.58232397",
"0.5808011",
"0.5796311",
"0.57720864",
"0.57386017",
"0.57356143",
"0.57147... | 0.6238118 | 3 |
Specify the mode with which to write out code files. This can be one of two modes: :multiple (default) Each class and module gets it's own set of hpp/cpp files :single Everything gets written to a single file | def writer_mode(mode)
raise "Unknown writer mode #{mode}" unless [:multiple, :single].include?(mode)
@writer_mode = mode
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write\n Logger.info \"Writing code to files\"\n prepare_working_dir\n process_other_source_files\n\n # Create the code\n writer_class = @writer_mode == :multiple ? Writers::MultipleFilesWriter : Writers::SingleFileWriter\n writer_class.new(@builder, @working_dir).write\n\n # ... | [
"0.61586547",
"0.60897255",
"0.56814134",
"0.5643226",
"0.5630379",
"0.5551736",
"0.55042124",
"0.5504173",
"0.5431309",
"0.53551745",
"0.53501123",
"0.534584",
"0.5301392",
"0.5222702",
"0.5208211",
"0.51636547",
"0.51636547",
"0.51636547",
"0.51636547",
"0.5163312",
"0.5142... | 0.62678695 | 0 |
Start the code generation process. | def build
raise ConfigurationError.new("Must specify working directory") unless @working_dir
raise ConfigurationError.new("Must specify which sources to wrap") unless @parser
Logger.info "Beginning code generation"
@builder = Builders::ExtensionNode.new(@name, @node || @parser, @modules)
@builder.add_includes @options[:includes]
@builder.build
@builder.sort
Logger.info "Code generation complete"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_generation\n Nanite.request(\"/nanny/generate\", self.id)\n end",
"def start\n # Set a cleaner process title\n Process.setproctitle(\"generate #{ARGV.join(\" \")}\")\n\n # Parse CLI arguments\n parser.parse!\n\n # Render Apache portal config\n view = View.n... | [
"0.6937173",
"0.68181866",
"0.6668282",
"0.6487096",
"0.6418716",
"0.6359246",
"0.6329479",
"0.627829",
"0.6231169",
"0.6229854",
"0.6223654",
"0.62168235",
"0.62136465",
"0.62136465",
"0.62136465",
"0.62136465",
"0.6199343",
"0.6188479",
"0.6188479",
"0.6182261",
"0.6179925"... | 0.6083291 | 41 |
Write out the generated code into files. build must be called before this step or nothing will be written out | def write
Logger.info "Writing code to files"
prepare_working_dir
process_other_source_files
# Create the code
writer_class = @writer_mode == :multiple ? Writers::MultipleFilesWriter : Writers::SingleFileWriter
writer_class.new(@builder, @working_dir).write
# Create the extconf.rb
extconf = Writers::ExtensionWriter.new(@builder, @working_dir)
extconf.options = @options
extconf.write
Logger.info "Files written"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate\n setup\n\n write_style_sheet\n generate_index\n generate_class_files\n generate_file_files\n generate_table_of_contents\n @json_index.generate\n @json_index.generate_gzipped\n\n copy_static\n\n rescue => e\n debug_msg \"%s: %s\\n %s\" % [\n e.class.name, e.message... | [
"0.70972645",
"0.7075406",
"0.70609",
"0.7046495",
"0.6902335",
"0.68874085",
"0.682245",
"0.6723369",
"0.65834737",
"0.64997",
"0.64838815",
"0.64687943",
"0.6456144",
"0.64551425",
"0.6446258",
"0.641912",
"0.641912",
"0.637711",
"0.63598377",
"0.63082594",
"0.6267121",
"... | 0.6821065 | 7 |
Compile the extension. This will create an rbpp_compile.log file in +working_dir+. View this file to see the full compilation process including any compiler errors / warnings. | def compile
Logger.info "Compiling. See rbpp_compile.log for details."
require 'rbconfig'
ruby = File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["RUBY_INSTALL_NAME"])
FileUtils.cd @working_dir do
system("#{ruby} extconf.rb > rbpp_compile.log 2>&1")
system("rm -f *.so")
system("make >> rbpp_compile.log 2>&1")
end
Logger.info "Compilation complete."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile\n Dir.chdir(build_path) do\n do_compile\n end\n end",
"def compile\n end",
"def build\n raise ConfigurationError.new(\"Must specify working directory\") unless @working_dir\n raise ConfigurationError.new(\"Must specify which sources to wrap\") unless @parser\n\n ... | [
"0.6823948",
"0.6362989",
"0.63502246",
"0.61257815",
"0.60613436",
"0.60349697",
"0.60108215",
"0.6002097",
"0.59822905",
"0.5947855",
"0.5895054",
"0.5806892",
"0.57201964",
"0.57150155",
"0.57021344",
"0.56926584",
"0.56812584",
"0.5639252",
"0.56190336",
"0.5608342",
"0.5... | 0.78810585 | 0 |
Read any command line arguments and process them | def parse_command_line
OptionParser.new do |opts|
opts.banner = "Usage: ruby #{$0} [options]"
opts.on_head("-h", "--help", "Show this help message") do
puts opts
exit
end
opts.on("-v", "--verbose", "Show all progress messages (INFO, DEBUG, WARNING, ERROR)") do
Logger.verbose = true
end
opts.on("-q", "--quiet", "Only show WARNING and ERROR messages") do
Logger.quiet = true
end
opts.on("--console", "Open up a console to query the source via rbgccxml") do
@requesting_console = true
end
opts.on("--clean", "Force a complete clean and rebuild of this extension") do
@force_rebuild = true
end
end.parse!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_arguments\n @args << \"-h\" if(@args.length < 1)\n \n opts_parse = OptionParser.new do |opts|\n opts.on('-f','--file FILE','use the following local file') {|file| @options.file = File.expand_path(file)}\n opts.on('-p','--parse PARSE',\"sets which set of sider files to downl... | [
"0.74129695",
"0.70760596",
"0.7033612",
"0.70210594",
"0.69626695",
"0.69026005",
"0.68571657",
"0.68488073",
"0.68344635",
"0.6767632",
"0.6656666",
"0.66463333",
"0.66262084",
"0.6620613",
"0.6619896",
"0.66112757",
"0.6601038",
"0.65809566",
"0.6579702",
"0.6564423",
"0.6... | 0.0 | -1 |
Check ARGV to see if someone asked for "console" | def requesting_console?
@requesting_console
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commandline\n ui == \"commandline\"\n end",
"def console?\n defined?(::Rails::Console) && $stdout.isatty && $stdin.isatty\n end",
"def validate_argv\n if ARGV.empty? then\n ARGV << \"start\"\n else\n if not %w{start stop restart zap status}.include? ARGV.first then\n ... | [
"0.7050839",
"0.638266",
"0.6313518",
"0.63002616",
"0.6237337",
"0.62016934",
"0.5997924",
"0.59475183",
"0.5905552",
"0.5887037",
"0.5845508",
"0.58440936",
"0.58061516",
"0.5805057",
"0.5805057",
"0.5805057",
"0.5799348",
"0.5799348",
"0.57903284",
"0.5789808",
"0.57686764... | 0.6389698 | 1 |
Start up a new IRB console session giving the user access to the RbGCCXML parser instance to do realtime querying of the code they're trying to wrap | def start_console
puts "IRB Session starting. @parser is now available to you for querying your code. The extension object is available as 'self'"
IRB.start_session(binding)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(*args)\n ## maybe set some opts here, as in parse_opts in irb/init.rb?\n\n unless @@irb_setup_done\n @@irb_setup_done = true\n\n conf = IRB.conf\n \n if File.directory?(\"tmp\")\n conf[:HISTORY_FILE] = \"tmp/.irb_shell_history\"\n else\n conf[:HISTORY_FIL... | [
"0.65019333",
"0.64288914",
"0.6155321",
"0.60915166",
"0.60181373",
"0.59680706",
"0.59327716",
"0.59311205",
"0.58957195",
"0.58705044",
"0.5767094",
"0.575434",
"0.5736025",
"0.5735212",
"0.5720628",
"0.56802",
"0.5676554",
"0.56409335",
"0.56183326",
"0.5579454",
"0.55589... | 0.77239615 | 0 |
If the working dir doesn't exist, make it and if it does exist, clean it out | def prepare_working_dir
FileUtils.mkdir_p @working_dir unless File.directory?(@working_dir)
FileUtils.rm_rf Dir["#{@working_dir}/*"] if @force_rebuild
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_up\n FileUtils.rm_rf \"#{@path}\" unless create_in_current_directory?\n FileUtils.rm_rf \"#{@cache}\"\n end",
"def clean_dir\n\n path = self.get_dir\n _clean_dir(path)\n end",
"def clean_dir\n File.join clean_dir_parent, name\n end",
"def clean\n needs_cleaning ... | [
"0.76405054",
"0.7408624",
"0.7186648",
"0.71587247",
"0.70376396",
"0.70326406",
"0.7000289",
"0.69984543",
"0.6984926",
"0.6920283",
"0.6874696",
"0.67769",
"0.67683226",
"0.67443323",
"0.67343736",
"0.6714536",
"0.6714536",
"0.6690504",
"0.66625756",
"0.66347367",
"0.66268... | 0.82474655 | 0 |
Make sure that any files or globs of files in :include_source_files are copied into the working directory before compilation | def process_other_source_files
files = @options[:include_source_files].flatten
files.each do |f|
FileUtils.cp Dir[f], @working_dir
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update include_dirs, source\r\n if not @source_files.include? source\r\n @source_files << source\r\n end\r\n update_depends include_dirs, source\r\n end",
"def setup_source_files\n project.sources.each do |src|\n # Figure out where stuff should come from and go to\n source_f... | [
"0.67724407",
"0.67555416",
"0.6641602",
"0.6449673",
"0.64423573",
"0.62240994",
"0.6183724",
"0.61246365",
"0.60495454",
"0.60196936",
"0.5957298",
"0.5891985",
"0.5861465",
"0.5851464",
"0.5845209",
"0.5845209",
"0.5802774",
"0.5775919",
"0.5772304",
"0.5753653",
"0.575107... | 0.7868463 | 0 |
Cool little eval / binding hack, from need.rb | def build_working_dir(&block)
file_name =
if block.respond_to?(:source_location)
block.source_location[0]
else
eval("__FILE__", block.binding)
end
@working_dir = File.expand_path(
File.join(File.dirname(file_name), "generated"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def foo2 my_binding\n eval \"x\", my_binding\nend",
"def foo my_binding\n x = 200\n eval \"x\", my_binding\nend",
"def eval_binding(args, current_cont)\n\t\t\tname, env = args[:name], args[:env]\n\t\t\tif env.include? name.val.to_sym\n\t\t\t\treturn current_cont.next_with(ast: env[name.val.to_sym])\n\t\t\te... | [
"0.75313014",
"0.7441519",
"0.710835",
"0.7097458",
"0.7048693",
"0.70203006",
"0.6774199",
"0.6713175",
"0.6596647",
"0.6596647",
"0.6571318",
"0.6488089",
"0.6488089",
"0.6442359",
"0.6355621",
"0.6331491",
"0.6294697",
"0.6294697",
"0.6283392",
"0.62818265",
"0.6239487",
... | 0.0 | -1 |
GET /posts GET /posts.json | def index
@posts = Post.all
@event = Event.find(params[:event_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n ... | [
"0.7865315",
"0.7494904",
"0.7494433",
"0.7494433",
"0.7488696",
"0.74314564",
"0.728645",
"0.728645",
"0.728645",
"0.72562826",
"0.72522277",
"0.7247287",
"0.7246305",
"0.72221965",
"0.72042215",
"0.72039723",
"0.7169929",
"0.71689725",
"0.71644753",
"0.7121855",
"0.71152896... | 0.0 | -1 |
GET /posts/1 GET /posts/1.json | def show
@calendar = Calendar.find(params[:calendar_id])
@event = @calendar.events.find(params[:event_id])
#@post = Post.find[params[:id]]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def show\n render json: Post.find(params[\"id\"])\n end",
"def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end",
"def show\n @post = Post.find(params[:id])\n\n render json: @post\n end",
... | [
"0.77110183",
"0.73537844",
"0.73433185",
"0.73379177",
"0.73228735",
"0.7293139",
"0.7275997",
"0.7256934",
"0.7161576",
"0.7158913",
"0.71552676",
"0.71552676",
"0.7119547",
"0.7094749",
"0.7094749",
"0.7094749",
"0.70943594",
"0.7071599",
"0.70607626",
"0.70452625",
"0.703... | 0.0 | -1 |
POST /posts POST /posts.json | def create
@calendar = Calendar.find(params[:calendar_id])
@event = Event.find(params[:event_id])
if @event.posts.create(post_params)
redirect_to url_for([@calendar,@event]),
notice: 'Post successfully created.'
else
redirect_to calendar_event_path(:calendar,:event),
alert: 'Error on creating post'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n render json: Post.create(params[\"post\"])\n end",
"def create\n respond_with Post.create(params[:posts])\n end",
"def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end",
"def create\n @post = Post.new(post_params)\n @po... | [
"0.74463975",
"0.73221767",
"0.73072433",
"0.7123966",
"0.7015686",
"0.701327",
"0.69841874",
"0.6939327",
"0.69313824",
"0.69053805",
"0.68196476",
"0.6812792",
"0.6793222",
"0.6792862",
"0.6779654",
"0.6779654",
"0.67625546",
"0.67602354",
"0.67515427",
"0.6735786",
"0.6698... | 0.0 | -1 |
PATCH/PUT /posts/1 PATCH/PUT /posts/1.json | def update
@calendar = Calendar.find(params[:calendar_id])
@event = Event.find(params[:event_id])
respond_to do |format|
if @post.update(post_params)
format.html { redirect_to [@calendar,@event,@post], notice: 'Post was successfully updated.' }
format.json { render :show, status: :ok, location: @event }
else
format.html { render :edit }
format.json { render json: @post.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update\n respond_with Post.update(params[:id], params[:posts])\n end",
"def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n forma... | [
"0.7186324",
"0.7040601",
"0.677308",
"0.6765753",
"0.6668628",
"0.66481066",
"0.6577776",
"0.65553194",
"0.65502805",
"0.65495133",
"0.65345335",
"0.6529854",
"0.64982027",
"0.64969105",
"0.6467084",
"0.64304507",
"0.6428232",
"0.6426466",
"0.6425566",
"0.6419249",
"0.641814... | 0.0 | -1 |
DELETE /posts/1 DELETE /posts/1.json | def destroy
@calendar = Calendar.find(params[:calendar_id])
@event = Event.find(params[:event_id])
@post = @event.posts.find(params[:id])
@post.destroy
respond_to do |format|
format.html { redirect_to [@calendar,@event], notice: 'Post was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n post = Post.find(params[:id])\n if post.destroy\n render json: {status: \"success\", data: {id: param... | [
"0.8046884",
"0.76902676",
"0.7583626",
"0.75803024",
"0.7568048",
"0.75047046",
"0.75031126",
"0.74750155",
"0.74671036",
"0.74650854",
"0.746482",
"0.74589694",
"0.74589694",
"0.74589694",
"0.74589694",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_post
@post = Post.find(params[:id])
#@event = Event.find(params[:event_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 post_params
params.require(:post).permit(:title, :content,:created_at, :image)
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 |
For an update message, we update the plate in sequencescape setting the updated aliquots. | def _call_in_transaction
begin
update_aliquots(s2_resource)
rescue Sequel::Rollback, PlateNotFoundInSequencescape, UnknownSample => e
metadata.reject(:requeue => true)
log.info("Error updating plate aliquots in Sequencescape: #{e}")
raise Sequel::Rollback
rescue TransferRequestNotFound => e
metadata.ack
log.info("Plate update message processed and acknowledged with the warning: #{e}")
else
metadata.ack
log.info("Plate update message processed and acknowledged")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_aliquots_in_sequencescape(plate, plate_uuid, date, sample_uuids)\n plate_id = plate_id_by_uuid(plate_uuid)\n\n # wells is a hash associating a location to a well id\n wells = location_wells(plate_id) \n\n # We save the plate wells data from the transfer\n plate.keys.ea... | [
"0.6658007",
"0.60036933",
"0.5710292",
"0.5695588",
"0.56829643",
"0.56478083",
"0.55922955",
"0.55900496",
"0.55402684",
"0.55304533",
"0.5515028",
"0.5488818",
"0.5488818",
"0.5488818",
"0.5488818",
"0.5488818",
"0.5488818",
"0.5488818",
"0.5488818",
"0.54815155",
"0.54782... | 0.559373 | 6 |
sidekiq_options queue: "high" change this shall add some config, else worker will not start. see document. sidekiq_options retry: false | def perform
publish_scheduled
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure worker,worker_config\n if worker_config[\"maximum_size\"]>0\n @queues[worker]=SizedQueue.new(worker_config[\"maximum_size\"])\n else\n @queues[worker]=Queue.new\n end\n configuration(worker)\n end",
"def sidekiq_options(opts = T.unsafe(nil)); end",
"def queue_... | [
"0.6407653",
"0.63067985",
"0.6157203",
"0.6040641",
"0.60173136",
"0.59270275",
"0.5883142",
"0.57842046",
"0.5768641",
"0.5762892",
"0.5700951",
"0.56808597",
"0.5645699",
"0.5617627",
"0.56069165",
"0.5602088",
"0.55706745",
"0.55668116",
"0.55640763",
"0.5551775",
"0.5533... | 0.0 | -1 |
GET /desinfectantes GET /desinfectantes.json | def index
@desinfectantes = Desinfectante.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @desinfectante.destroy\n respond_to do |format|\n format.html { redirect_to desinfectantes_url, notice: 'Desinfectante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def emergencias_en_curso\n @emergencies = Emergency.where(:estado => 'f')\n ... | [
"0.64389193",
"0.623495",
"0.61304295",
"0.60649556",
"0.60498655",
"0.6040296",
"0.6034668",
"0.60063785",
"0.59972966",
"0.5948474",
"0.59429896",
"0.59263563",
"0.59120077",
"0.5791583",
"0.5770066",
"0.5764881",
"0.5750057",
"0.57298476",
"0.5708329",
"0.568885",
"0.56845... | 0.72310925 | 0 |
GET /desinfectantes/1 GET /desinfectantes/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @desinfectantes = Desinfectante.all\n end",
"def show\n @descuento = Descuento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @descuento }\n end\n end",
"def show\n @detalle = Detalle.find(params[:id])\n\n respon... | [
"0.69370973",
"0.6734477",
"0.6544041",
"0.64997417",
"0.64963436",
"0.63957137",
"0.6391741",
"0.6373035",
"0.6369591",
"0.63553333",
"0.6354211",
"0.6327558",
"0.63217884",
"0.62959665",
"0.6290628",
"0.6253627",
"0.6242099",
"0.62330043",
"0.6230897",
"0.6227246",
"0.62253... | 0.0 | -1 |
POST /desinfectantes POST /desinfectantes.json | def create
@desinfectante = Desinfectante.new(desinfectante_params)
respond_to do |format|
if @desinfectante.save
format.html { redirect_to @desinfectante, notice: 'Desinfectante was successfully created.' }
format.json { render :show, status: :created, location: @desinfectante }
else
format.html { render :new }
format.json { render json: @desinfectante.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def desinfectante_params\n params.require(:desinfectante).permit(:marca, :tipo, :precio, :presentacion, :stock, :liquido)\n end",
"def destroy\n @desinfectante.destroy\n respond_to do |format|\n format.html { redirect_to desinfectantes_url, notice: 'Desinfectante was successfully destroyed.' }... | [
"0.6715804",
"0.64218324",
"0.62631243",
"0.6013901",
"0.58974636",
"0.58731997",
"0.5789425",
"0.577496",
"0.5768931",
"0.57493615",
"0.57434523",
"0.5661222",
"0.5650956",
"0.56354165",
"0.56324345",
"0.5581517",
"0.5562345",
"0.5549814",
"0.5548201",
"0.55382335",
"0.55382... | 0.66236925 | 1 |
PATCH/PUT /desinfectantes/1 PATCH/PUT /desinfectantes/1.json | def update
respond_to do |format|
if @desinfectante.update(desinfectante_params)
format.html { redirect_to @desinfectante, notice: 'Desinfectante was successfully updated.' }
format.json { render :show, status: :ok, location: @desinfectante }
else
format.html { render :edit }
format.json { render json: @desinfectante.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { ... | [
"0.6500287",
"0.6442837",
"0.64224625",
"0.63979876",
"0.6375225",
"0.63302875",
"0.6328817",
"0.6291803",
"0.62866145",
"0.6285924",
"0.62819654",
"0.6257505",
"0.6249846",
"0.6248789",
"0.62433636",
"0.62423736",
"0.6232456",
"0.62319374",
"0.62314755",
"0.6229124",
"0.6226... | 0.6531241 | 0 |
DELETE /desinfectantes/1 DELETE /desinfectantes/1.json | def destroy
@desinfectante.destroy
respond_to do |format|
format.html { redirect_to desinfectantes_url, notice: 'Desinfectante was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @detalle = Detalle.find(params[:id])\n @detalle.destroy\n\n respond_to do |format|\n format.html { redi... | [
"0.71394247",
"0.7127553",
"0.71198034",
"0.70285964",
"0.7027966",
"0.70126766",
"0.7010169",
"0.7007926",
"0.69764686",
"0.69739956",
"0.6956925",
"0.69524306",
"0.6950972",
"0.6937087",
"0.693446",
"0.6929953",
"0.6928403",
"0.69081795",
"0.6901356",
"0.6900193",
"0.689963... | 0.7309257 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_desinfectante
@desinfectante = Desinfectante.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 desinfectante_params
params.require(:desinfectante).permit(:marca, :tipo, :precio, :presentacion, :stock, :liquido)
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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_profile
@profile = Profile.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 profile_params
params.require(:profile).permit(:tipo)
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 |
lists all working users | def working
@users=User.where.not(timer_activity: 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_all_users\n\n end",
"def list_users(workspace)\n puts \"\\nUser List\\n\\n\"\n tp workspace.users, \"id\", \"name\", \"real_name\", \"status_text\", \"status_emoji\"\nend",
"def list\n\t\t# retrieve all users\n @users = User.find(:all)\n end",
"def list_users\n tp @users, :real_name, :sl... | [
"0.7850157",
"0.7776798",
"0.77706695",
"0.77378845",
"0.7705273",
"0.7644947",
"0.75823116",
"0.75793475",
"0.74473876",
"0.73671395",
"0.7301737",
"0.7301737",
"0.7295739",
"0.72888047",
"0.7276503",
"0.72087264",
"0.7201529",
"0.7194605",
"0.71751314",
"0.71386087",
"0.712... | 0.0 | -1 |
main list tasks action | def list_tasks
#begin
#byebug
@params=search_params[:search]
#byebug
if @params
if !@params[:user].empty?
query = iterate_add_tasks(User.where('handle LIKE ?', "%#{@params[:user]}%"))
if query
@tasks.nil? ? @tasks=query : @tasks=@tasks&query
end
end
if !@params[:client].empty?
query = iterate_add_tasks(Client.where('name LIKE ?', "%#{@params[:client]}%"))
if query
@tasks.nil? ? @tasks=query : @tasks=@tasks&query
end
end
if !@params[:project].empty?
query = iterate_add_tasks(Project.where('name LIKE ?', "%#{@params[:project]}%"))
if query
@tasks.nil? ? @tasks=query : @tasks=@tasks&query
end
end
if !@params[:activity].empty?
query = iterate_add_tasks(Activity.where('name LIKE ?', "%#{@params[:activity]}%"))
if query
@tasks.nil? ? @tasks=query : @tasks=@tasks&query
end
end
if !@params[:date].empty?
@start=Date.parse(@params[:date]).beginning_of_month
@end=Date.parse(@params[:date]).end_of_month
query = Task.where(date: @start..@end)
if query
@tasks.nil? ? @tasks=query : @tasks=@tasks&query
end
end
if @tasks
#byebug
@tasks=@tasks.uniq.sort{|a,b| a[:date] <=> b[:date]}
@tasks=@tasks.reverse
end
flash[:notice]=nil
all=true
@params.each do |p|
#byebug
if !p[1].empty?
all=false
end
end
if all
@tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)
flash[:notice]='Listing the latest 20 tasks'
end
else
@tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)
flash[:notice]='Listing the latest 20 tasks'
end
#rescue
#@tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)
#flash[:notice]='Listing the latest 20 tasks'
#end
@hours=total_hours(@tasks)
respond_to do |format|
format.html
format.csv {send_data tasks_to_csv(@tasks)}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_tasks\n tasks = @repository.all\n @view.display_tasks(tasks)\n end",
"def list_tasks\n # ASK REPO for the tasks\n tasks = @task_repository.all\n # ASK VIEW to display them\n @tasks_view.display(tasks)\n end",
"def show_tasks\n\t\tputs \"here are the tasks on the #{self.name} list..... | [
"0.80346555",
"0.7865056",
"0.7764971",
"0.7649433",
"0.76244104",
"0.76218575",
"0.76078546",
"0.75892705",
"0.74091125",
"0.73889077",
"0.72768027",
"0.7268407",
"0.7268407",
"0.7268407",
"0.7268407",
"0.7268407",
"0.7268407",
"0.7268407",
"0.7268407",
"0.7268407",
"0.72684... | 0.69733655 | 57 |
controller for deleting clients/projects/activities | def delete_client
begin
if c_delete_params[:client]
name=Client.find(c_delete_params[:client]).name
Client.find(c_delete_params[:client]).destroy
flash[:notice]='Deleted client: '+name
return redirect_to '/admin/list_clients'
elsif c_delete_params[:project]
name=Project.find(c_delete_params[:project]).name
Project.find(c_delete_params[:project]).destroy
flash[:notice]='Deleted project: '+name
return redirect_to :back
elsif c_delete_params[:activity]
project=Activity.find(c_delete_params[:activity]).project.id
name=Activity.find(c_delete_params[:activity]).name
Activity.find(c_delete_params[:activity]).destroy
flash[:notice]='Deleted activity: '+name
return redirect_to request.referer + '#project'+project.to_s
elsif c_delete_params[:assignment]
activity=Assignment.find(c_delete_params[:assignment]).activity.id
Assignment.find(c_delete_params[:assignment]).destroy
flash[:notice]='Deleted assignment'
return redirect_to request.referer + '#activity'+activity.to_s
end
rescue
flash[:error]='There was an error'
redirect_to :back
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @activities_project = ActivitiesProject.find(params[:id])\n @activities_project.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = @client.projects.find(params[:id])\n... | [
"0.76715904",
"0.7656154",
"0.7489624",
"0.7466021",
"0.73890996",
"0.7364872",
"0.7301424",
"0.7294843",
"0.72752523",
"0.7170535",
"0.7137682",
"0.71017635",
"0.7045573",
"0.7040628",
"0.70351183",
"0.7032084",
"0.70251167",
"0.7017299",
"0.70083606",
"0.69274914",
"0.69112... | 0.73521006 | 6 |
controller for creating clients/projects/activities | def create_client
begin
if create_params[:client]
Client.create(name: create_params[:client])
flash[:notice]='Client: '+create_params[:client]+', created! '
return redirect_to '/admin/list_clients'+'?client_name='+create_params[:client]
elsif create_params[:project]
Client.find(create_params[:parent_id]).projects.create(name: create_params[:project])
flash[:notice]='Project: '+create_params[:project]+', created! '
return redirect_to request.referer+'#project'+Project.find_by_name(create_params[:project]).id.to_s
elsif create_params[:activity]
Project.find(create_params[:parent_id]).activities.create(name: create_params[:activity])
flash[:notice]='Activity: '+create_params[:activity]+', created! '
return redirect_to request.referer+'#activity'+Activity.find_by_name(create_params[:activity]).id.to_s
elsif create_params[:user_id]
begin
Assignment.create!(user_id: create_params[:user_id], activity_id: create_params[:parent_id])
flash[:notice]='Assigned user '+User.find(create_params[:user_id]).handle+' to activity '+Activity.find(create_params[:parent_id]).name
return redirect_to request.referer+'#ass'+Assignment.where(user_id: create_params[:user_id], activity_id: create_params[:parent_id]).first.id.to_s
rescue
flash[:error]='You can only assign a user once to to a particular activity'
end
elsif create_params[:project_wide]
begin
Project.find(create_params[:parent_id]).activities.each do |activity|
Assignment.create!(user_id: create_params[:project_wide], activity_id: activity.id)
flash[:notice]='Assigned user '+User.find(create_params[:project_wide]).handle+' to all activities in project '+Project.find(create_params[:parent_id]).name
end
return redirect_to request.referer+'#project'+create_params[:parent_id].to_s
rescue
flash[:error]='You can only assign a user once to to a particular activity'
end
elsif create_params[:client_wide]
begin
Client.find(create_params[:parent_id]).activities.each do |activity|
Assignment.create!(user_id: create_params[:client_wide], activity_id: activity.id)
end
flash[:notice]='Assigned user '+User.find(create_params[:client_wide]).handle+' to all activities in client '+Client.find(create_params[:parent_id]).name
return redirect_to :back
rescue
flash[:error]='You can only assign a user once to to a particular activity'
end
end
return redirect_to :back
rescue
flash[:error]='There was an error'
redirect_to :back
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @project = @client.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @client, notice: 'Project was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def create\n ... | [
"0.7295849",
"0.72820836",
"0.72768223",
"0.7230288",
"0.7114854",
"0.7112128",
"0.70823723",
"0.70475775",
"0.7026554",
"0.7024975",
"0.69616765",
"0.6776181",
"0.675668",
"0.6748249",
"0.67168736",
"0.66727144",
"0.66511714",
"0.66415524",
"0.66052186",
"0.660399",
"0.66029... | 0.7051288 | 7 |
Never trust parameters from the scary internet, only allow the white list through. | def search_params_user
params.require(:search).permit(:handle, :first_name, :last_name, :email)
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 |
base and exponent and returns base raised to the exponent power. (No fair using Ruby's base exponent notation!). | def pow(base, exponent)
result = 1
exponent.times do
result = base.to_i * result
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def power(base, exponent)\n return nil if exponent < 0\n\n return 1 if exponent == 0\n\n value = base\n\n (exponent - 1).times do value *= base end\n\n value\nend",
"def power(base,exponent)\n\n return base ** exponent\nend",
"def pow(base, exponent)\n\n result = 1\n\n exponen... | [
"0.85367644",
"0.83835316",
"0.8346648",
"0.8328984",
"0.8320955",
"0.8299144",
"0.8173997",
"0.8119814",
"0.8064917",
"0.80615014",
"0.799997",
"0.79420173",
"0.7905454",
"0.7864293",
"0.7832552",
"0.78028375",
"0.77335674",
"0.7729772",
"0.7720525",
"0.7629144",
"0.7587631"... | 0.80038184 | 10 |
Write a method, sum which takes an array of numbers and returns the sum of the numbers. | def sum(array)
y = 0
array.each do |x|
y += x
end
y
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_array(numbers)\n return numbers.sum()\nend",
"def sum_array(array)\n array.sum\nend",
"def sum_array(array)\n array.sum\nend",
"def sum(array)\n array.sum\nend",
"def sum(array_of_integers)\n # TODO\nend",
"def sum_array(array)\n the_sum_of_array = array.sum\n the_sum_of_array\nend",
... | [
"0.8819229",
"0.8741331",
"0.8724715",
"0.86748266",
"0.8614597",
"0.8563894",
"0.8530244",
"0.8503776",
"0.8475847",
"0.8460066",
"0.8451358",
"0.84347755",
"0.8431987",
"0.8431987",
"0.8431652",
"0.8411252",
"0.8402997",
"0.8394949",
"0.8384007",
"0.8373476",
"0.8366921",
... | 0.0 | -1 |
Write a method, is_prime?, that takes a number num and returns true if it is prime and false otherwise. | def is_prime?(num)
i = 2
while i < num
divisible = ((num % i) == 0)
if divisible
return false
end
i += 1
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prime?(num)\nend",
"def is_prime?(num)\n\treturn false if (num < 1 || num.class == Float)\n\t(2...num).each { |n| return false if num % n == 0 }\n\ttrue\nend",
"def is_prime?(num)\n # Write your code here\nend",
"def is_prime?(num)\n\nend",
"def isPrime?(num)\n\treturn false if num <= 1\n\n\ti = ... | [
"0.8312177",
"0.8139957",
"0.8124352",
"0.81223184",
"0.80209494",
"0.79551506",
"0.79307765",
"0.79305464",
"0.79305464",
"0.79105973",
"0.79105973",
"0.79105973",
"0.78970796",
"0.7890389",
"0.7881669",
"0.7873143",
"0.7869361",
"0.7869361",
"0.78663236",
"0.785429",
"0.784... | 0.0 | -1 |
Using your is_prime? method, write a new method, primes that takes a (nonnegative, integer) number max and returns an array of all prime numbers less than max. | def primes(max)
array = []
i = 2
while i < max.abs
if is_prime?(i)
array << i
end
i += 1
end
array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primes(max)\n primes = []\n number = 2\n \n while number <= max\n primes << number if is_prime? number\n number += 1\n end\n primes\nend",
"def primes(max)\n primes = []\n number = 2\n \n while number <= max\n primes << number if is_prime? number\n number += 1\n end\n primes\nend",
... | [
"0.83949995",
"0.83949995",
"0.8016834",
"0.7953333",
"0.7952573",
"0.78910017",
"0.78560436",
"0.7841761",
"0.78091115",
"0.78061825",
"0.78059363",
"0.7792239",
"0.7710655",
"0.7699948",
"0.76808125",
"0.76653236",
"0.7654771",
"0.7654771",
"0.7654771",
"0.75961375",
"0.755... | 0.86498326 | 0 |
write a recursive function to find the highest prime factor of any number | def prime_recur(num)
max_prime = 2
i = num
while i > (num/2)
if is_prime?(i)
max_prime = i
end
i -= 1
end
max_prime
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def largest_prime_factor(num)\n (2..num).reverse_each do |factor|\n if (num % factor == 0 && Prime.prime?(factor))\n return factor\n end\n end\nend",
"def largest_prime_factor(num)\n track = 0\n (num).downto(2).each do |factor|\n \n if num % factor == 0 && prime... | [
"0.8718168",
"0.8678555",
"0.865899",
"0.8632884",
"0.86279887",
"0.8625121",
"0.86171204",
"0.86012983",
"0.86011016",
"0.8600345",
"0.85940826",
"0.85519683",
"0.85489714",
"0.8493698",
"0.84860057",
"0.8481071",
"0.8457284",
"0.8430555",
"0.8418677",
"0.8417911",
"0.841733... | 0.72416675 | 94 |
create one or more CSV files (one CSV file per survey_schema) and archive it with ZIP | def create_zip_file(destination_file_name, csv_filenames_prefix, survey_schemas, administration_id)
raise 'empty survey_schemas are unsupported' if survey_schemas.empty?
working_dir = create_unique_dir
csv_filepaths = create_csv_files(working_dir, csv_filenames_prefix, survey_schemas, administration_id)
zip_files("#{working_dir}/#{destination_file_name}", csv_filepaths)
remove_files(csv_filepaths)
"#{working_dir}/#{destination_file_name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_records_file(format)\n file = Tempfile.new(\"patients-#{Time.now.to_i}\")\n patients = Record.where(\"test_id\" => self.id)\n \n if format == 'csv'\n Cypress::PatientZipper.flat_file(file, patients)\n else\n Cypress::PatientZipper.zip(file, patients, format.to_sym)\n end\n ... | [
"0.6584274",
"0.6402949",
"0.63745075",
"0.6325527",
"0.6291515",
"0.6248007",
"0.62397605",
"0.61585194",
"0.6032448",
"0.59960437",
"0.59375465",
"0.58912754",
"0.58630097",
"0.5854191",
"0.5815545",
"0.5760578",
"0.57358134",
"0.5724562",
"0.5718807",
"0.5694275",
"0.56907... | 0.6876076 | 0 |
adds conversion, conversionrate, confidence and change attrs to passed array | def add_analytics_data(page_analytics_results)
control = page_analytics_results.first
treatments = page_analytics_results[1..-1]
calculations = calculate_conversion_data(control, treatments)
append_data_to_groups!(control, treatments, calculations)
page_analytics_results
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tributes *attrs\n if attrs.empty? \n @tributes ||= []\n else \n @tributes = attrs\n super *attrs\n end \n end",
"def update_attributes(atts)\n atts.each { |att, val| send(:\"#{att}=\", val) }\n end",
"def update!(**args)\n @attribute_p... | [
"0.56544054",
"0.55829805",
"0.54594475",
"0.5393491",
"0.53762305",
"0.53650975",
"0.5343607",
"0.53413194",
"0.5340676",
"0.5314551",
"0.52878195",
"0.52488434",
"0.5241535",
"0.5241535",
"0.5241535",
"0.5241535",
"0.52374434",
"0.5222989",
"0.5191321",
"0.51482415",
"0.513... | 0.0 | -1 |
Main method for results. We are using additional wrapper to mitigate Kaminari / RoR problems with PostgreSQL DISTINCT ON (pagination is broken without this) | def events
RoyalEvent::Event.where(
"id IN (#{subquery.to_sql})"
).order(default_order)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n #@data = Datum.all\n @q = Datum.search(params[:q])\n @data = @q.result(distinct: true).page(params[:page]).per(20)\n end",
"def index\n @q = User.search(params[:q])\n @users = @q.result(:distinct => true).order(sort_column + ' ' + sort_direction).paginate(:page => params[:page])\n# ... | [
"0.6160042",
"0.6120058",
"0.6064114",
"0.60056746",
"0.59882987",
"0.5966952",
"0.58973354",
"0.58908457",
"0.58827794",
"0.58698183",
"0.5845055",
"0.5842389",
"0.58325195",
"0.5831484",
"0.5828574",
"0.58214664",
"0.5814785",
"0.58070767",
"0.579143",
"0.57909274",
"0.5780... | 0.0 | -1 |
Merge all AR relation scopes into one. | def subquery
subqueries.
compact.
inject(&:merge)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(new_scopes); end",
"def all\n if current_scope\n current_scope.clone\n else\n default_scoped\n end\n end",
"def all\n @env.reverse.inject { |env, scope| env.merge scope }\n end",
"def merge!(scope)\n @options.merge!(scope.options)\n\n @a... | [
"0.6877863",
"0.6873067",
"0.668376",
"0.6230345",
"0.6188568",
"0.6159825",
"0.6127702",
"0.60165966",
"0.5983767",
"0.5974696",
"0.5947624",
"0.5935974",
"0.5888036",
"0.5887737",
"0.58800286",
"0.5873672",
"0.5866571",
"0.5864613",
"0.5861562",
"0.58515227",
"0.58487016",
... | 0.0 | -1 |
Optional method on child class. Basically we are calling each method that does one thing. You can add more filters / scopes in child class. Please call `super` to get basic scopes. Usage: def subqueries super + [new_filter, special_scope_for_child_class] end | def subqueries
[
select_distinct_on,
# default filters -- all scopes have them
filter_by_subscription_or_topics,
filter_by_start_date,
filter_by_end_date,
# grouping
group_distinct_on,
# ordering for GROUP BY
order_distinct_on,
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inherited(subclass)\n super\n\n subclass.stradivari_filter_options(\n self.stradivari_filter_options\n )\n\n subclass.stradivari_scopes.update(\n self.stradivari_scopes\n )\n end",
"def _refine_top_query_scope\n # re... | [
"0.67301923",
"0.65505743",
"0.63372445",
"0.63266003",
"0.59769773",
"0.5874502",
"0.5688907",
"0.56794375",
"0.5635255",
"0.5566433",
"0.5540747",
"0.5530601",
"0.5455237",
"0.5409443",
"0.5393406",
"0.5370838",
"0.536498",
"0.53544056",
"0.535165",
"0.53295875",
"0.5307537... | 0.5228065 | 25 |
Required method on child class. Specify here default SQL ORDER BY for all results e.g. "strategy_data>>'bill_acted_on' DESC" | def default_order
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ordering_query; end",
"def order_clause\n col = case sort_params[:sort_col]\n when 'title'\n 'data_management_plans.title'\n when 'funder'\n 'affiliations_fundings.name'\n else\n 'data_management_plans.updated_at'\n end\n { \"#{col}\"... | [
"0.7568424",
"0.698313",
"0.6902242",
"0.6886363",
"0.66674477",
"0.6592575",
"0.6558681",
"0.6516834",
"0.65005857",
"0.64718646",
"0.64700437",
"0.6464869",
"0.64216065",
"0.6406529",
"0.6398351",
"0.63810825",
"0.63709253",
"0.636094",
"0.6352644",
"0.6337956",
"0.6326532"... | 0.5925506 | 74 |
build a recursive function | def fibs(j,k)
@goal = 4000000
i = j
j = k
k = i + j
unless k > @goal
@fib_array << k
fibs(j,k)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recursive => nil",
"def recursive_solution\n\n end",
"def generate_recursive(length)\n _generate(length, 0, '')\nend",
"def recursive_factorial(number)\n\nend",
"def recursive_factorial(number)\n\nend",
"def fibonacciRecurse(a,b,depth)\n\tif depth>0\n\t\treturn String(a+b)+\" \"+fibonacciRecurse(b,... | [
"0.72534883",
"0.67001754",
"0.6450046",
"0.61399716",
"0.61399716",
"0.59712577",
"0.590705",
"0.5799627",
"0.5787223",
"0.57655096",
"0.57536495",
"0.57430583",
"0.5730778",
"0.5701788",
"0.56930506",
"0.5684765",
"0.5684686",
"0.5677164",
"0.567698",
"0.5671565",
"0.565984... | 0.0 | -1 |
this gives me the willies, but whatever. fix later. | def create
#User.transaction.do
email = params[:email]
logger.debug(email)
generated_password = Devise.friendly_token.first(8)
begin
user = User.create!(:email => email, :password => generated_password)
UserMailer.send_welcome_email(self).deliver
flash[:notice] = "Invitation sent."
rescue
flash[:error] = "FUCK."
end
render 'results'
#end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def malts; end",
"def superweening_adorningly(counterstand_pyrenomycetales)\n end",
"def offences_by; end",
"def king_richard_iii; end",
"def low_toms\n [43]\n end",
"def buzzword; end",
"def buzzword; end",
"def romeo_and_juliet; end",
"def anchored; end",
"def hiddens; end",
"def stder... | [
"0.58298665",
"0.5742944",
"0.56979156",
"0.56977946",
"0.5666964",
"0.55777055",
"0.55777055",
"0.55611366",
"0.55526954",
"0.55372494",
"0.5510455",
"0.5493631",
"0.5468806",
"0.54391176",
"0.5425024",
"0.5424866",
"0.54151016",
"0.54151016",
"0.53829825",
"0.53829825",
"0.... | 0.0 | -1 |
Storing node in hash to track the working value | def assign_node(char)
assigned = false
@worker_obj.each do |k, node|
break if assigned
unless node
@worker_obj[k] = [char, NUM_TO_INT_MAP[char] + ADDITIONAL_SECONDS]
@nodes_being_worked_on << char
assigned = true
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_hash(node_id)\n \n end",
"def []=(node, value)\n return @hash[node.sha1] = value\n end",
"def hash\n node_id.hash\n end",
"def hash # Hack for Ruby 1.8.6\n @node.id.hash ^ self.class.hash\n end",
"def recalculate_hash_at(node)\n return node._hash = node.value... | [
"0.73474973",
"0.729175",
"0.72454065",
"0.7098122",
"0.68676984",
"0.6843846",
"0.6769423",
"0.6703186",
"0.6587155",
"0.6587155",
"0.6587155",
"0.6587155",
"0.6587155",
"0.6587155",
"0.6587155",
"0.65726817",
"0.6541691",
"0.6469588",
"0.64603823",
"0.6431214",
"0.6384501",... | 0.0 | -1 |
removing all stored nodes and edges with this node for a particular node | def remove_node(node)
@nodes_being_worked_on.delete(node)
@nodes.delete(node)
# the last edge keeps getting ignored when you remove this, so handling the final case
assign_node(@edges[0][1]) if @edges.size == 1
@edges.reject! { |edge| edge.include?(node) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(node)\n node.inputs.each do |producer_edge|\n producer_edge.from.outputs.reject! { |edge| edge.to == node }\n end\n\n node.outputs.each do |consumer_edge|\n consumer_edge.to.inputs.reject! { |edge| edge.from == node }\n end\n\n nodes.del... | [
"0.7532265",
"0.70715094",
"0.70563966",
"0.69391334",
"0.69204074",
"0.6869052",
"0.67679524",
"0.6723454",
"0.6667144",
"0.66671157",
"0.6653908",
"0.6612068",
"0.66102505",
"0.6605932",
"0.65623885",
"0.6544049",
"0.6544049",
"0.6488497",
"0.6462139",
"0.6447844",
"0.64476... | 0.72997206 | 1 |
First assign nodes to workers, and then count the seconds off each worker | def process_second
@seconds += 1
assign_nodes
process_workers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workers(count); end",
"def worker_count\n @action == 'run' ? 1 : workers\n end",
"def active_on_cluster_count\n (waiting_count + running_count)\n end",
"def worker_count()\n @workers.size\n end",
"def worker_count()\n @workers.size\n end",
"def missing_workers\n @opti... | [
"0.7240735",
"0.6631506",
"0.6394284",
"0.6354455",
"0.6354455",
"0.629941",
"0.61719173",
"0.61647886",
"0.6072421",
"0.6066781",
"0.604655",
"0.59918296",
"0.59715456",
"0.594274",
"0.5942223",
"0.59413034",
"0.5925082",
"0.58989596",
"0.58748287",
"0.5855831",
"0.5835867",... | 0.72736335 | 0 |
Adds a Pseudostate to this State. | def add_connectionPoint! s
_log { "add_connectionPoint! #{s.inspect}" }
if @connectionPoint.find { | x | x.name == s.name }
raise ArgumentError, "connectionPoint named #{s.name.inspect} already exists"
end
@connectionPoint << s
s.state = self
# Notify.
s.connectionPoint_added! self
s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_state(state)\n inferred_state = infer_state(state)\n self.states.upush! inferred_state if inferred_state\n end",
"def addstate ( ps )\n raise TypeError, ps.class.to_s + ': Incorrectly types for \\'<<\\' method of <Parser>.' unless\n\tps.instance_of? State\n\n @states << ps\n end",
"... | [
"0.55765295",
"0.54607874",
"0.5139848",
"0.5138874",
"0.504211",
"0.50295275",
"0.49795917",
"0.49791703",
"0.49349418",
"0.4918888",
"0.48471597",
"0.47565934",
"0.47565934",
"0.47565934",
"0.47557563",
"0.47550985",
"0.47549525",
"0.47235757",
"0.47175694",
"0.47154087",
"... | 0.0 | -1 |
Removes a Pseudostate from this State. | def remove_connectionPoint! s
_log { "remove_connectionPoint! #{s.inspect}" }
@connectionPoint.delete(s)
s.state = nil
# Notify.
s.connectionPoint_removed! self
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_state(state)\n states.remove(state)\n end",
"def remove_state(state)\n self.from(state).each { |transition| remove(transition) }\n self.to(state).each { |transition| remove(transition) }\n self.states.delete(state)\n end",
"def remove_from_state state, ios\n return if ios.empt... | [
"0.5979717",
"0.57304233",
"0.5560445",
"0.55487865",
"0.5495755",
"0.5405134",
"0.5283976",
"0.517858",
"0.5133871",
"0.50205034",
"0.5016034",
"0.5005394",
"0.4989734",
"0.49844682",
"0.49639606",
"0.49639606",
"0.4957162",
"0.49231005",
"0.49088806",
"0.4907291",
"0.490187... | 0.0 | -1 |
Returns true if this a start state. | def start_state?
@state_type == :start
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def started?\n @state == STATE_STARTED\n end",
"def running?\n @state == :started\n end",
"def start?\r\n start\r\n end",
"def started?\n @started\n end",
"def started?\n @started\n end",
"def started?\n @state != :created\n end",
"def started?\n ... | [
"0.8546305",
"0.8046395",
"0.7930488",
"0.78981346",
"0.78981346",
"0.78764534",
"0.7728927",
"0.7708898",
"0.7657222",
"0.76489013",
"0.7647868",
"0.7639584",
"0.7617122",
"0.75985754",
"0.75985754",
"0.7503758",
"0.7485786",
"0.744257",
"0.74422014",
"0.74149424",
"0.736786... | 0.91267204 | 0 |
Returns true if this an end state. | def end_state?
@state_type == :end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ended?\n\t\t\tstate == 'ended'\n\t\tend",
"def end?\n @status == :end\n end",
"def ended?\n !!@ended\n end",
"def ended?\n @ended\n end",
"def ended?\n !!@finished && !transition?\n end",
"def ended?\n return(self.ends_at < Time.now)\n end",
"def ended?\n en... | [
"0.8354746",
"0.8338693",
"0.7862258",
"0.78419566",
"0.76578397",
"0.76541805",
"0.7490499",
"0.7454582",
"0.74293077",
"0.7343483",
"0.7333606",
"0.7327331",
"0.73170483",
"0.72842264",
"0.72469896",
"0.72145516",
"0.71146953",
"0.70591986",
"0.70328486",
"0.70161873",
"0.7... | 0.89814514 | 0 |
Returns true if this State matches x or is a substate of x. | def === x
# $stderr.puts "#{self.inspect} === #{x.inspect}"
case x
when self.class
self.is_a_substate_of?(x)
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_a_substate_of? x\n self.ancestors.include?(x)\n end",
"def is_a_superstate_of? x\n x.ancestors.include?(self)\n end",
"def contains_x?(x)\n\t\t(self.left..self.right).include?(x);\n\tend",
"def state?(state)\n @state == state\n end",
"def in_or_after_state?(test_state)\n r... | [
"0.7849539",
"0.69354314",
"0.62772065",
"0.58552575",
"0.5783112",
"0.57808584",
"0.5702207",
"0.5694464",
"0.567237",
"0.5665709",
"0.5665709",
"0.5652542",
"0.56418973",
"0.5599023",
"0.55965835",
"0.5564319",
"0.55438274",
"0.5501651",
"0.54580486",
"0.54479164",
"0.54479... | 0.740121 | 1 |
Returns true if this State is a substate of x. All States are substates of themselves. | def is_a_substate_of? x
self.ancestors.include?(x)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_a_superstate_of? x\n x.ancestors.include?(self)\n end",
"def === x\n # $stderr.puts \"#{self.inspect} === #{x.inspect}\"\n case x\n when self.class\n self.is_a_substate_of?(x)\n else\n super\n end\n end",
"def isSubmachineState\n ! ! @submachine\n ... | [
"0.7557768",
"0.70673037",
"0.6455087",
"0.5892427",
"0.5886137",
"0.57861155",
"0.5657961",
"0.5624698",
"0.5515374",
"0.54992735",
"0.54143417",
"0.5406614",
"0.53588253",
"0.5335014",
"0.5286561",
"0.52826935",
"0.52713877",
"0.52675635",
"0.5247119",
"0.52331185",
"0.5232... | 0.8677874 | 0 |
Returns true if this State is a superstate of x. All States are superstates of themselves. | def is_a_superstate_of? x
x.ancestors.include?(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_a_substate_of? x\n self.ancestors.include?(x)\n end",
"def === x\n # $stderr.puts \"#{self.inspect} === #{x.inspect}\"\n case x\n when self.class\n self.is_a_substate_of?(x)\n else\n super\n end\n end",
"def super_and_sub?(sup, sub); end",
"def is_supe... | [
"0.77484745",
"0.708355",
"0.5812886",
"0.56504595",
"0.5633534",
"0.53952336",
"0.537603",
"0.52856153",
"0.52422816",
"0.5228173",
"0.5222996",
"0.52215654",
"0.52214503",
"0.52096343",
"0.5181934",
"0.5152315",
"0.5145117",
"0.51106036",
"0.5055891",
"0.5050865",
"0.504403... | 0.82940197 | 0 |
A state with isComposite=true is said to be a composite state. A composite state is a state that contains at least one region. Default value is false. | def isComposite
! ! @submachine
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def composite?\n false\n end",
"def composite?\n false\n end",
"def composite?; @composite; end",
"def composite?\n !shapes.empty?\n end",
"def composite?; self[:composite]; end",
"def state\n ret = self[:state] || {}\n if game.facts[:contraband] && game.facts[:contraband].i... | [
"0.67147475",
"0.67147475",
"0.62915754",
"0.6103282",
"0.6048136",
"0.5974599",
"0.5719796",
"0.55728376",
"0.55474865",
"0.5543379",
"0.54801726",
"0.5466995",
"0.54630053",
"0.54566044",
"0.5449095",
"0.5436063",
"0.54248947",
"0.5377968",
"0.5341084",
"0.53360635",
"0.532... | 0.65872866 | 2 |
A state with isOrthogonal=true is said to be an orthogonal composite state. An orthogonal composite state contains two or more regions. Default value is false. | def isOrthogonal
raise Error::NotImplemented, :message => :isOrthogonal, :object => self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orthogonal?\n @colt_property.isOrthogonal(@colt_matrix)\n end",
"def composite?\n false\n end",
"def composite?\n false\n end",
"def composite?\n !shapes.empty?\n end",
"def fOOrth\r\n end",
"def fOOrth\r\n end",
"def Matrix3dIsOrthogonal(arg0)\n ret = _invo... | [
"0.6146887",
"0.52151644",
"0.52151644",
"0.51851517",
"0.51488584",
"0.51488584",
"0.51258343",
"0.5104288",
"0.5079847",
"0.5079044",
"0.5079044",
"0.50709265",
"0.50416905",
"0.50009125",
"0.49915877",
"0.49877498",
"0.49842927",
"0.49645686",
"0.49493575",
"0.48900872",
"... | 0.66913474 | 0 |
A state with isSimple=true is said to be a simple state. A simple state does not have any regions and it does not refer to any submachine state machine. Default value is true. | def isSimple
raise Error::NotImplemented, :message => :isSimple, :object => self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_state?\n @state_type == :start\n end",
"def get_state\n return self.state == 't' || self.state == true\n end",
"def simple?\n true\n end",
"def stateful?\n true\n end",
"def state?\n usa?\n end",
"def boolean!\n # -> uncomment the next line to manually enable rule t... | [
"0.6418176",
"0.62676144",
"0.6224467",
"0.6139125",
"0.6101698",
"0.60610384",
"0.60348487",
"0.5992234",
"0.5944982",
"0.5880808",
"0.58668256",
"0.58348817",
"0.58233947",
"0.5819948",
"0.5819948",
"0.5806888",
"0.57899964",
"0.57864094",
"0.57849985",
"0.5783942",
"0.5772... | 0.5853322 | 11 |
A state with isSubmachineState=true is said to be a submachine state. Such a state refers to a state machine (submachine). Default value is false. | def isSubmachineState
! ! @submachine
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state?(state)\n @_state == state\n end",
"def state?(state)\n @state == state\n end",
"def get_state\n return self.state == 't' || self.state == true\n end",
"def has_state?\n !!current_state\n end",
"def state?\n usa?\n end",
"def isComposite\n ! ! @submachine\... | [
"0.6294503",
"0.6210016",
"0.6182318",
"0.6178241",
"0.61162686",
"0.61064464",
"0.6078177",
"0.6032297",
"0.60144484",
"0.60070306",
"0.59886426",
"0.5981271",
"0.59673",
"0.59620607",
"0.5946726",
"0.5945685",
"0.5945685",
"0.5914703",
"0.5874971",
"0.58738726",
"0.5859875"... | 0.8428747 | 0 |
Returns a NamedArray of all ancestor States. self is the first element. | def ancestors
@ancestors ||=
begin
x = [ self ]
if ss = superstate
x.push(*ss.ancestors)
end
NamedArray.new(x.freeze, :state)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ancestors\n []\n end",
"def all_active_states\n return [] unless __is_current__?\n return [self] if @substates.empty?\n\n @substates.reduce([]) do |arr, substate|\n arr.concat(substate.all_active_states) if substate.__is_current__? # concat mutates ;)\n arr\n end\n end",
... | [
"0.7137159",
"0.70319986",
"0.68577975",
"0.67584234",
"0.67583287",
"0.66906005",
"0.6610407",
"0.65746146",
"0.6526029",
"0.65129197",
"0.6512119",
"0.648894",
"0.6464761",
"0.6456015",
"0.6425596",
"0.64116263",
"0.6409109",
"0.6406646",
"0.6396961",
"0.6374533",
"0.635124... | 0.80961573 | 0 |
Called by Machine when State is entered. | def entry! machine, args
_behavior! :entry, machine, args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter_state\n end",
"def pre_enter(state_manager, game)\n # puts \"State : #{self.class}\"\n @exiting = false\n end",
"def enter!\n @state_machine.current_state = self\n\n @entry_actions.each do |entry_action|\n entry_action.call(@state_machine)\n end\n @trans... | [
"0.864452",
"0.7388078",
"0.7267375",
"0.7100114",
"0.7008565",
"0.69991297",
"0.6852792",
"0.6739538",
"0.673245",
"0.66867673",
"0.6661357",
"0.6661357",
"0.6661357",
"0.6661357",
"0.6661357",
"0.6661357",
"0.6661357",
"0.6661357",
"0.6517782",
"0.649624",
"0.64776254",
"... | 0.0 | -1 |
Called by Machine when State is exited. | def exit! machine, args
_behavior! :exit, machine, args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exit_state\n end",
"def exit e\n raise StateProcessorExit, e\n end",
"def exit_state\n puts \"Exiting #{self.class}\"\n execution_state = EXECUTION_STATE[:completed]\n end",
"def exit(state_manager, game)\n exiting = true\n end",
"def exit!\n map = @transition_map\n ... | [
"0.7859571",
"0.7460003",
"0.7445855",
"0.74094474",
"0.73574936",
"0.693379",
"0.69150406",
"0.6909679",
"0.68527645",
"0.67798895",
"0.6739769",
"0.6709862",
"0.67062205",
"0.66558194",
"0.6646841",
"0.66213185",
"0.6604686",
"0.65873843",
"0.6531353",
"0.65146357",
"0.6497... | 0.663212 | 15 |
Called by Machine when State is transitioned to. | def doActivity! machine, args
_behavior! :doActivity, machine, args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter_state\n end",
"def transition\n new_state = fetch_sensor_state\n return if new_state == @state\n puts \"Transitioned from #{@state} to #{new_state}\"\n if valid_transition?(new_state)\n @state = new_state\n # Do nothing\n else\n puts \"Invalid transition!\"\n @beam... | [
"0.73521835",
"0.7239314",
"0.6951051",
"0.69235647",
"0.6803045",
"0.6796859",
"0.6796859",
"0.6795984",
"0.6698488",
"0.66912794",
"0.6645278",
"0.6639114",
"0.6617801",
"0.6614779",
"0.6591182",
"0.6577655",
"0.6552369",
"0.65447086",
"0.6538006",
"0.6523302",
"0.6523302",... | 0.0 | -1 |
Called after this State is added to the StateMachine. | def state_added! statemachine
transitions_changed!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_state(state)\n end",
"def after_created\n super.tap do |val|\n app_state_bundle(self)\n end\n end",
"def after_created\n super.tap do |val|\n app_state_ruby(self)\n end\n end",
"def after_appending( state )\n\t\t# Nothing to d... | [
"0.7086918",
"0.68461746",
"0.684084",
"0.67249316",
"0.6607615",
"0.6184547",
"0.6177497",
"0.6144093",
"0.60873175",
"0.60567564",
"0.5937094",
"0.5930762",
"0.59305817",
"0.5927014",
"0.59043527",
"0.59043527",
"0.59043527",
"0.59043527",
"0.59043527",
"0.59043527",
"0.590... | 0.68584603 | 1 |
Called after a State removed from its StateMachine. | def state_removed! statemachine
transitions_changed!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_state(state)\n states.remove(state)\n end",
"def erase_state(state_id)\n super\n check_state_remove_effects(state_id)\n end",
"def pop_state\n @state.pop\n end",
"def destroy\n @state.destroy\n end",
"def destroy\n @state.destroy\n end",
"def destroyed(event)\n ... | [
"0.7106296",
"0.70077455",
"0.6975829",
"0.6958535",
"0.6958535",
"0.6926397",
"0.69051963",
"0.663011",
"0.6600804",
"0.6598869",
"0.6598869",
"0.6502423",
"0.64411944",
"0.63950866",
"0.63798195",
"0.63691187",
"0.63545805",
"0.62847775",
"0.62550706",
"0.6246275",
"0.62190... | 0.83318 | 0 |
Adds a Pseudostate to this State. | def add_connectionPoint! s
_log { "add_connectionPoint! #{s.inspect}" }
if @connectionPoint.find { | x | x.name == s.name }
raise ArgumentError, "connectionPoint named #{s.name.inspect} already exists"
end
@ownedMember << s # ownedElement?!?!
@connectionPoint << s
s.state = self
# Notify.
s.connectionPoint_added! self
s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_state(state)\n inferred_state = infer_state(state)\n self.states.upush! inferred_state if inferred_state\n end",
"def addstate ( ps )\n raise TypeError, ps.class.to_s + ': Incorrectly types for \\'<<\\' method of <Parser>.' unless\n\tps.instance_of? State\n\n @states << ps\n end",
"... | [
"0.55765295",
"0.54607874",
"0.5139848",
"0.5138874",
"0.504211",
"0.50295275",
"0.49795917",
"0.49791703",
"0.49349418",
"0.4918888",
"0.48471597",
"0.47565934",
"0.47565934",
"0.47565934",
"0.47557563",
"0.47550985",
"0.47549525",
"0.47235757",
"0.47175694",
"0.47154087",
"... | 0.0 | -1 |
Removes a Pseudostate from this StateMachine. | def remove_connectionPoint! s
_log { "remove_connectionPoint! #{s.inspect}" }
@ownedMember.delete(s) # ownedElement?!?!
@connectionPoint.delete(s)
s.state = nil
# Notify.
s.connectionPoint_removed! self
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_state(state)\n states.remove(state)\n end",
"def remove_state(state)\n self.from(state).each { |transition| remove(transition) }\n self.to(state).each { |transition| remove(transition) }\n self.states.delete(state)\n end",
"def remove_from_state state, ios\n return if ios.empt... | [
"0.5964532",
"0.5688853",
"0.5545519",
"0.5533242",
"0.5403126",
"0.52151054",
"0.5179823",
"0.50300175",
"0.50300175",
"0.502765",
"0.50002515",
"0.4985365",
"0.49594796",
"0.4955674",
"0.49229786",
"0.4909539",
"0.48985252",
"0.48846713",
"0.48604468",
"0.48604453",
"0.4854... | 0.4648106 | 45 |
Add a data attribute to each option of the select to indicate which category the choice is linked to, if any. This allows us to show and hide appropriate fields in JavaScript based on the category. | def options_for_select
choices.map do |choice|
data = {}
data["choice-category"] = choice.category_id if choice.category_id
content_tag(
:option,
choice.short_name,
:value => choice.id,
:selected => selected_choice?(item, choice),
:data => data
)
end.join.html_safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def option_selects\n content_profile_entries.map do |cpe|\n [cpe.description, cpe.id, {'data-description': \"#{cpe.content_type}:#{cpe.topic_type}\"} ]\n end\n end",
"def drink_categories \n # indicate this is coming from signup\n @create_drink_profile = true\n \n # set defaults\n @bee... | [
"0.55089647",
"0.51406014",
"0.51390284",
"0.5078232",
"0.4972901",
"0.49673536",
"0.4945094",
"0.48930055",
"0.4880096",
"0.48542184",
"0.48444992",
"0.4839115",
"0.48358876",
"0.48354906",
"0.48238724",
"0.48172763",
"0.4780239",
"0.47694516",
"0.4758345",
"0.4750634",
"0.4... | 0.6419283 | 0 |
Creating function which will take the file path and return the absolute path for it. | def getPath(target)
File.expand_path(File.join(File.dirname(__FILE__), target))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_absolute_path(file)\n File.expand_path file\nend",
"def abspath(file)\n File.absolute_path(file)\nend",
"def fullpath\n File.expand_path( @file )\n end",
"def file_path\n dir_name + file_name\n end",
"def f(path)\n File.dirname(__FILE__) + \"/\" + path\nend",
"def f(path)\n ... | [
"0.8412891",
"0.821072",
"0.7324445",
"0.73212904",
"0.7315222",
"0.7315222",
"0.7308162",
"0.7263403",
"0.7250167",
"0.7238373",
"0.7202978",
"0.7187968",
"0.7182794",
"0.71440583",
"0.7138835",
"0.7130809",
"0.7114592",
"0.70815",
"0.70579493",
"0.7031415",
"0.7028479",
"... | 0.0 | -1 |
Params: :number Fixnum The 1based sequential number representing the record's place under the bib record. (See lib/kuality_ole/data_objects/describe/marc_record.rb) :circulation_desk Object The OLE circulation desk to use. (See lib/kuality_ole/base_objects/etc/circulation_desk.rb) :call_number String The call number to use on the holdings record. :call_number_type String The holdings call number type. :location String The location for the holdings record. Defaults to a random selection from :circulation_desk. (See lib/kuality_ole/base_objects/etc/circulation_desk.rb) | def initialize(opts={})
defaults = {
:number => 1,
:circulation_desk => CirculationDesk.new,
:call_number => random_lcc,
:call_number_type => 'LCC',
:items => [ItemRecord.new]
}
@options = defaults.merge(opts)
# Select a Holdings location from the Circulation desk unless given.
@options[:location] ||= @options[:circulation_desk].locations.sample
set_opts_attribs(@options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callnumbers_from_945(record)\n callnumbers = []\n # Get the and b values to use as alternates\n # TODO: do we need to consider other fields (e.g. 099)?\n values_090ab = []\n x090ab = extract_marc(\"090ab\", :trim_punctuation => false)\n x090ab.call(record, values_090ab, nil)\n alternate_stem = values_09... | [
"0.5754502",
"0.5726902",
"0.5719064",
"0.564893",
"0.5638431",
"0.55748886",
"0.55748886",
"0.55579716",
"0.5534168",
"0.55070084",
"0.5491602",
"0.5445457",
"0.53901386",
"0.5379921",
"0.53433573",
"0.53317064",
"0.5296885",
"0.5295421",
"0.5294268",
"0.5220695",
"0.5185369... | 0.0 | -1 |
Create a new Item Record. | def new_item(opts={})
defaults = {:number => @items.count + 1}
@items << ItemRecord.new(defaults.merge(opts))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n \n #debug\n write_log(\n Const::SL::LOG_PATH_SL,\n \"items_controller#create(params[:item] => #{params[:item]})\",\n # __FILE__,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n \n @item = Item.new(params[:item])\n\n r... | [
"0.71818566",
"0.70745796",
"0.706473",
"0.6996472",
"0.6975625",
"0.695367",
"0.6938458",
"0.69055516",
"0.68687993",
"0.68202734",
"0.6817313",
"0.6815403",
"0.6807482",
"0.68023145",
"0.67395693",
"0.67165935",
"0.67165935",
"0.67165935",
"0.66843593",
"0.66820943",
"0.668... | 0.7281687 | 0 |
SHA1 from random salt and time | def generate_access_token
self.access_token = Digest::SHA1.hexdigest("#{random_salt}#{Time.now.to_i}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_salt\n d = Digest::SHA1.new\n now = Time.now\n d.update(now.to_s)\n d.update(String(now.usec))\n d.update(String(rand(0)))\n d.update(String($$))\n d.update('wxtengu.net')\n d.hexdigest\n end",
"def generate_salt\n Digest::SHA1.hexdigest(Time.now.to_f.to_s)\n e... | [
"0.80259615",
"0.8023818",
"0.77334017",
"0.75979465",
"0.7589524",
"0.7567159",
"0.7516362",
"0.75071925",
"0.74795616",
"0.74795616",
"0.7473809",
"0.7473809",
"0.74353564",
"0.72481304",
"0.7150325",
"0.7124441",
"0.70152485",
"0.70152485",
"0.7003422",
"0.6972043",
"0.696... | 0.0 | -1 |
Default award blows up: enforce subclass impl. | def update
raise 'Unimplemented award type update!'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispatch\n raise(NotImplemetedError, \"subclass responsability\")\n end",
"def inherited(subclass); end",
"def inherited(klass); end",
"def inherited(klass); end",
"def superclass() end",
"def inherited(base); end",
"def award; end",
"def subclass_responsibility\n raise SubclassRes... | [
"0.6986472",
"0.63125956",
"0.6234999",
"0.6234999",
"0.6099691",
"0.6068501",
"0.60386944",
"0.5973817",
"0.5859422",
"0.58170426",
"0.57990134",
"0.5797329",
"0.57708263",
"0.5677208",
"0.5677208",
"0.56476194",
"0.56460786",
"0.5640153",
"0.5621632",
"0.5609746",
"0.559156... | 0.6176183 | 4 |
Initializes all output filenames and folders for later use names object of class Filename; contains filenames & folders force_overwrite If true, pipeline will overwrite all existing files Returns nothing | def initialize(names, force_overwrite)
@names = names
@force_overwrite = force_overwrite
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_files\n @output_files ||= Fileset.new()\n end",
"def output_files\n @output_files ||= Fileset.new\n end",
"def output_files\n @output_files ||= Fileset.new\n end",
"def create_output_files\n return unless @option_output_path\n return if @collected_nodes.empty?... | [
"0.6232518",
"0.6184175",
"0.6184175",
"0.59729785",
"0.59653115",
"0.59573036",
"0.5955682",
"0.586235",
"0.5650143",
"0.5644276",
"0.5609321",
"0.55744547",
"0.5573275",
"0.5573275",
"0.55628407",
"0.550828",
"0.5458454",
"0.5405517",
"0.5376202",
"0.5362049",
"0.5338774",
... | 0.5112694 | 46 |
Verbosely checks if file should be processed filename file whose existance will be checked step name of pipeline step | def skip_step?(filename, step)
if File.exist?(filename) && !@force_overwrite
print_e "SKIPPED #{step}: #{filename} already exists."
true
else
print_e "RUN #{step} => #{filename}"
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_fixture_exists?(filename, step = '')\n return true if File.exist?(Rails.root.join(UPLOADED_FILES_DIR, filename))\n\n raise \"ERROR in step: '#{step}'\\n\" +\n \" The file #{filename}\\n\" +\n \" must exist in #{UPLOADED_FILES_DIR}\\n\" +\n \" but it doesn't. Either correct ... | [
"0.7120127",
"0.6571621",
"0.6322864",
"0.63166326",
"0.62577915",
"0.6230915",
"0.6212493",
"0.6163979",
"0.60827714",
"0.6009272",
"0.5990768",
"0.5990521",
"0.5979753",
"0.5979753",
"0.5974482",
"0.5944724",
"0.5919892",
"0.5919619",
"0.5919449",
"0.59115267",
"0.5900052",... | 0.69970137 | 1 |
Quality filters reads minlen discard all shorter reads Returns nothing | def filter(minlen)
return if skip_step?(@names.get('filter'), 'filtering')
# Only filter input files from Illumina CASAVA 1.8 pipeline
if `head -n 1 #{@names.get('reads')} | cut -d ' ' -f 3`.empty?
run_cmd(
'fastq_illumina_filter' \
" --keep N -v -l #{minlen} " \
" -o #{@names.get('filter')}" \
" #{@names.get('reads')}"
)
else
@names.set('filter', '.fastq')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_quality(min_quality)\n mode_lines = @raw_data.scan(/harminv.*:, (\\d.*)/).join \"\\n\"\n CSV.parse(mode_lines,\n :converters => :numeric).find_all {|nums| nums[2].abs > min_quality}\n end",
"def truncate_samples\n @samples.sort!{|a,b| a.duration <=> b.duration}\n ... | [
"0.6319621",
"0.59022206",
"0.56703275",
"0.554758",
"0.547377",
"0.5358833",
"0.52611023",
"0.52033067",
"0.5195612",
"0.518653",
"0.5154959",
"0.5139686",
"0.5112837",
"0.50397307",
"0.5037474",
"0.5036198",
"0.5016747",
"0.5008545",
"0.49940056",
"0.49842885",
"0.49832982"... | 0.7177229 | 0 |
Clips linker from 3' linker string to be clipped from 3' software clipping software (fastx, cutadapt) error_rate allowed error rate (only for cutadapt) minlen discard all shorter reads Returns nothing. | def clip(linker, software, error_rate, minlen)
return if skip_step?(@names.get('clip'), 'clipping')
clipper_cmd = {
fastx: \
'fastx_clipper' \
' -Q33 -c -n -v' \
" -a #{linker}" \
" -l #{minlen}" \
" #{@names.base}" \
" -i #{@names.get('filter')}" \
" -o #{@names.get('clip')}",
cutadapt: \
'cutadapt' \
" -a #{linker}" \
' --trimmed-only' \
" -e #{error_rate}" \
" -m #{minlen}" \
" -o #{@names.get('clip')}" \
" #{@names.get('filter')}" \
"> #{@names.get('cliplog')}"
}
run_cmd(clipper_cmd[software])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spelling_penalty\n chars.inject_with_index(0) do |penalty, char, i| \n if i < @options[:target].size\n # add to penalty the differences between ascii values in the two strongs * the multiplier\n penalty + ((@options[:target][i] - char[0]).abs * @options[:spelling_multiplier])\n ... | [
"0.48733142",
"0.47056305",
"0.47010913",
"0.47010913",
"0.46958846",
"0.46873704",
"0.4680276",
"0.45950803",
"0.45738348",
"0.45472252",
"0.45407587",
"0.4518334",
"0.4510734",
"0.44531837",
"0.44484276",
"0.44479308",
"0.44177917",
"0.43902066",
"0.43876725",
"0.43861017",
... | 0.66380143 | 0 |
Trims nucleotide from the 5' end of each read Returns nothing | def trim
return if skip_step?(@names.get('trim'), 'trimming')
run_cmd(\
'fastx_trimmer -Q33 -f 2' \
" -i #{@names.get('clip')}" \
" -o #{@names.get('trim')}"
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trim(n)\r\n @text = @text[n..-1] || \"\"\r\n end",
"def trim\n repeat_until_unchanged(&:trim_once)\n end",
"def _strip seq\n seq.shift while (tok = seq.first) && tok.type == :endline\n end",
"def rstrip!() end",
"def drop_from_each_line(n)\n self.lines.map do |line|\n k ... | [
"0.5708526",
"0.5702116",
"0.5659281",
"0.5645462",
"0.55234194",
"0.5460344",
"0.5375854",
"0.5361511",
"0.5352391",
"0.53510356",
"0.5338272",
"0.532415",
"0.5315767",
"0.52379984",
"0.5136319",
"0.51339257",
"0.5115226",
"0.5104202",
"0.5103664",
"0.50995904",
"0.5087479",... | 0.54237974 | 6 |
PreComputes index if it does not exist ref path to reference ref_base path to reference without file extension software alignment software (bowtie1, bowtie2, bwa, star) annotation path to GTF annotation (only star) Returns nothing | def index(ref, ref_base, software, annotation = '')
index_suffix = {
bowtie1: '4.ebwt',
bowtie2: '4.bt2',
bwa: '.sa',
star: '.star'
}
index_cmd = {
bowtie1: "bowtie-build -p #{ref} #{ref_base}",
bowtie2: "bowtie2-build -p #{ref} #{ref_base}",
bwa: "bwa index #{ref}",
star: "mkdir #{ref_base} && "\
'STAR --runMode genomeGenerate' \
' --runThreadN $(nproc)' \
" --genomeDir #{ref_base}"\
" --genomeFastaFiles #{ref}"\
' --sjdbOverhang 49' \
" --sjdbGTFfile #{annotation} "
}
time = 5
while File.exist?("#{ref_base}.lock")
print_e "#{ref_base}.lock exists. Wait for #{time} seconds."
sleep(time)
time *= 5
end
return if software == :tophat ||
skip_step?("#{ref_base}.#{index_suffix[software]}", 'indexing')
begin
run_cmd("touch #{ref_base}.lock")
run_cmd(index_cmd[software])
ensure
run_cmd("rm -f #{ref_base}.lock")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute\n index(@ref, @ref_base, @software, @annotation)\n\n if @err_rate > 0\n bucketized_alignment\n else # software == :star || err_rate == 0\n unbucketized_alignment\n end\n end",
"def initialize(annot)\n @annot = annot\n @id2name = {}\n @... | [
"0.55707574",
"0.5537845",
"0.52282965",
"0.5211746",
"0.514618",
"0.5114455",
"0.50818527",
"0.5056654",
"0.504273",
"0.50184566",
"0.50184566",
"0.49482235",
"0.4944961",
"0.49263582",
"0.48924422",
"0.48880744",
"0.48818028",
"0.48589686",
"0.48510918",
"0.48327085",
"0.47... | 0.6362013 | 0 |
Performs alignment ref path to genomic reference ref_base path to reference without file extension software alignment software (bowtie1, bowtie2, bwa, star, tophat) opts stepspecific options :annotation path to genomic annotation :mismatches max num of mismatches in alignment :seedlen seed length for ncRNA alignment :tophat_aligner software that tophat uses (bowtiet1 / 2) Returns name of files containing mapped and unmapped reads | def align(ref, ref_base, software, opts = {})
if software == :tophat
bt_flag =
opts[:tophat_aligner] == :bowtie1 ? '--bowtie1' : ''
gap_flag =
opts[:mismatches] < 2 ? "--read-gap-length #{opts[:mismatches]}" : ''
end
aln_cmd = {
bowtie1:
'bowtie' \
" --seedlen=#{opts[:seedlen]} #{ref_base}" \
" --un=#{@names.get('fp')}" \
" -q #{@names.get('trim')} " \
" --sam #{@names.get('ncrna')}",
bowtie2:
'bowtie2' \
" --un #{@names.get('fp')}" \
" -x #{ref_base}" \
" -L #{opts[:seedlen]}" \
" -U #{@names.get('trim')}" \
" -S #{@names.get('ncrna')}",
bwa:
'bwa mem' \
" -k #{opts[:seedlen]}" \
" #{ref} " \
" #{@names.get('trim')} " \
"| samtools view -b - > #{@names.get('ncrna')} " \
'&& bam2fastq' \
" -o #{@names.get('fp')}" \
" --no-aligned #{@names.get('ncrna')}",
tophat:
'tophat' \
" --read-edit-dist #{opts[:mismatches]}" \
" #{bt_flag}" \
" -N #{opts[:mismatches]}" \
" --output-dir #{@names.get('topout')}" \
' --no-novel-juncs' \
" #{gap_flag}" \
" --GTF #{opts[:annotation]}" \
" #{ref_base} #{@names.get('fp')}",
star:
'STAR' \
" --genomeDir #{ref_base}" \
" --outFilterMismatchNmax #{opts[:mismatches]}" \
" --readFilesIn #{@names.get('fp')}"\
" --outFileNamePrefix #{@names.get('mapped_all')}"
}
target =
opts[:seedlen].nil? ? @names.get('mapped_all') : @names.get('fp')
run_cmd(aln_cmd[software]) unless skip_step?(target, 'aligning')
[@names.get('mapped_all'), @names.get('unmapped')]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unbucketized_alignment\n align(\n @ref, @ref_base, @software,\n { annotation: @annotation,\n tophat_aligner: @tophat_aligner,\n mismatches: @mismatches\n }\n )\n mapped_all = @software == :star ? \\\n @names.get('mapped_all_star') :... | [
"0.5709553",
"0.5528572",
"0.54516274",
"0.5200783",
"0.51840615",
"0.5138118",
"0.50645435",
"0.49660274",
"0.49483785",
"0.4883737",
"0.4859847",
"0.48551404",
"0.483638",
"0.48274213",
"0.48274213",
"0.4795258",
"0.47941756",
"0.47817165",
"0.47717196",
"0.47586805",
"0.47... | 0.7185728 | 0 |
Performs alignment to ncRNA reference; only unaligned reads will be processed further | def compute
index(@ref, @ref_base, @software)
align(@ref, @ref_base, @software, {seedlen: @seedlen})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_alignment\n # init vars\n @names = []\n @seqs = []\n \n @alignment = \"-B #{@basename}.aln\"\n\n # import alignment file\n @content = IO.readlines(@infile).map {|line| line.chomp}\n \n #check alignment for gap-only columns\n remove_inserts\n \n #write query-file\n ... | [
"0.64750266",
"0.6085275",
"0.5994836",
"0.5935136",
"0.5934424",
"0.58259934",
"0.5712599",
"0.5695768",
"0.5645835",
"0.55811363",
"0.55595046",
"0.55595046",
"0.5535473",
"0.55088663",
"0.5488692",
"0.5471203",
"0.529536",
"0.5294155",
"0.52850974",
"0.5182773",
"0.515628"... | 0.55670184 | 10 |
Initializes genomic alignment parameters annotation genomic annotation, needed for splicing awareness tophat_aligner software that Tophat uses (bowtie2 or bowtie1) mismatches max number of allowed mismatches in Tophat alignment err error rate for STAR / bucketizing | def initialize(names, force_overwrite, ref, software,
annotation, tophat_aligner, mismatches, err_rate)
super(names, force_overwrite, ref, software)
@annotation = annotation
@tophat_aligner = tophat_aligner
@mismatches = mismatches
@err_rate = err_rate
@mapped_bams = []
@unmapped_bams = []
@max_mismatches = 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(seq_name,seq_fasta,seq_qual, seq_comment = '')\n super\n\n @actions = []\n @seq_fasta_orig = seq_fasta\n @seq_fasta = seq_fasta\n \n @seq_qual_orig = seq_qual\n @seq_qual = seq_qual \n \n @insert_start = 0\n @insert_end = seq_fasta.length-1 \n \n @stats={}\n ... | [
"0.52725923",
"0.5269229",
"0.5243173",
"0.515901",
"0.51487947",
"0.50884366",
"0.5077564",
"0.49884474",
"0.49591947",
"0.49542058",
"0.4874891",
"0.4868386",
"0.48597658",
"0.48050168",
"0.47810596",
"0.475977",
"0.47541583",
"0.4708687",
"0.4702784",
"0.47009873",
"0.4695... | 0.6461289 | 0 |
Performs genomic alignment. As Tophat does only allow for an absolute number of errors, reads will be split into several files according to | def compute
index(@ref, @ref_base, @software, @annotation)
if @err_rate > 0
bucketized_alignment
else # software == :star || err_rate == 0
unbucketized_alignment
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_alignment\n # init vars\n @names = []\n @seqs = []\n \n @alignment = \"-B #{@basename}.aln\"\n\n # import alignment file\n @content = IO.readlines(@infile).map {|line| line.chomp}\n \n #check alignment for gap-only columns\n remove_inserts\n \n #write query-file\n ... | [
"0.6870922",
"0.64567596",
"0.6185963",
"0.601857",
"0.5963206",
"0.59329545",
"0.5902964",
"0.58885527",
"0.5840516",
"0.5804533",
"0.57673323",
"0.5726356",
"0.57167673",
"0.5711429",
"0.5706999",
"0.56836855",
"0.5670119",
"0.56245196",
"0.5620191",
"0.56082445",
"0.560475... | 0.47745046 | 96 |
Performs genomic alignment with relative error rate (buckets) | def bucketized_alignment
# split reads into buckets according to their size and err_rate
@buckets = bucketize(@err_rate)
# perform alignment on each bucket
@buckets.reverse_each do |lower, upper, mismatches|
@names.set_bucket(lower, upper)
mapped, unmapped = align(
@ref, @ref_base, @software,
{ annotation: @annotation,
tophat_aligner: @tophat_aligner,
mismatches: mismatches
}
)
@mapped_bams << mapped
@unmapped_bams << unmapped
@max_mismatches = [@max_mismatches, mismatches].max
end
# merge alignments
@names.unset_bucket
unbucketize(@mapped_bams, @names.get('mapped_merged'))
unbucketize(@unmapped_bams, @names.get('unmapped_merged'))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute\n index(@ref, @ref_base, @software, @annotation)\n\n if @err_rate > 0\n bucketized_alignment\n else # software == :star || err_rate == 0\n unbucketized_alignment\n end\n end",
"def genome(liszt)\n=begin\n[samopen] SAM header is present: 2 sequences\n... | [
"0.6932818",
"0.62225187",
"0.59439397",
"0.56329626",
"0.56171745",
"0.56026036",
"0.5581892",
"0.5529177",
"0.54790694",
"0.54771227",
"0.53738934",
"0.53588796",
"0.5328883",
"0.53188115",
"0.52838665",
"0.5278783",
"0.5278012",
"0.52259076",
"0.5207305",
"0.51924706",
"0.... | 0.74868 | 0 |
Performs genomic alignment with fixed number of allowed mismatches | def unbucketized_alignment
align(
@ref, @ref_base, @software,
{ annotation: @annotation,
tophat_aligner: @tophat_aligner,
mismatches: @mismatches
}
)
mapped_all = @software == :star ? \
@names.get('mapped_all_star') : @names.get('mapped_all')
run_cmd("cp #{mapped_all} #{@names.get('mapped_merged')}")
unless @software == :star
run_cmd(
"cp #{@names.get('unmapped')} #{@names.get('unmapped_merged')}"
)
end
@max_mismatches = @mismatches
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_alignment\n # init vars\n @names = []\n @seqs = []\n \n @alignment = \"-B #{@basename}.aln\"\n\n # import alignment file\n @content = IO.readlines(@infile).map {|line| line.chomp}\n \n #check alignment for gap-only columns\n remove_inserts\n \n #write query-file\n ... | [
"0.62253803",
"0.58747196",
"0.5843623",
"0.5830741",
"0.5824848",
"0.5820188",
"0.58144766",
"0.5750869",
"0.5593341",
"0.55397415",
"0.5529191",
"0.54764867",
"0.54322106",
"0.5425921",
"0.54136413",
"0.5409192",
"0.5378132",
"0.53759843",
"0.53000605",
"0.5279042",
"0.5265... | 0.61717033 | 1 |
Splits reads into several files containing a read length range to allow for seperate alignments with a relative number of errors. error rate = num of errors / read length Returns array. | def bucketize(error_rate)
buckets = []
run_cmd(
"fastq-bucketize #{@names.get('fp')} #{error_rate} " \
"2> #{@names.get('buckets')}"
)
# parse buckets and compute corresponding absolute number of errors
File.readlines(@names.get('buckets')).each do |line|
next if line[0] == '#' # comment
line = line.split.map(&:to_i)
fail if (line[0] * error_rate).floor != (line[1] * error_rate).floor
# push [lower bound, upper bound, absolute #errors]
buckets.push([line[0], line[1], (line[0] * error_rate).floor]) \
unless line[1] < 14 # TODO: implement minlen option
end
buckets
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_by_40_characters \n recieve_and_read_file.scan(/.{1,40}/)\n end",
"def sub_chunks(data_offset: 0, sub_chunk_size_length: @size_length, sub_chunk_header_size: @header_size, sub_chunks_format: @chunks_format, warnings: @warnings, debug: @debug, &callback)\n data_size = self.size\n data_size... | [
"0.52647674",
"0.51238215",
"0.49227256",
"0.4905906",
"0.4859709",
"0.48278394",
"0.47935632",
"0.47273198",
"0.47244495",
"0.4696616",
"0.4696616",
"0.4687543",
"0.4668299",
"0.46392527",
"0.4590947",
"0.4578109",
"0.45562068",
"0.4546629",
"0.4539287",
"0.4511761",
"0.4499... | 0.55839044 | 0 |
Merges bucketed alignments into single bam file infiles array of filenames outfile merged file | def unbucketize(infiles, outfile)
run_cmd("samtools merge -f #{outfile} #{infiles.join(' ')}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bucketized_alignment\n # split reads into buckets according to their size and err_rate\n @buckets = bucketize(@err_rate)\n\n # perform alignment on each bucket\n @buckets.reverse_each do |lower, upper, mismatches|\n @names.set_bucket(lower, upper)\n mapped, unmappe... | [
"0.627244",
"0.6105935",
"0.60039854",
"0.58686095",
"0.56690675",
"0.5590018",
"0.556866",
"0.55033255",
"0.54632646",
"0.5396619",
"0.53854",
"0.5342837",
"0.5342266",
"0.53063905",
"0.52958137",
"0.5234907",
"0.51962095",
"0.5195997",
"0.5194503",
"0.5163467",
"0.51433927"... | 0.7179231 | 0 |
Extracts uniquely mapping reads | def extract_uni
# Extract all uniquely mapping reads
run_cmd(
"samtools view -H #{@names.get('mapped_merged')} " \
"> #{@names.get('mapped_uniq')}"
)
run_cmd(
"samtools view -h #{@names.get('mapped_merged')} " \
"| grep -P 'NH:i:1(\t|$)' " \
">> #{@names.get('mapped_uniq')}"
)
run_cmd(
"samtools sort -o #{@names.get('mapped_uniqsort')} -O bam -T " \
"tmp.bam #{@names.get('mapped_uniq')}"
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remapped_reads(input_file, output_file, read_length, mm=2)\n\t\tremapped = {}\n\t\t\n\t\t# Filter remapped reads\n\t\tinput_file.each do |line|\n\t\t\tmdz = line.match(/MD:Z:\\S*/).to_s\n\t\t\tline = line.strip.split(/\\s+/)\n\t\t\tqname, mate = line[0].split('/')\n\t\t\tpos = line[2].split(':')\n\t\t\tcigar =... | [
"0.6373402",
"0.6143493",
"0.59263504",
"0.57691497",
"0.5676399",
"0.5657573",
"0.5556849",
"0.5538333",
"0.55204505",
"0.5498366",
"0.5496701",
"0.5448031",
"0.53502053",
"0.5329921",
"0.52846646",
"0.52826154",
"0.5208021",
"0.5208021",
"0.51964045",
"0.51787305",
"0.51546... | 0.740286 | 0 |
Extracts uniquely mapping reads with i mismatches mis number of mismatches | def extract_uni_err(mis)
run_cmd(
"samtools view -H #{@names.get('mapped_uniqsort')}" \
"> #{@names.get('mapped_uni', mis)}"
)
run_cmd(
"samtools view -h #{@names.get('mapped_uniqsort')} " \
"| grep -E '([nN]M:i:#{mis})|(^@)' " \
'| samtools view -S - ' \
">> #{@names.get('mapped_uni', mis)}"
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_uni\n # Extract all uniquely mapping reads\n run_cmd(\n \"samtools view -H #{@names.get('mapped_merged')} \" \\\n \"> #{@names.get('mapped_uniq')}\"\n )\n run_cmd(\n \"samtools view -h #{@names.get('mapped_merged')} \" \\\n \"| grep -P 'NH... | [
"0.65094244",
"0.6354108",
"0.57296443",
"0.5531168",
"0.54432726",
"0.54402244",
"0.54064965",
"0.5360847",
"0.5306777",
"0.527252",
"0.52692294",
"0.5225156",
"0.5133353",
"0.5085653",
"0.50643885",
"0.50435126",
"0.50378704",
"0.5035234",
"0.49929872",
"0.49865535",
"0.496... | 0.5501095 | 4 |
GET /services GET /services.xml | def index
submenu_item 'services-index'
@services = Service.paginate query(:page => params[:page])
@service_types = ServiceType.all :select =>"distinct service_types.id, service_types.name, service_types.alias, service_types.serviceable_type", :joins => "inner join services t1 on t1.type_id = service_types.id and t1.tenant_id = #{current_user.tenant_id}"
status_tab
session[:service_summary] = @summary
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @services }
format.csv {
send_data(@service.metric_data, :type => 'text/csv; header=present', :filename => 'chart_data.csv')
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n endpoint(get(services_url).body)\n end",
"def list_services\n response = @http_client.get(prefix_path('services'))\n Response.new(response)\n end",
"def all(options = {})\n out = xml_run build_command('services', options.merge(:get => XML_COMMANDS_GET))\n convert_outp... | [
"0.7579505",
"0.73009115",
"0.6991401",
"0.6859058",
"0.6828459",
"0.6824559",
"0.658619",
"0.6579678",
"0.65689564",
"0.6517968",
"0.65074795",
"0.64588135",
"0.64162534",
"0.6404057",
"0.63568646",
"0.6342013",
"0.63139445",
"0.63027984",
"0.62867755",
"0.6264572",
"0.62580... | 0.0 | -1 |
GET /services/1 GET /services/1.xml | def show
@service = Service.find(params[:id], :conditions => conditions)
@alerts = Alert.all({
:conditions => ["service_id = ? and severity <> 0", @service.id]
})
params[:date] = Date.today.to_s if params[:date].blank?
@date_range = parse_date_range params[:date]
@metric = @service.metric
now = Time.now
#now = Time.parse("2010-6-10 12:00") #for test
d = @metric.history({:start => now - 24*60*60, :finish => now})
if d.size > 0
@history_views = @service.history_views
@history_views.each do |view|
view.data = d
end
end
d = @metric.current
if d
@default_view = @service.default_view
@default_view.data = d if @default_view
@current_views = @service.views
@current_views.each do |view|
view.data = d
end
end
respond_to do |format|
format.html # show.html.erb
format.xml {
#render :xml => @service.to_xml(:dasherize => false)
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service(id)\n request :get, \"/services/#{id}\"\n end",
"def index\n endpoint(get(services_url).body)\n end",
"def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service }\n end\n end",
"... | [
"0.723194",
"0.721514",
"0.6730267",
"0.67126286",
"0.6581411",
"0.6567619",
"0.6438637",
"0.64325076",
"0.6306425",
"0.6260527",
"0.6197347",
"0.61746657",
"0.61644286",
"0.6164009",
"0.6106485",
"0.6106036",
"0.6087944",
"0.6068472",
"0.6034685",
"0.6034039",
"0.6010789",
... | 0.0 | -1 |
select host or app | def select
@type = params[:type]
@hosts = Host.all :select => "id, name" , :conditions => { :tenant_id => current_user.tenant_id } if @type == "host"
@apps = App.all :select => "id, name" , :conditions => { :tenant_id => current_user.tenant_id } if @type == "app"
@sites = Site.all :select => "id, name" , :conditions => { :tenant_id => current_user.tenant_id } if @type == "site"
@devices = Device.all :select => "id, name" , :conditions => { :tenant_id => current_user.tenant_id } if @type == "device"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def if_app(app, req)\n app == :dashboard ? (req + '.http.host ~ \"(dashboard|studio)\"') : nil\nend",
"def dev_host\n case Socket.gethostname\n when /romeo-foxtrot/i ; true\n else ; false\n end\nend",
"def app_host\n @data[\"app_host\"]\n end",
"def selected_host\n\t\tselhost = Target.find(:firs... | [
"0.6547287",
"0.6383476",
"0.62955004",
"0.6291793",
"0.62753516",
"0.61840636",
"0.6124936",
"0.6103736",
"0.6068235",
"0.6048353",
"0.59888935",
"0.5938477",
"0.5929573",
"0.59189403",
"0.59010845",
"0.5884807",
"0.5877257",
"0.58755",
"0.58680695",
"0.5856544",
"0.58012766... | 0.54177153 | 73 |
GET /services/new GET /services/new.xml | def new
submenu_item 'services-new'
@service = Service.new(:type_id => params[:type_id], :check_interval => 300)
@service_type = @service.type
service_param
unless @service_type
if @app
redirect_to types_app_services_path(@app)
elsif @site
redirect_to types_site_services_path(@site)
elsif @host
redirect_to types_host_services_path(@host)
elsif @device
redirect_to types_device_services_path(@device)
else
redirect_to params.update(:action => "select")
end
return
end
dictionary
s = @serviceable
@service.agent_id = @host.agent_id if @host
@service.serviceable_id = s && s.id
@service.name = @service_type.default_name
@service.ctrl_state = @service_type.ctrl_state
@service.threshold_critical = @service_type.threshold_critical
@service.threshold_warning = @service_type.threshold_warning
@service.check_interval = @default_check_interval
respond_to do |format|
format.html
format.xml { render :xml => @service }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @page_id = \"services\"\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end",
"def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml\... | [
"0.75526565",
"0.751664",
"0.74515957",
"0.74515957",
"0.7020331",
"0.6930191",
"0.672832",
"0.67085844",
"0.67085844",
"0.67085844",
"0.67085844",
"0.66661394",
"0.6652868",
"0.6649297",
"0.66376245",
"0.6555149",
"0.6471848",
"0.647095",
"0.6424378",
"0.6417366",
"0.6382543... | 0.6335051 | 27 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.