Validates the provided path

        :param path: path to validate (string)
        :raise:
            :InvalidUsage: If validation fails.
345050
def validate_path(path):
        

        if not isinstance(path, six.string_types) or not re.match('^/(?:[._a-zA-Z0-9-]/?)+[^/]$', path):
            raise InvalidUsage(
                "Path validation failed - Expected: '/<component>[/component], got: %s" % path
            )

        return True
1298779
def validate_pathname(filepath):
    '''

    '''
    if filepath == '/':
        return ValidatePathState.OK
    if len(filepath) > 1000:
        return ValidatePathState.LENGTH_ERROR
    filter2 = '\\?|"><:*'
    for c in filter2:
        if c in filepath:
            return ValidatePathState.CHAR_ERROR2
    paths = rec_split_path(filepath)
    filter3 = '.\r\n\t \0\x0b'
    for path in paths:
        if path[0] in filter3 or path[-1] in filter3:
            return ValidatePathState.CHAR_ERROR3
    return ValidatePathState.OK
552947
private static Path validatePath(Path path) {
		final URI uri = path.toUri();
		final String scheme = uri.getScheme();
		final String pathPart = uri.getPath();

		// some validity checks
		if (scheme == null) {
			throw new IllegalArgumentException("The scheme (hdfs://, file://, etc) is null. " +
					"Please specify the file system scheme explicitly in the URI.");
		}
		if (pathPart == null) {
			throw new IllegalArgumentException("The path to store the checkpoint data in is null. " +
					"Please specify a directory path for the checkpoint data.");
		}
		if (pathPart.length() == 0 || pathPart.equals("/")) {
			throw new IllegalArgumentException("Cannot use the root directory for checkpoints.");
		}

		return path;
	}
1077790
def __validate_and_fix_path(path, check_file=False, check_dir=False):
    """"""
    # pylint: disable=superfluous-parens
    if path is None:
        return path
    else:
        if not (os.path.isfile(path) if check_file else False) \
                and not (os.path.isdir(path) if check_dir else False):
            raise SystemExit('Path `%s` does not exist' % path)
        if not os.path.isabs(path):
            path = os.path.abspath(os.path.join(os.path.abspath(os.curdir), path))

    return path
910998
def assert_valid_path(path):
    
    if path is None:
        return
    # As seen in:
    # https://github.com/mesosphere/marathon/blob/0c11661ca2f259f8a903d114ef79023649a6f04b/src/main/scala/mesosphere/marathon/state/PathId.scala#L71
    for id in filter(None, path.strip('/').split('/')):
        if not ID_PATTERN.match(id):
            raise ValueError(
                'invalid path (allowed: lowercase letters, digits, hyphen, "/", ".", ".."): %r' % path)
    return path
789102
def _filter_validate(filepath, location, values, validate):
    
    for value in values:
        if not isinstance(value, dict):
            warn_invalid(filepath, location, value, '(expected a dict)')
            continue
        try:
            yield validate(**value)
        except dbt.exceptions.JSONValidationException as exc:
            # we don't want to fail the full run, but we do want to fail
            # parsing this file
            warn_invalid(filepath, location, value, '- ' + exc.msg)
            continue
913834
def _valid_directory(self, path):
        
        abspath = os.path.abspath(path)
        if not os.path.isdir(abspath):
            raise argparse.ArgumentTypeError('Not a valid directory: {}'.format(abspath))
        return abspath
954318
private String validatePath(String path, int line) throws ParseException {
		if (!path.startsWith("/")) {
			throw new ParseException("Path must start with '/'", line);
		}

		boolean openedKey = false;
		for (int i=0; i < path.length(); i++) {

			boolean validChar = isValidCharForPath(path.charAt(i), openedKey);
			if (!validChar) {
				throw new ParseException(path, i);
			}

			if (path.charAt(i) == '{') {
				openedKey = true;
			}

			if (path.charAt(i) == '}') {
				openedKey = false;
			}

		}

		return path;
	}
1290932
public void validate(String path, String exceptionMessagePrefix) {
    if (!matches(path)) {
      throw new ValidationException(
          String.format(
              "%s: Parameter \"%s\" must be in the form \"%s\"",
              exceptionMessagePrefix, path, this.toString()));
    }
  }
1071167
def _validate_data(self, path, obj, _):
        
        errs = []

        if obj.type == None and getattr(obj, '$ref') == None:
            errs.append('type or $ref should be existed.')

        # make sure there is 'item' along with 'array'
        if not (obj.type == 'array') == (obj.items != None):
            errs.append('array should be existed along with items')
        if obj.uniqueItems != None and obj.type != 'array':
            errs.append('uniqueItems is only used for array type.')

        return path, obj.__class__.__name__, errs
1246406
public static boolean validatePath(String path) {
        if(path == null) {
            Log.w(TAG, "Uploading path not set");
            return false;
        }

        try {
            uriFromString(path);
            return true;
        } catch(DataSinkException e) {
            return false;
        }
    }
1251741
def check_path(path):
    
    if path is None or path == b'' or path.startswith(b'/'):
        raise ValueError("illegal path '%s'" % path)

    if (
        (sys.version_info[0] >= 3 and not isinstance(path, bytes)) and
        (sys.version_info[0] == 2 and not isinstance(path, str))
    ):
        raise TypeError("illegale type for path '%r'" % path)

    return path
1113178
def validate(self):
        
        assert self.path, "{} must have a path".format(self.__class__.__name__)
        ext = extract_path_ext(self.path, default_ext=self.default_ext)
        if ext not in self.allowed_formats and ext not in CONVERTIBLE_FORMATS[format_presets.VIDEO_HIGH_RES]:
            raise ValueError('Incompatible extension {} for VideoFile at {}'.format(ext, self.path))
238679
function validatePath (path, target) {
  var i = 0
  var len = path.length
  var ref = target
  for (; i < len; i++) {
    if (Iterable.isIterable(ref)) {
      ref = ref.getIn(path.slice(0, i))
      if (Iterable.isIndexed(ref) && !validateIndexToken(path[i])) {
        throw new error.PointerError('Invalid array index: ' + path[i])
      }
    }
  }
}
211216
public boolean isPathValid(String path) {
        if (StringUtils.isEmpty(path) || !path.startsWith(ZK_PATH_SEPARATOR)
                || (path.length() > 1 && path.endsWith(ZK_PATH_SEPARATOR))) {
            return false;
        }
        return true;
    }
317779
def _checkpath(self, path):
        
        if path.startswith("/") or ".." in path or path.strip() != path:
            raise NotFoundException()
559468
def _perform_validation(self, path, value, results):
        
        path = self.name if path == None or len(path) == 0 else path + "." + self.name

        super(PropertySchema, self)._perform_validation(path, value, results)
        self._perform_type_validation(path, self.value_type, value, results)