Perform a given analysis on all functions within an AST.
178188
def forward(node, analysis):
  """"""
  if not isinstance(analysis, Forward):
    raise TypeError('not a valid forward analysis object')
  for succ in gast.walk(node):
    if isinstance(succ, gast.FunctionDef):
      cfg_obj = CFG.build_cfg(succ)
      analysis.visit(cfg_obj.entry)
  return node
1347136
def main(arguments=None):   # suppress(unused-function)
    """"""
    result = _parse_arguments(arguments)
    linter_funcs = _ordered(linter_functions_from_filters,
                            result.whitelist,
                            result.blacklist)
    global_options = vars(result)
    tool_options = tool_options_from_global(global_options, len(result.files))
    any_would_run = _any_would_run(_run_lint_on_file_exceptions,
                                   result.files,
                                   result.stamp_file_path,
                                   result.log_technical_terms_to,
                                   linter_funcs,
                                   tool_options,
                                   result.fix_what_you_can)

    if any_would_run:
        for linter_function in linter_funcs.values():
            if linter_function.before_all:
                linter_function.before_all(global_options, tool_options)

        use_multiprocessing = _should_use_multiprocessing(len(result.files))
    else:
        use_multiprocessing = False

    if use_multiprocessing:
        mapper = parmap.map
    else:
        # suppress(E731)
        mapper = lambda f, i, *a: [f(*((x, ) + a)) for x in i]

    errors = list(itertools.chain(*mapper(_run_lint_on_file_stamped,
                                          result.files,
                                          result.stamp_file_path,
                                          result.log_technical_terms_to,
                                          linter_funcs,
                                          tool_options,
                                          result.fix_what_you_can)))

    for error in sorted(errors):
        _report_lint_error(error.failure, os.path.relpath(error.absolute_path))

    if any_would_run:
        for linter_funcs in linter_funcs.values():
            if linter_funcs.after_all:
                linter_funcs.after_all(global_options, tool_options)

    return len(errors)
577035
def analyze(self, scratch, **kwargs):
        """"""
        all_scripts = list(self.iter_scripts(scratch))
        results = defaultdict(set)
        broadcast = dict((x, self.get_broadcast_events(x))  # Events by script
                         for x in all_scripts)
        correct = self.get_receive(all_scripts)
        results['never broadcast'] = set(correct.keys())

        for script, events in broadcast.items():
            for event in events.keys():
                if event is True:  # Remove dynamic broadcasts
                    results['dynamic broadcast'].add(script.morph.name)
                    del events[event]
                elif event in correct:
                    results['never broadcast'].discard(event)
                else:
                    results['never received'].add(event)

        # remove events from correct dict that were never broadcast
        for event in correct.keys():
            if event in results['never broadcast']:
                del correct[event]

        # Find scripts that have more than one broadcast event on any possible
        # execution path through the program
        # TODO: Permit mutually exclusive broadcasts
        for events in broadcast.values():
            if len(events) > 1:
                for event in events:
                    if event in correct:
                        results['parallel broadcasts'].add(event)
                        del correct[event]

        # Find events that have two (or more) receivers in which one of the
        # receivers has a "delay" block
        for event, scripts in correct.items():
            if len(scripts) > 1:
                for script in scripts:
                    for _, _, block in self.iter_blocks(script.blocks):
                        if block.type.shape == 'stack':
                            results['multiple receivers with delay'].add(event)
                            if event in correct:
                                del correct[event]

        results['success'] = set(correct.keys())
        return {'broadcast': results}
511882
def all(self, func=None):
        
        if func is None:
            func = lambda x, *args: x
        self.altmp = True

        def testEach(value, index, *args):
            if func(value, index, *args) is False:
                self.altmp = False

        self._clean.each(testEach)
        return self._wrap(self.altmp)
326655
def __analizar_errores(self, ret):
        ""
        if 'arrayErrores' in ret:
            errores = ret['arrayErrores'] or []
            self.Errores = [err['error'] for err in errores]
            self.ErrCode = ' '.join(self.Errores)
            self.ErrMsg = '\n'.join(self.Errores)
245612
def run_analysis(self, argv):
        """"""
        args = self._parser.parse_args(argv)

        if is_null(args.config):
            raise ValueError("Config yaml file must be specified")
        if is_null(args.rand_config):
            raise ValueError(
                "Random direction config yaml file must be specified")
        config = load_yaml(args.config)
        rand_config = load_yaml(args.rand_config)

        wcsgeom = self._make_wcsgeom_from_config(config)
        dir_dict = self._build_skydir_dict(wcsgeom, rand_config)

        if is_not_null(args.outfile):
            write_yaml(dir_dict, args.outfile)
1091975
private function analyze()
	{
		// Check if we have component, module, plugin etc.
		if (!file_exists($this->getSourceFolder() . "/administrator/components/com_" . $this->getExtensionName())
			&& !file_exists($this->getSourceFolder() . "/components/com_" . $this->getExtensionName()))
		{
			$this->say("Extension has no component");
			$this->hasComponent = false;
		}

		if (!file_exists($this->getSourceFolder() . "/modules"))
		{
			$this->hasModules = false;
		}

		if (!file_exists($this->getSourceFolder() . "/plugins"))
		{
			$this->hasPlugins = false;
		}

		if (!file_exists($this->getSourceFolder() . "/templates"))
		{
			$this->hasTemplates = false;
		}

		if (!file_exists($this->getSourceFolder() . "/libraries"))
		{
			$this->hasLibraries = false;
		}

		if (!file_exists($this->getSourceFolder() . "/administrator/manifests/packages"))
		{
			$this->hasPackage = false;
		}

		if (!file_exists($this->getSourceFolder() . "/components/com_comprofiler"))
		{
			$this->hasCBPlugins = false;
		}
	}
360768
def create_analysis(name, kernel, src_dir, scaffold_name):
    """"""

    # analysis folder
    folder = os.path.join(os.getcwd(), 'analyses', name)
    if not os.path.exists(folder):
        os.makedirs(folder)
    else:
        log.warning('Analysis folder {} already exists.'.format(folder))

    # copy all other files
    for f in os.listdir(src_dir):
        if f in ('__pycache__',) or \
           any(f.endswith(ending) for ending in ('.pyc',)):
            continue
        copy_scaffold_file(os.path.join(src_dir, f),
                           os.path.join(folder, f),
                           name, scaffold_name)
211288
def __analizar_controles(self, ret):
        ""
        if 'arrayControles' in ret:
            controles = ret['arrayControles']
            self.Controles = ["%(tipo)s: %(descripcion)s" % ctl['control'] 
                                for ctl in controles]
38691
async function analyze(resource) {
	const libInfo = {
		noLibraryCSS: false,
		types: [],
		controls: [],
		elements: [],
		interfaces: []
	};

	function visit(node) {
		if ( node.type == Syntax.CallExpression
				&& node.callee.type === Syntax.MemberExpression
				&& isMethodCall(node.callee.object, CALL__SAP_UI_GETCORE)
				&& isIdentifier(node.callee.property, "initLibrary")
				&& node.arguments.length === 1
				&& node.arguments[0].type === Syntax.ObjectExpression ) {
			node.arguments[0].properties.forEach( (prop) => {
				const key = getPropertyKey(prop);
				const value = prop.value;
				if ( key === "noLibraryCSS"
						&& (value.type === Syntax.Literal && typeof value.value === "boolean") ) {
					libInfo.noLibraryCSS = value.value;
				} else if ( key === "types" && value.type == Syntax.ArrayExpression ) {
					libInfo.types = getStringArray(value, true);
				} else if ( key === "interfaces" && value.type == Syntax.ArrayExpression ) {
					libInfo.interfaces = getStringArray(value, true);
				} else if ( key === "controls" && value.type == Syntax.ArrayExpression ) {
					libInfo.controls = getStringArray(value, true);
				} else if ( key === "elements" && value.type == Syntax.ArrayExpression ) {
					libInfo.elements = getStringArray(value, true);
				}
			});

			return true; // abort, we're done
		}

		for ( const key of VisitorKeys[node.type] ) {
			const child = node[key];
			if ( Array.isArray(child) ) {
				if ( child.some(visit) ) {
					return true;
				}
			} else if ( child ) {
				if ( visit(child) ) {
					return true;
				}
			}
		}

		return false;
	}

	const code = await resource.getBuffer();
	visit( esprima.parseScript(code.toString()) );

	return libInfo;
}
1355982
def analyze_script(self, index=None):
        """"""
        if self.is_analysis_done:
            return
        if index is None:
            index = self.get_stack_index()
        if self.data:
            finfo = self.data[index]
            if self.todolist_enabled:
                finfo.run_todo_finder()
        self.is_analysis_done = True
717244
private function analyze()
	{
		if (!file_exists($this->adminPath))
		{
			$this->hasAdmin = false;
		}

		if (!file_exists($this->frontPath))
		{
			$this->hasFront = false;
		}
	}
43703
def _make_completed_functions(self):
        

        finished = self._get_finished_functions()
        for func_addr in finished:
            self._completed_functions.add(func_addr)
        self._cleanup_analysis_jobs(finished_func_addrs=finished)
177139
function run(options, ast, cb) {
  var report = new Report(options, ast);
  report.run(cb);
}
976002
def run_analysis(self, argv):
        """"""
        args = self._parser.parse_args(argv)

        obs = BinnedAnalysis.BinnedObs(irfs=args.irfs,
                                       expCube=args.expcube,
                                       srcMaps=args.srcmaps,
                                       binnedExpMap=args.bexpmap)

        like = BinnedAnalysis.BinnedAnalysis(obs,
                                             optimizer='MINUIT',
                                             srcModel=GtMergeSrcmaps.NULL_MODEL,
                                             wmap=None)

        like.logLike.set_use_single_fixed_map(False)

        print("Reading xml model from %s" % args.srcmdl)
        source_factory = pyLike.SourceFactory(obs.observation)
        source_factory.readXml(args.srcmdl, BinnedAnalysis._funcFactory, False, True, True)
        strv = pyLike.StringVector()
        source_factory.fetchSrcNames(strv)
        source_names = [strv[i] for i in range(strv.size())]

        missing_sources = []
        srcs_to_merge = []
        for source_name in source_names:
            try:
                source = source_factory.releaseSource(source_name)
                # EAC, add the source directly to the model
                like.logLike.addSource(source)
                srcs_to_merge.append(source_name)
            except KeyError:
                missing_sources.append(source_name)

        comp = like.mergeSources(args.merged, source_names, 'ConstantValue')
        like.logLike.getSourceMap(comp.getName())

        print("Merged %i sources into %s" % (len(srcs_to_merge), comp.getName()))
        if missing_sources:
            print("Missed sources: ", missing_sources)

        print("Writing output source map file %s" % args.outfile)
        like.logLike.saveSourceMaps(args.outfile, False, False)
        if args.gzip:
            os.system("gzip -9 %s" % args.outfile)

        print("Writing output xml file %s" % args.outxml)
        like.writeXml(args.outxml)
43431
def do_action_to_analyses(analysis_request, transition_id, all_analyses=False):
    
    analyses = list()
    if all_analyses:
        analyses = analysis_request.getAnalyses(full_objects=True)
    else:
        analyses = analysis_request.objectValues("Analysis")
    for analysis in analyses:
        do_action_for(analysis, transition_id)
843781
def run(self):
        """"""
        paths = [x for x in practices.__dict__.values()
                 if hasattr(x, 'code')]

        for node in ast.walk(self.tree):
            try:
                lineno, col_offset = node.lineno, node.col_offset
            except AttributeError:
                # Not all nodes have coordinates, e.g.: ast.Module
                continue

            for checker in paths:
                if checker(node):
                    message = self.build_message(checker)
                    yield lineno, col_offset, message, type(self)