This is a pre-flight check function that will completely ignore
        recipe order or choosing an actual value in any of the multiple
        choice tuples/dependencies, and just do a very basic obvious
        conflict check.
193990
def obvious_conflict_checker(ctx, name_tuples, blacklist=None):
    
    deps_were_added_by = dict()
    deps = set()
    if blacklist is None:
        blacklist = set()

    # Add dependencies for all recipes:
    to_be_added = [(name_tuple, None) for name_tuple in name_tuples]
    while len(to_be_added) > 0:
        current_to_be_added = list(to_be_added)
        to_be_added = []
        for (added_tuple, adding_recipe) in current_to_be_added:
            assert(type(added_tuple) == tuple)
            if len(added_tuple) > 1:
                # No obvious commitment in what to add, don't check it itself
                # but throw it into deps for later comparing against
                # (Remember this function only catches obvious issues)
                deps.add(added_tuple)
                continue

            name = added_tuple[0]
            recipe_conflicts = set()
            recipe_dependencies = []
            try:
                # Get recipe to add and who's ultimately adding it:
                recipe = Recipe.get_recipe(name, ctx)
                recipe_conflicts = {c.lower() for c in recipe.conflicts}
                recipe_dependencies = get_dependency_tuple_list_for_recipe(
                    recipe, blacklist=blacklist
                )
            except ValueError:
                pass
            adder_first_recipe_name = adding_recipe or name

            # Collect the conflicts:
            triggered_conflicts = []
            for dep_tuple_list in deps:
                # See if the new deps conflict with things added before:
                if set(dep_tuple_list).intersection(
                       recipe_conflicts) == set(dep_tuple_list):
                    triggered_conflicts.append(dep_tuple_list)
                    continue

                # See if what was added before conflicts with the new deps:
                if len(dep_tuple_list) > 1:
                    # Not an obvious commitment to a specific recipe/dep
                    # to be added, so we won't check.
                    # (remember this function only catches obvious issues)
                    continue
                try:
                    dep_recipe = Recipe.get_recipe(dep_tuple_list[0], ctx)
                except ValueError:
                    continue
                conflicts = [c.lower() for c in dep_recipe.conflicts]
                if name in conflicts:
                    triggered_conflicts.append(dep_tuple_list)

            # Throw error on conflict:
            if triggered_conflicts:
                # Get first conflict and see who added that one:
                adder_second_recipe_name = "'||'".join(triggered_conflicts[0])
                second_recipe_original_adder = deps_were_added_by.get(
                    (adder_second_recipe_name,), None
                )
                if second_recipe_original_adder:
                    adder_second_recipe_name = second_recipe_original_adder

                # Prompt error:
                raise BuildInterruptingException(
                    "Conflict detected: '{}'"
                    " inducing dependencies {}, and '{}'"
                    " inducing conflicting dependencies {}".format(
                        adder_first_recipe_name,
                        (recipe.name,),
                        adder_second_recipe_name,
                        triggered_conflicts[0]
                    ))

            # Actually add it to our list:
            deps.add(added_tuple)
            deps_were_added_by[added_tuple] = adding_recipe

            # Schedule dependencies to be added
            to_be_added += [
                (dep, adder_first_recipe_name or name)
                for dep in recipe_dependencies
                if dep not in deps
            ]
    # If we came here, then there were no obvious conflicts.
    return None
284377
function _checkPredicates (checkAll) {
    return function (predicates) {
        if (!Array.isArray(predicates)) {
            throw _makeTypeErrorFor(predicates, "array");
        }

        return function () {
            for (var i = 0, len = predicates.length, result; i < len; i++) {
                result = predicates[i].apply(this, arguments);

                if (checkAll && !result) {
                    return false;
                } else if (!checkAll && result) {
                    return true;
                }
            }

            return checkAll;
        };
    };
}
549613
private void opNullCheckEndMemST() {
        int mem = code[ip++];   /* mem: null check id */
        int isNull = nullCheckMemSt(mem, s);

        if (isNull != 0) {
            if (Config.DEBUG_MATCH) {
                Config.log.println("NULL_CHECK_END_MEMST: skip  id:" + mem + ", s:" + s);
            }

            if (isNull == -1) {opFail(); return;}
            nullCheckFound();
        }
    }
1220250
def _default_verify_function(instance, answer, result_host, atol, verbose):
    """"""

    #first check if the length is the same
    if len(instance.arguments) != len(answer):
        raise TypeError("The length of argument list and provided results do not match.")
    #for each element in the argument list, check if the types match
    for i, arg in enumerate(instance.arguments):
        if answer[i] is not None: #skip None elements in the answer list
            if isinstance(answer[i], numpy.ndarray) and isinstance(arg, numpy.ndarray):
                if answer[i].dtype != arg.dtype:
                    raise TypeError("Element " + str(i)
                                    + " of the expected results list is not of the same dtype as the kernel output: "
                                    + str(answer[i].dtype) + " != " + str(arg.dtype) + ".")
                if answer[i].size != arg.size:
                    raise TypeError("Element " + str(i)
                                    + " of the expected results list has a size different from "
                                    + "the kernel argument: "
                                    + str(answer[i].size) + " != " + str(arg.size) + ".")
            elif isinstance(answer[i], numpy.number) and isinstance(arg, numpy.number):
                if answer[i].dtype != arg.dtype:
                    raise TypeError("Element " + str(i)
                                    + " of the expected results list is not the same as the kernel output: "
                                    + str(answer[i].dtype) + " != " + str(arg.dtype) + ".")
            else:
                #either answer[i] and argument have different types or answer[i] is not a numpy type
                if not isinstance(answer[i], numpy.ndarray) or not isinstance(answer[i], numpy.number):
                    raise TypeError("Element " + str(i)
                                    + " of expected results list is not a numpy array or numpy scalar.")
                else:
                    raise TypeError("Element " + str(i)
                                    + " of expected results list and kernel arguments have different types.")

    def _ravel(a):
        if hasattr(a, 'ravel') and len(a.shape) > 1:
            return a.ravel()
        return a

    def _flatten(a):
        if hasattr(a, 'flatten'):
            return a.flatten()
        return a

    correct = True
    for i, arg in enumerate(instance.arguments):
        expected = answer[i]
        if expected is not None:

            result = _ravel(result_host[i])
            expected = _flatten(expected)
            output_test = numpy.allclose(expected, result, atol=atol)

            if not output_test and verbose:
                print("Error: " + util.get_config_string(instance.params) + " detected during correctness check")
                print("this error occured when checking value of the %oth kernel argument" % (i,))
                print("Printing kernel output and expected result, set verbose=False to suppress this debug print")
                numpy.set_printoptions(edgeitems=50)
                print("Kernel output:")
                print(result)
                print("Expected:")
                print(expected)
            correct = correct and output_test

    if not correct:
        logging.debug('correctness check has found a correctness issue')
        raise Exception("Error: " + util.get_config_string(instance.params) + " failed correctness check")

    return correct
1163692
function ignoreFactory (ignoreList) {

    if (typeof ignoreList === 'function') {
        return ignoreList;
    }

    var fn = ignore().add(ignoreList || []);

    // @param   {String}
    // @return  {Boolean}
    return ignoreList.length ? function (src) {

        if (!src) {
            return false;
        }

        return !fn.filter([src])[0];

    } : function () {
        return false;
    };
}
569657
def skip_if(condition, reason=None):
    
    if condition:
        return skip(reason)

    def wrapper(func):
        return func
    return wrapper
155473
def no_intersection(to_validate, constraint, violation_cfg):
    
    if len(constraint) == 0 or len(set(constraint).intersection(to_validate)) > 0:
        return None
    else:
        violation_cfg[Check.CFG_KEY_VIOLATION_MSG] = violation_cfg[Check.CFG_KEY_VIOLATION_MSG].format(constraint)
        return violation_cfg
1296644
def check(self, F):
        

        assert F.ndim == 1, "checker only supports 1D"

        f = self.xfac * F
        fabs = np.abs(f)

        iQ1, iQ3 = np.searchsorted(fabs.cumsum(), np.array([0.25, 0.75]) * fabs.sum())
        assert 0 != iQ1 != iQ3 != self.Nin, "checker giving up"
        fabs_l = fabs[:iQ1].mean()
        fabs_m = fabs[iQ1:iQ3].mean()
        fabs_r = fabs[iQ3:].mean()

        if fabs_l > fabs_m:
            warnings.warn("left wing seems heavy: {:.2g} vs {:.2g}, "
                    "change tilt and mind convergence".format(fabs_l, fabs_m), RuntimeWarning)
        if fabs_m < fabs_r:
            warnings.warn("right wing seems heavy: {:.2g} vs {:.2g}, "
                    "change tilt and mind convergence".format(fabs_m, fabs_r), RuntimeWarning)

        if fabs[0] > fabs[1]:
            warnings.warn("left tail may blow up: {:.2g} vs {:.2g}, "
                    "change tilt or avoid extrapolation".format(f[0], f[1]), RuntimeWarning)
        if fabs[-2] < fabs[-1]:
            warnings.warn("right tail may blow up: {:.2g} vs {:.2g}, "
                    "change tilt or avoid extrapolation".format(f[-2], f[-1]), RuntimeWarning)

        if f[0]*f[1] <= 0:
            warnings.warn("left tail looks wiggly: {:.2g} vs {:.2g}, "
                    "avoid extrapolation".format(f[0], f[1]), RuntimeWarning)
        if f[-2]*f[-1] <= 0:
            warnings.warn("right tail looks wiggly: {:.2g} vs {:.2g}, "
                    "avoid extrapolation".format(f[-2], f[-1]), RuntimeWarning)
249723
function shouldBeChecked(actionType: string): bool {
  if(actionType === LIST_ITEM_CHECK)    return true;
  if(actionType === LIST_ITEM_UNCHECK)  return false;

  throw new Error(`Invalid action type ${actionType}`);
}
236782
function nfcQuickCheck(s) {
		// check for only ascii characters first to avoid unnecessary processing
		if (!/^[\u0001-\u00ff]*$/.test(s)) {
			var lastCanonicalClass = 0;
			for (var i = 0; i < s.length; ++i) {
				var cp = s.charCodeAt(i);
				// check for supplementary characters, complex, as charCodeAt returns only charcodes smaller than 0xFFFF,
				// which is the Basic Multilingual Plane (BMP), but for normalizations also characters of the Supplementary
				// Multilingual Plane (SMP) have to be considered
				if (isHighSurrogate(cp)) {
					// check the next character
					var ncp = s.charCodeAt(i + 1);
					if (isLowSurrogate(ncp)) {
						// calculate the according char code in SMP and skip further tests for the next character (ncp)
						cp = (cp - 0xD800) * 0x400 + (ncp - 0xDC00) + 0x10000;
						++i;
					}
				}
				var canonicalClass = getCanonicalClass(cp);
				// check canonical class or reference list
				if (lastCanonicalClass > canonicalClass && canonicalClass !== 0 || isNotAllowed(cp)) {
					return false;
				}
				lastCanonicalClass = canonicalClass;
			}
		}
		// nothing has been found
		return true;
	}
739299
def recipe_conflicts(backend):
    
    recipe_dir = DKRecipeDisk.find_recipe_root_dir()
    if recipe_dir is None:
        raise click.ClickException('You must be in a Recipe folder.')
    recipe_name = DKRecipeDisk.find_recipe_name()
    click.secho("%s - Checking for conflicts on Recipe '%s'" % (
        get_datetime(),recipe_name))
    recipe_name = DKRecipeDisk.find_recipe_name()
    check_and_print(DKCloudCommandRunner.get_unresolved_conflicts(recipe_name, recipe_dir))
640086
def check_ordered(self): 
    
    sys.stderr.write("error unimplemented check_ordered\n")
    sys.exit()
    seen_chrs = set()
    curr_chr = None
    prevstart = 0
    for l in self._lines:
      if not l['rng']: continue
      if l['rng'].chr != curr_chr:
        prevstart = 0
        if l['rng'].chr in seen_chrs:
          return False
        curr_chr = l['rng'].chr
        seen_chrs.add(curr_chr)
      if l['rng'].start < prevstart:  return False
      prevstart = l['rng'].start
    return True
264169
def check_with_uniform(uf, arg_shapes, dim=None, npuf=None, rmin=-10, type_list=[np.float32]):
    """"""
    if isinstance(arg_shapes, int):
        assert dim
        shape = tuple(np.random.randint(1, int(1000**(1.0/dim)), size=dim))
        arg_shapes = [shape] * arg_shapes
    for dtype in type_list:
        ndarray_arg = []
        numpy_arg = []
        for s in arg_shapes:
            npy = np.random.uniform(rmin, 10, s).astype(dtype)
            narr = mx.nd.array(npy, dtype=dtype)
            ndarray_arg.append(narr)
            numpy_arg.append(npy)
        out1 = uf(*ndarray_arg)
        if npuf is None:
            out2 = uf(*numpy_arg).astype(dtype)
        else:
            out2 = npuf(*numpy_arg).astype(dtype)

        assert out1.shape == out2.shape
        if isinstance(out1, mx.nd.NDArray):
            out1 = out1.asnumpy()
        if dtype == np.float16:
            assert reldiff(out1, out2) < 2e-3
        else:
            assert reldiff(out1, out2) < 1e-6
563798
def _ignore_sql(self, query):
        """"""
        return any([
            re.search(pattern, query.get('sql')) for pattern in QC_SETTINGS['IGNORE_SQL_PATTERNS']
        ])
1178104
function without(list, test, removedFn) {
 
   return withoutInner(list, removedFn || noop);
 
   function withoutInner(subList, removedFn) {
      return subList  
         ?  ( test(head(subList)) 
                  ? (removedFn(head(subList)), tail(subList)) 
                  : cons(head(subList), withoutInner(tail(subList), removedFn))
            )
         : emptyList
         ;
   }               
}
136502
def _default_conflict_solver(match, conflicting_match):
    
    if len(conflicting_match.initiator) < len(match.initiator):
        return conflicting_match
    if len(match.initiator) < len(conflicting_match.initiator):
        return match
    return None
1052987
def is_correct(self):  # pylint: disable=too-many-branches, too-many-statements, too-many-locals
        
        logger.info('Running pre-flight check on configuration data, initial state: %s',
                    self.conf_is_correct)
        valid = self.conf_is_correct

        # Check if alignak_name is defined
        if not self.alignak_name:
            logger.info('Alignak name is not defined, using the main arbiter name...')
            for arbiter in self.arbiters:
                if not arbiter.spare:
                    self.alignak_name = arbiter.name
                    break
        logger.info('Alignak name is: %s', self.alignak_name)

        # Globally unmanaged parameters
        if not self.read_config_silent:
            logger.info('Checking global parameters...')

        # Old Nagios legacy unmanaged parameters
        self.check_error_on_hard_unmanaged_parameters()

        # If we got global event handlers, they should be valid
        if self.global_host_event_handler and not self.global_host_event_handler.is_valid():
            msg = "[%s::%s] global host event_handler '%s' is invalid" \
                  % (self.my_type, self.get_name(), self.global_host_event_handler.command)
            self.add_error(msg)
            valid = False

        if self.global_service_event_handler and not self.global_service_event_handler .is_valid():
            msg = "[%s::%s] global service event_handler '%s' is invalid" \
                  % (self.my_type, self.get_name(), self.global_service_event_handler .command)
            self.add_error(msg)
            valid = False

        if not self.read_config_silent:
            logger.info('Checked')

        if not self.read_config_silent:
            logger.info('Checking monitoring configuration...')

        classes = [strclss for _, _, strclss, _, _ in list(self.types_creations.values())]
        for strclss in sorted(classes):
            if strclss in ['hostescalations', 'serviceescalations']:
                logger.debug("Ignoring correctness check for '%s'...", strclss)
                continue

            if not self.read_config_silent:
                logger.info('- checking %s...', strclss)

            try:
                checked_list = getattr(self, strclss)
            except AttributeError:  # pragma: no cover, simple protection
                logger.info("\t%s are not present in the configuration", strclss)
                continue

            if not checked_list.is_correct():
                if not self.read_config_silent:
                    logger.info('Checked %s, configuration is incorrect!', strclss)

                valid = False
                self.configuration_errors += checked_list.configuration_errors
                self.add_error("%s configuration is incorrect!" % strclss)
                logger.error("%s configuration is incorrect!", strclss)
            if checked_list.configuration_warnings:
                self.configuration_warnings += checked_list.configuration_warnings
                logger.info("    %d warning(s), total: %d",
                            len(checked_list.configuration_warnings),
                            len(self.configuration_warnings))

            if not self.read_config_silent:
                try:
                    dump_list = sorted(checked_list, key=lambda k: k.get_name())
                except AttributeError:  # pragma: no cover, simple protection
                    dump_list = checked_list

                # Dump at DEBUG level because some tests break with INFO level, and it is not
                # really necessary to have information about each object ;
                for cur_obj in dump_list:
                    if strclss == 'services':
                        logger.debug('  %s', cur_obj.get_full_name())
                    else:
                        logger.debug('  %s', cur_obj.get_name())
                if checked_list:
                    logger.info('  checked %d', len(checked_list))
                else:
                    logger.info('  none')

        if not self.read_config_silent:
            logger.info('Checked')

        # Parse hosts and services for tags and realms
        hosts_tag = set()
        services_tag = set()
        for host in self.hosts:
            hosts_tag.add(host.poller_tag)
        for service in self.services:
            services_tag.add(service.poller_tag)

        # Check that for each poller_tag of a host, a poller exists with this tag
        pollers_tag = set()
        for poller in self.pollers:
            for tag in poller.poller_tags:
                pollers_tag.add(tag)

        if not hosts_tag.issubset(pollers_tag):
            for tag in hosts_tag.difference(pollers_tag):
                self.add_error("Error: some hosts have the poller_tag %s but no poller "
                               "has this tag" % tag)
                valid = False
        if not services_tag.issubset(pollers_tag):
            for tag in services_tag.difference(pollers_tag):
                self.add_error("some services have the poller_tag %s but no poller "
                               "has this tag" % tag)
                valid = False

        # Check that all hosts involved in business_rules are from the same realm
        for item in self.hosts:
            if not item.got_business_rule:
                continue

            realm = self.realms[item.realm]
            if not realm:
                # Something was wrong in the conf, will be raised elsewhere
                continue

            for elt_uuid in item.business_rule.list_all_elements():
                if elt_uuid not in self.hosts:
                    # An error or a service element
                    continue

                host = self.hosts[elt_uuid]
                if host.realm not in self.realms:
                    # Something was wrong in the conf, will be raised elsewhere
                    continue

                host_realm = self.realms[host.realm]
                if host_realm.get_name() != realm.get_name():
                    logger.error("Business_rule '%s' got some hosts from another realm: %s",
                                 item.get_full_name(), host_realm.get_name())
                    self.add_error("Error: Business_rule '%s' got hosts from another "
                                   "realm: %s" % (item.get_full_name(), host_realm.get_name()))
                    valid = False

        # for lst in [self.services, self.hosts]:
        #     for item in lst:
        #         if item.got_business_rule:
        #             e_ro = self.realms[item.realm]
        #             # Something was wrong in the conf, will be raised elsewhere
        #             if not e_ro:
        #                 continue
        #             e_r = e_ro.realm_name
        #             for elt_uuid in item.business_rule.list_all_elements():
        #                 if elt_uuid in self.hosts:
        #                     elt = self.hosts[elt_uuid]
        #                 else:
        #                     elt = self.services[elt_uuid]
        #                 r_o = self.realms[elt.realm]
        #                 # Something was wrong in the conf, will be raised elsewhere
        #                 if not r_o:
        #                     continue
        #                 elt_r = r_o.realm_name
        #                 if elt_r != e_r:
        #                     logger.error("Business_rule '%s' got hosts from another realm: %s",
        #                                  item.get_full_name(), elt_r)
        #                     self.add_error("Error: Business_rule '%s' got hosts from another "
        #                                    "realm: %s" % (item.get_full_name(), elt_r))
        #                     valid = False

        if self.configuration_errors:
            valid = False
            logger.error("Configuration errors:")
            for msg in self.configuration_errors:
                logger.error(msg)

        # If configuration error messages exist, then the configuration is not valid
        self.conf_is_correct = valid