Generates a validator function that given a path, validates that it against
    the path parameters
769674
def generate_path_parameters_validator(api_path, path_parameters, context):
    
    path_parameter_validator = functools.partial(
        validate_path_parameters,
        api_path=api_path,
        path_parameters=path_parameters,
        context=context,
    )
    return path_parameter_validator
1189302
function _checkPath (npmPath) {
  return new Promise((resolve, reject) => {
    if (npmPath) {
      fs.lstat(npmPath, (err, stats) => {
        if (err || !stats || (stats.isDirectory && !stats.isDirectory())) {
          reject(new Error(strings.givenPathNotValid(npmPath)))
        } else {
          resolve({
            path: npmPath,
            message: strings.givenPathValid(npmPath)
          })
        }
      })
    } else {
      reject(new Error('Called _checkPath() with insufficient parameters'))
    }
  })
}
1318410
def validate(path=".")
      filter = options["filter"] || "[^_]*.html"
      
      puts "Filtering on #{options["filter"]}" if options["filter"]
      
      if File.directory?(path)
        any_invalid = false
        
        if (files = Dir.glob("#{path}/**/#{filter}")).any?
        	files.each do |file|
        		if !self.w3cvalidate(file)
        		  any_invalid = true
        	  end
        	end
        	if !any_invalid
        	  puts "All files were considered valid"
          end
        else
          puts "No files matched \"#{filter}\""
        end
      elsif File.readable?(path)
        self.w3cvalidate(path)
      else
        puts "No such file/directory #{path}"
      end      
    end
645941
def validate_path(xj_path):
    

    if not isinstance(xj_path, str):
        raise XJPathError('XJPath must be a string')

    for path in split(xj_path, '.'):
        if path == '*':
            continue
        if path.startswith('@'):
            if path == '@first' or path == '@last':
                continue
            try:
                int(path[1:])
            except ValueError:
                raise XJPathError('Array index must be either integer or '
                                  '@first or @last')
659263
function validateFunction(path, driver, functionName) {
  if (typeof driver[functionName] !== 'function') {
    console.error(`${path} missing .${functionName}() implementation`);
    process.exit(1);
  }
}
1040131
function requireValidate(path, optional = false) {
  let driver;

  try {
    driver = require(path);
  } catch (er) {
    if (optional) {
      console.log('optional driver ' + path + ' not available');
      return;
    } else {
      // rethrow
      throw er;
    }
  }

  if (!driver.id) {
    console.error(`${path} must export a unique id`);
    process.exit(1);
  }

  if (!driver.name) {
    console.error(`${path} must export a name`);
    process.exit(1);
  }

  if (drivers[driver.id]) {
    console.error(`Driver with id ${driver.id} already loaded`);
    console.error(`Ensure ${path} has a unique id exported`);
    process.exit(1);
  }

  validateFunction(path, driver, 'getSchema');
  validateFunction(path, driver, 'runQuery');
  validateFunction(path, driver, 'testConnection');
  validateArray(path, driver, 'fields');

  driver.fieldsByKey = {};

  driver.fields.forEach(field => {
    driver.fieldsByKey[field.key] = field;
  });

  drivers[driver.id] = driver;
}
1320129
function visitEvalCallExpressions(traverse, node, path, state) {
    utils.catchup(node.range[1], state, function(value) {
      if(optimizeFunction(node.callee.name)) {
        // Unpack the id
        var id = extractId(node.callee.name);
        // Create path and object call
        var pathDeclaration = f('var path_%s = %s;\n', id, transformedFileData1.code.substring(node.arguments[0].range[0], node.arguments[0].range[1]));
        var objectDeclaration = f('var object_%s = %s;\n', id, transformedFileData1.code.substring(node.arguments[1].range[0], node.arguments[1].range[1]));

        // Get the function code
        var code = functions[node.callee.name].code;

        // Replace path and object in source
        var functionSource = code
          .replace(/object/g, f('object_%s', id))
          .replace(/path/g, f('path_%s', id))
          .replace(/return errors\;/, '');

        // Return the in-lined function
        return f('%s\n%s\n%s', objectDeclaration, pathDeclaration, functionSource);
      } else if(!skipTopLevelOptimization && ast.type == 'object' && node.callee.name === f('object_validation_%s', ast.id)) {
        return '';
      } else {
        return value;
      }
    });
  }
350479
def get_path_regex(self, path):
        
        for regex, func in self._regex_map:
            match = re.match(regex, path)
            if match:
                return func(match)

        return None, None
1074526
public function validate(
        string $path,
        $value,
        ValidatorContextInterface $context,
        ValidatorInterface $validator = null
    ) {
        $callback = $this->callback;

        return $callback($path, $value, $context, $validator);
    }
1373122
private Set<String> validatePathAndRetrievePathParams(ValidationHelper helper, Context context, String pathStr) {
        String pathToCheck = pathStr;
        Set<String> pathParameters = new HashSet<String>();

        while (pathToCheck.contains("{")) {
            if (!pathToCheck.contains("}")) {
                final String message = Tr.formatMessage(tc, "pathItemInvalidFormat", pathStr);
                helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));
                return pathParameters;
            }
            int firstIndex = pathToCheck.indexOf("{");
            int lastIndex = pathToCheck.indexOf("}");

            if (firstIndex > lastIndex) {
                final String message = Tr.formatMessage(tc, "pathItemInvalidFormat", pathStr);
                helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));
                return pathParameters;
            }

            String parameter = pathToCheck.substring(firstIndex + 1, lastIndex);

            if (parameter.isEmpty() || parameter.contains("{") || parameter.contains("/")) {
                final String message = Tr.formatMessage(tc, "pathItemInvalidFormat", pathStr);
                helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));
                return pathParameters;
            }

            pathParameters.add(parameter);
            pathToCheck = pathToCheck.substring(lastIndex + 1);
        }

        if (pathToCheck.contains("}")) {
            final String message = Tr.formatMessage(tc, "pathItemInvalidFormat", pathStr);
            helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));
            return pathParameters;
        }

        return pathParameters;
    }
1308704
function validateParameters() {
		grunt.verbose.writeln( 'BowerMap::validateParameters' );
		//flag used to determine if validation passes
		var check = true;

		//lib path must be set
		//TODO: get default bowerpath from .bowerrc
		bowerPath = bowerPath || "bower_components";
		if ( typeof bowerPath !== 'string' ) {
			grunt.log.error( 'Bower path must be a string.' );
			check = false;
		}

		//lib path must be set
		if ( !destPath || typeof destPath !== 'string' ) {
			grunt.log.error( 'Default destination path must be configured.' );
			check = false;
		}

		//shim isn't required, but must be a key value object
		shim = shim || {};
		if ( typeof shim !== "object" ) {
			grunt.log.error( 'shim must be an object.' );
			check = false;
		}

		//map isn't required, but must be a key value object
		map = map || {};
		if ( typeof map !== "object" ) {
			grunt.log.error( 'map must be an object.' );
			check = false;
		}

		//ignore isn't required, but must be an array
		ignore = ignore || [];
		if ( !Array.isArray( ignore )  ) {
			grunt.log.error( 'ignore must be an array of strings.' );
			check = false;
		}

		//maintainCommonPaths isn't required, but must be boolean
		maintainCommonPaths = maintainCommonPaths || false;
		if ( typeof maintainCommonPaths !== "boolean" ) {
			grunt.log.error( 'maintainCommonPaths must be a boolean value.' );
			check = false;
		}

		//useNamespace isn't required, but must be undefined or boolean
		if ( useNamespace !== undefined && typeof useNamespace !== "boolean" ) {
			grunt.log.error( 'useNamespace must be boolean or undefined.' );
			check = false;
		}

		//extensions isn't required, but must be an array
		extensions = extensions || undefined;
		if ( extensions !== undefined && !Array.isArray( extensions )  ) {
			grunt.log.error( 'extensions must be an array or undefined.' );
			check = false;
		}

		return check;
	}
1084324
def Validate(self):
    """"""
    self.pathspec.Validate()

    if (self.HasField("start_time") and self.HasField("end_time") and
        self.start_time > self.end_time):
      raise ValueError("Start time must be before end time.")

    if not self.path_regex and not self.data_regex and not self.path_glob:
      raise ValueError("A Find specification can not contain both an empty "
                       "path regex and an empty data regex")
529363
function _gpfPathMatch (pattern, path) {
    var parts = _gpfPathDecompose(path),
        matchers = _gpfPathMatchCompilePatterns(pattern),
        scope = {
            parts: parts
        };
    matchers.every(_gpfPathMatchApply, scope);
    return scope.result;
}
421357
public T validate(String path, Object controlValue) {
        if (JsonPathMessageValidationContext.isJsonPathExpression(path)) {
            getJsonPathValidationContext().getJsonPathExpressions().put(path, controlValue);
        } else {
            getXPathValidationContext().getXpathExpressions().put(path, controlValue);
        }

        return self;
    }
691087
def _validate_items(self, path, obj, _):
        
        errs = []

        if obj.type == 'void':
            errs.append('void is only allowed in Operation object.')

        return path, obj.__class__.__name__, errs
560869
def _validate_path(path):
  
  if not path:
    raise ValueError('Path is empty')
  if not isinstance(path, basestring):
    raise TypeError('Path should be a string but is %s (%s).' %
                    (path.__class__, path))
1252772
def _nargs_validator(nargs, message):
  """"""
  if message is None:
    message = "Registered function must take exactly %d arguments" % nargs

  def f(key, value):
    del key
    spec = inspect.getfullargspec(value)
    if (len(spec.args) != nargs or spec.varargs is not None or
        spec.varkw is not None):
      raise ValueError(message)

  return f