Check if each arguments given has a requirement and check if it is fulfilled.
176695
function(route, args) {
        var index;

        // There is a requirement for this route.
        if (typeof(self.routes[route].requirements) != 'undefined') {
            // For each arguments.
            for (index in args) {
                // If there is a requirement.
                if (self.routes[route].requirements[index] != null) {
                    // Check if it is fulfilled.
                    var regTest = (new RegExp(self.routes[route].requirements[index]));
                    // If not, replace data with :argument.
                    if (!regTest.test(args[index])) {
                        args[index] = ':' + index
                    }
                }
            }
        }
        return args
    }
397821
function validate(args, required) {
    var result = {
      error: false,
      message: 'No errors'
    }

    // ensure required properties were passed in the arguments hash
    if (required) {
      var keys = _.keys(args);
      required.forEach(function(field) {
        if(!_.contains(keys, field)) {
          result.error = true;
          result.message = 'The following values must be passed: ' + required.join(', ');
        }
      })
    }

    return result;

  }
1270380
def __args_check(self, valid, args=None, kwargs=None):
        '''
        
        '''
        if not isinstance(valid, list):
            valid = [valid]
        for cond in valid:
            if not isinstance(cond, dict):
                # Invalid argument
                continue
            # whitelist args, kwargs
            cond_args = cond.get('args', [])
            good = True
            for i, cond_arg in enumerate(cond_args):
                if args is None or len(args) <= i:
                    good = False
                    break
                if cond_arg is None:  # None == '.*' i.e. allow any
                    continue
                if not self.match_check(cond_arg, six.text_type(args[i])):
                    good = False
                    break
            if not good:
                continue
            # Check kwargs
            cond_kwargs = cond.get('kwargs', {})
            for k, v in six.iteritems(cond_kwargs):
                if kwargs is None or k not in kwargs:
                    good = False
                    break
                if v is None:  # None == '.*' i.e. allow any
                    continue
                if not self.match_check(v, six.text_type(kwargs[k])):
                    good = False
                    break
            if good:
                return True
        return False
985988
public static boolean checkArgs(String[] args) {        
        if (args.length < 4) {
            return false;
        }
        
        if (args[0].compareToIgnoreCase("-modeldir") != 0) {
            return false;
        }
        
        if (!(args[2].compareToIgnoreCase("-inputfile") == 0 ||
                args[2].compareToIgnoreCase("-inputdir") == 0)) {
            return false;
        }
        
        return true;
    }
819275
def validate_param_completion(self, param, leftover_args):
        
        # validates param starts with unfinished word
        completes = self.validate_completion(param)

        # show parameter completions when started
        full_param = self.unfinished_word.startswith("--") and param.startswith("--")
        char_param = self.unfinished_word.startswith("-") and not param.startswith("--")

        # show full parameters before any are used
        new_param = not self.unfinished_word and not leftover_args and param.startswith("--")

        # checks for parameters already in the line as well as aliases
        no_doubles = True
        command_doubles = self.command_param_info.get(self.current_command, {})
        for alias in command_doubles.get(param, []):
            if alias in leftover_args:
                no_doubles = False

        return completes and no_doubles and any((full_param, char_param, new_param))
1334134
def check_valid(self, get_params):
        
        if self.commands._if:
            return self.commands._if.check_valid(get_params)
285652
def check(path_dir, requirements_name='requirements.txt'):
    ''''''
    requirements = _load_requirements(requirements_name, path_dir)
    imported_modules = _iter_modules(path_dir)
    installed_packages = _list_installed_packages()

    imported_modules.update(_excluded_imports())

    diff = {lib for lib in installed_packages if lib not in imported_modules}
    with_dependencies, _ = _list_dependencies(diff)
    unused_dependencies = sorted([d for d in diff if d in requirements])

    for unused_dependency in unused_dependencies:
        if with_dependencies.get(unused_dependency):
            print('    - {}'.format(unused_dependency))
            for dependency in with_dependencies.get(unused_dependency):
                print('\t - {}'.format(dependency))
        else:
            print('    - {}'.format(unused_dependency))
1120788
def check_requirements():
    
    if not os.path.exists(REQUIREMENTS):
        sys.exit(
            ansi.error() + ' %s is missing. Please check it in.' % ansi.underline(REQUIREMENTS)
        )

    with open(REQUIREMENTS, 'r', encoding='utf-8') as f:
        dependencies = f.readlines()

    vcs = [d for d in dependencies if re.match(r'^(-e )?(git|svn|hg|bzr).*', d)]

    dependencies = list(set(dependencies) - set(vcs))

    missing = []
    try:
        pkg_resources.require(dependencies)
    except (
        pkg_resources.ContextualVersionConflict,
        pkg_resources.DistributionNotFound,
        pkg_resources.VersionConflict
    ) as error:
        missing.append(str(error))
    except pkg_resources.RequirementParseError:
        pass

    if missing:
        missing = ' missing requirement:\n  ' + os.linesep.join(missing)
        if '--env-checked' in sys.argv:
            sys.exit(ansi.error() + missing + '\nRequirement installation failure, please check for errors in:\n $ lore install\n')
        else:
            print(ansi.warning() + missing)
            import lore.__main__
            lore.__main__.install_requirements(None)
            reboot('--env-checked')
919199
def should_execute(self):
        """"""
        return self.args.apply and (self.args.no_confirm or self.confirm_execution())
1029456
def types(**requirements):
    

    def predicate(args):
        for name, kind in sorted(requirements.items()):
            assert hasattr(args, name), "missing required argument `%s`" % name

            if not isinstance(kind, tuple):
                kind = (kind,)

            if not any(isinstance(getattr(args, name), k) for k in kind):
                return False

        return True

    return condition("the types of arguments must be valid", predicate, True)
241745
function checkRequired(k, cb) {
    if (k in args)
      return cb(null);
    else
      return cb(buildError(k, 'argument missing'));
  }
708814
def check_if_exists(self):
        """"""
        if self.req is None:
            return False
        try:
            self.satisfied_by = pkg_resources.get_distribution(self.req)
        except pkg_resources.DistributionNotFound:
            return False
        except pkg_resources.VersionConflict:
            self.conflicts_with = pkg_resources.get_distribution(self.req.project_name)
        return True
770864
public function hasPhpIniConfigIssue()
    {
        foreach ($this->requirements as $req) {
            if (!$req->isFulfilled() && $req instanceof PhpIniRequirement) {
                return true;
            }
        }

        return false;
    }
262915
def verify_param(self, param, must=[], r=None):
        ''''''
        if APIKEY not in param:
            param[APIKEY] = self.apikey()

        r = Result() if r is None else r
        for p in must:
            if p not in param:
                r.code(Code.ARGUMENT_MISSING).detail('missing-' + p)
                break

        return r
91085
public function check() {
		foreach ( $this->requirements as $requirement ) {
			// Match against config.
			$requirementFulfilled = $this->requirementIsFulfilled( $requirement );

			if ( $requirementFulfilled ) {
				continue;
			}

			$this->addMissingRequirementMessage( $requirement );
		}
	}
1313424
def check_arguments(self):
        """"""
        for name, default in self.argdict.items():
            if name not in self.names and default is NODEFAULT:
                raise NameError('Missing argparse specification for %r' % name)
1100668
def required_arguments(func):
    """"""
    defaults = default_values_of(func)
    args = arguments_of(func)

    if defaults:
        args = args[:-len(defaults)]
    return args