Run and return the results from the DuplicateScripts plugin.

        Only takes into account scripts with more than 3 blocks.
760632
def analyze(self, scratch, **kwargs):
        
        scripts_set = set()
        for script in self.iter_scripts(scratch):
            if script[0].type.text == 'define %s':
                continue  # Ignore user defined scripts
            blocks_list = []
            for name, _, _ in self.iter_blocks(script.blocks):
                blocks_list.append(name)
            blocks_tuple = tuple(blocks_list)
            if blocks_tuple in scripts_set:
                if len(blocks_list) > 3:
                    self.total_duplicate += 1
                    self.list_duplicate.append(blocks_list)
            else:
                scripts_set.add(blocks_tuple)
1028017
def run(self, args):
        
        module_dir = os.path.dirname(__file__)
        self.match_plugins = self.load_plugins(os.path.join(module_dir, 'matchplugins/'))
        self.action_plugins = self.load_plugins(os.path.join(module_dir, 'actionplugins/'))

        if args['--list-plugins'] is True:
            print("\nAvailable Match Plugins:")
            for m in sorted(self.match_plugins):
                print(m)
            print("\nAvailable Action Plugins:")
            for a in sorted(self.action_plugins):
                print(a)
            sys.exit()

        rule_yaml = self.load_rules(args['RULEFILE'])
        rules = self.build_rules(rule_yaml, self.match_plugins, self.action_plugins)

        files_analyzed = 0
        files_matched = 0
        result_count = collections.defaultdict(int)

        for cur_file in self.get_files(args['DIRECTORY']):
            self.logger.debug("Processing {0}".format(cur_file))
            files_analyzed += 1

            for ruleset in rules:
                if ruleset.matches_all_rules(cur_file):
                    files_matched += 1
                    result_count[ruleset] += 1
                    # If the file matches all rules in the ruleset, do whatever
                    # actions the ruleset specifies. Stop processing if the
                    # ruleset says stop.
                    try:
                        ruleset.do_actions(cur_file, args['--dry-run'])
                    except StopProcessingException:
                        break

        self.logger.info("Files matched: {0}/{1}".format(files_matched, files_analyzed))
        for ruleset in sorted(result_count):
            self.logger.info("{0}: {1} files".format(ruleset.name, result_count[ruleset]))
1128558
def map(self, fn, *seq):
        " "
        "block until done."
        results = Queue()
        args = zip(*seq)
        for seq in args:
            j = SimpleJob(results, fn, seq)
            self.put(j)

        # Aggregate results
        r = []
        for i in range(len(list(args))):
            r.append(results.get())

        return r
120805
function() {
      if (common.inlinescripts.length > 0) {
        var script_text = '';
        for (var i = 0; i < common.inlinescripts.length; i++) {
          if (!common.inlinescripts[i] || typeof common.inlinescripts[i] == 'undefined') 
            continue;
          else
            script_text += common.inlinescripts[i] + '\n';
        }
        try {
          eval(script_text);
        } catch(e) {
          batch.callback(script_text);
        }
      }
    }
483761
function getScripts(chunks) {
  let scripts = [];

  // Used when skipping the build, short-circuit to return metadata
  if (chunks.metadata) {
    return chunks.metadata;
  }

  sorter.dependency(chunks).forEach((chunk) => {
    scripts.push({
      name: chunk.files[0]
    });
  });

  return scripts;
}
1324224
def execute_script(self, name, keys, *args, **options):
        '''
        '''
        script = get_script(name)
        if not script:
            raise redis.RedisError('No such script "%s"' % name)
        address = self.address()
        if address not in all_loaded_scripts:
            all_loaded_scripts[address] = set()
        loaded = all_loaded_scripts[address]
        toload = script.required_scripts.difference(loaded)
        for name in toload:
            s = get_script(name)
            yield self.script_load(s.script)
        loaded.update(toload)
        yield script(self, keys, args, options)
1149929
function listBlocks(plugins) {
    return plugins
        .reverse()
        .reduce(function(result, plugin) {
            var blocks = plugin.getBlocks();
            return result.merge(blocks);
        }, Immutable.Map());
}
471993
function reRunBlock(block, index, callback){
  growing:
  for(var i=index; i<block.length; i++){ //iterate over the block [body, header, etck] *
    var code=block[i].substr(0,2);//                                            |      |
    if (code=== ">>") {//The only tag  by deffault                         |    |      |
      printBrand(block[i]);//                                              |    |      |
    /*  if(block[i].substr(2)==="default"){                                |    |      |
        if(callback) callback();// // fixes the bug of last element        |    |      |
        else recallback();//                                               |    v      |
      }//                                                                  |           |
   */ //                                                                   v           |
    }//                                                                                |
    for(var ii=0; ii<taggies.length;ii++){//                                           |
        //match user taggies and control if there are some seeds  so executes... *     |
        if(taggies[ii].code === code){//                                         |     |
          if (code[0]==="x") {//user lib needs all control-->callback-mode       |     |
            interf=true;//                                                       |     |
            interfPath="../"+taggies[ii].path+"/index.js";//                     |     |
            indexb=i+1;//                                                        |     |
            scionBlock=block;//                                                  |     |
            scionName= block[i];//                                               |     |
            break growing;//  BREAK THE TWO LOOPS                                |     |
          }//if there are no seeds then, executes next                    |      |     |
           var audreySeed= require("../"+taggies[ii].path+"/index.js");// |      |     |
           var seed= audreySeed();//                                      |      |     |
           var callbackname=block[i];//                                   |      |     |
           seed.grow(callbackname, terminal);//                           V      |     |
        }//                                                                      |     |
    }//                                                                          |     |
   //if it's the last element, callback                                          |     |
     if(i===block.length-1){ //                                    |             |     |
              if(callback) callback();//                           |             |     |
              else recallback();//if it's other                    v             |     |
        }//                                                                      v     |
  }//                                                                                  v
  if(interf){//if the element was a seed then executes interface
    interf=undefined;
    recallback= callback;
    runInterf(block);
  }

}
1234612
function minifyScripts(scriptNames) {
  console.log("Minifying and concatting scripts.");

  var UglifyJS = require("uglify-js");

  var regexMinifed = /min.js$/;
  var regexCopyright = /^\/\*![\s\S]*?\*\//m;
  var buffer = [];
  scriptNames.forEach(function(script) {
    var scriptFile = fs.readFileSync(srcDir + script, "utf8");
    var copyright = regexCopyright.exec(scriptFile);
    if (copyright) {
      buffer.push(copyright);
    }

    // check if file is already minified
    if (!regexMinifed.test(script)) {
      var result = UglifyJS.minify(scriptFile);
      if (result.error) {
        throw new Error(error);
      }
      scriptFile = result.code;
    } else {
      console.log("> Skipping: " + script + " is already minified.");
    }

    buffer.push(scriptFile + ";");
  });

  var combined = buffer.join("\n");
  fs.writeFileSync(publishDir + scriptDir + scriptFilename, combined);
  console.log("Combined all scripts into " + scriptFilename);
}
116531
public static void writeScriptBlock(ServletRequest req, AbstractRenderAppender results, String script)
    {
        assert(results != null);
        ScriptTag.State state = new ScriptTag.State();
        state.suppressComments = false;
        ScriptTag br = (ScriptTag) TagRenderingBase.Factory.getRendering(TagRenderingBase.SCRIPT_TAG, req);

        results.append("\n");
        br.doStartTag(results, state);
        results.append(script);
        br.doEndTag(results, false);
        results.append("\n");
    }
1066352
function use(plugin) {
  var self = this
  var pipeline = self.pipeline
  var duplicate = false

  if (plugin && plugin.pluginId) {
    duplicate = self.plugins.some(matches)
  }

  if (!duplicate && self.plugins.indexOf(plugin) !== -1) {
    duplicate = true
  }

  if (!duplicate) {
    self.plugins.push(plugin)
    pipeline.use(plugin)
  }

  return self

  function matches(fn) {
    return fn.pluginId === plugin.pluginId
  }
}
658143
function extractScripts($) {
  var scripts = [];
  $('script[src]').each(function() {
    var el  = $(this);
    var src = el.attr('src');
    if(ABS.test(src)) return;
    scripts.push(/^\./.test(src) ? src : './' + src);
    el.remove();
  })
  return scripts;
}
1215343
def compile(script, vars={}, library_paths=[]):
    

    return _pyjq.Script(script.encode('utf-8'), vars=vars,
                        library_paths=library_paths)
659117
def _postrun(cls, span, obj, **kwargs):
        
        for key, value in ResultSchema().dump(obj.result).items():
            if isinstance(value, dict):
                try:
                    flat_data = cls.filter_keys(
                        cls.fix_additional_fields(value)
                    )
                    span.set_tag("result.{}".format(key), json.dumps(flat_data))
                except Exception:
                    span.set_tag("result.{}".format(key), "N/A")
            elif isinstance(value, (list, tuple)):
                try:
                    span.set_tag("result.{}".format(key), json.dumps(value))
                except Exception:
                    try:
                        span.set_tag("result.{}".format(key), value)
                    except Exception:
                        span.set_tag("result.{}".format(key), "N/A")
            else:
                span.set_tag("result.{}".format(key), value)
1099871
def get_objects(self, flush=False, autosnap=True, **kwargs):
        '''
        
        '''
        logger.debug('Running get_objects(flush=%s, autosnap=%s, %s)' % (
                     flush, autosnap, kwargs))
        if flush:
            s = time()
            result = self.flush(autosnap=autosnap, **kwargs)
            diff = time() - s
            logger.debug("Flush complete (%ss)" % int(diff))
            return result
        else:
            return self
1142665
def run_script(self, requires, script_name):
        """"""
        ns = sys._getframe(1).f_globals
        name = ns['__name__']
        ns.clear()
        ns['__name__'] = name
        self.require(requires)[0].run_script(script_name, ns)
985968
function runScript(script, context) {
    if (typeof script.useModuleLoader == 'undefined') {
        // if it is not explicitly defined whether we should use modeule loader or not
        // we assume we should use module loader for .js files
        script.useModuleLoader = path.extname(script.path).toLowerCase() == '.js';
    }

    var source;
    var relativePath;

    if (script.plugin) {
        source = 'plugin ' + script.plugin.id;
        relativePath = path.join('plugins', script.plugin.id, script.path);
    } else if (script.useModuleLoader) {
        source = 'config.xml';
        relativePath = path.normalize(script.path);
    } else {
        source = 'hooks directory';
        relativePath = path.join('hooks', context.hook, script.path);
    }

    events.emit('verbose', 'Executing script found in ' + source + ' for hook "' + context.hook + '": ' + relativePath);

    if(script.useModuleLoader) {
        return runScriptViaModuleLoader(script, context);
    } else {
        return runScriptViaChildProcessSpawn(script, context);
    }
}