Attempt to validate the path as an actual (S)RPM. If an exception
    is raised then this is not an RPM.
328563
def is_rpm(path):
    

    import magic
    m = magic.open(magic.MAGIC_MIME)
    m.load()
    mime = m.file(path)
    # rpms or directories are cool
    if 'rpm' in mime or 'directory' in mime:
        return True
    else:
        juicer.utils.Log.log_info("error: File `%s` is not an rpm" % path)
        return False
433415
def validate_code_path(valid_paths, code_path, **kw):
        

        root, name = code_path.split(':', 1)
        if name not in valid_paths[root]:
            raise ValueError("%r is not a valid code_path" % code_path)
1371978
def ValidateVfsPath(path):
  """"""

  components = (path or "").lstrip("/").split("/")
  if not components:
    raise ValueError("Empty path is not a valid path: %s." %
                     utils.SmartStr(path))

  if components[0] not in ROOT_FILES_WHITELIST:
    raise ValueError(
        "First path component was '%s', but has to be one of %s" %
        (utils.SmartStr(components[0]), ", ".join(ROOT_FILES_WHITELIST)))

  return True
1345031
def validate(self, metadata, path, value):
        
        if isinstance(value, Requirement):
            # if the RHS is still a Requirement object, it was not set
            if metadata.testing and self.mock_value is not None:
                value = self.mock_value
            elif self.default_value is not None:
                value = self.default_value
            elif not value.required:
                return None
            else:
                raise ValidationError(f"Missing required configuration for: {'.'.join(path)}")

        try:
            return self.type(value)
        except ValueError:
            raise ValidationError(f"Missing required configuration for: {'.'.join(path)}: {value}")
586132
def _path_is_abs(path):
    '''
    
    '''
    if path is None:
        return True
    try:
        return os.path.isabs(path)
    except AttributeError:
        # Non-string data passed
        return False
219870
def validate_path_exists(s):
    """"""
    if s is None:
        return None
    if os.path.exists(s):
        return s
    else:
        raise ValueError('"%s" should be a path but it does not exist' % s)
1169606
function isValidAbsolutePath(p) {
    var parsedPath;
    try {
        parsedPath = path.parse(p);
    } catch (error) {
        // Not a valid path if it can't be parsed.
        return false;
    }

    return (parsedPath.root === '/');
}
1197251
def validate(path):  # pragma: no cover
    """"""
    # reads the 'dynaconf_validators.toml' from path
    # for each section register the validator for specific env
    # call validate

    path = Path(path)

    if not str(path).endswith(".toml"):
        path = path / "dynaconf_validators.toml"

    if not path.exists():  # pragma: no cover  # noqa
        click.echo(
            click.style("{} not found".format(path), fg="white", bg="red")
        )
        sys.exit(1)

    validation_data = toml.load(open(str(path)))

    success = True
    for env, name_data in validation_data.items():
        for name, data in name_data.items():
            if not isinstance(data, dict):  # pragma: no cover
                click.echo(
                    click.style(
                        "Invalid rule for parameter '{}'".format(name),
                        fg="white",
                        bg="yellow",
                    )
                )
            else:
                data.setdefault("env", env)
                click.echo(
                    click.style(
                        "Validating '{}' with '{}'".format(name, data),
                        fg="white",
                        bg="blue",
                    )
                )
                try:
                    Validator(name, **data).validate(settings)
                except ValidationError as e:
                    click.echo(
                        click.style(
                            "Error: {}".format(e), fg="white", bg="red"
                        )
                    )
                    success = False

    if success:
        click.echo(click.style("Validation success!", fg="white", bg="green"))
993322
def path_type(path, target):
    
    if os.path.isfile(path) and target == "file":
        return True
    elif os.path.isdir(path) and target == "directory":
        return True
    else:
        print("Error: Path given is not a {}: {}".format(target, path))
    return False
1316808
public static void validatePath(String path)
            throws IllegalArgumentException {
        if (path == null) {
            throw new IllegalArgumentException("Path cannot be null");
        }
        if (path.length() == 0) {
            throw new IllegalArgumentException("Path length must be > 0");
        }
        if (path.charAt(0) != '/') {
            throw new IllegalArgumentException(
                    "Path \"" + path + "\" must start with / character");
        }
        if (path.length() == 1) { // done checking - it's the root
            return;
        }
        if (path.charAt(path.length() - 1) == '/') {
            throw new IllegalArgumentException(
                    "Path must not end with / character");
        }

        String reason = null;
        char lastc = '/';
        char chars[] = path.toCharArray();
        char c;
        for (int i = 1; i < chars.length; lastc = chars[i], i++) {
            c = chars[i];

            if (c == 0) {
                reason = "null character not allowed @" + i;
                break;
            } else if (c == '/' && lastc == '/') {
                reason = "empty node name specified @" + i;
                break;
            } else if (c == '.' && lastc == '.') {
                if (chars[i - 2] == '/'
                        && ((i + 1 == chars.length) || chars[i + 1] == '/')) {
                    reason = "relative paths not allowed @" + i;
                    break;
                }
            } else if (c == '.') {
                if (chars[i - 1] == '/'
                        && ((i + 1 == chars.length) || chars[i + 1] == '/')) {
                    reason = "relative paths not allowed @" + i;
                    break;
                }
            } else if (c > '\u0000' && c < '\u001f' || c > '\u007f'
                    && c < '\u009F' || c > '\ud800' && c < '\uf8ff'
                    || c > '\ufff0' && c < '\uffff') {
                reason = "invalid charater @" + i;
                break;
            }
        }

        if (reason != null) {
            throw new IllegalArgumentException("Invalid path string \"" + path
                    + "\" caused by " + reason);
        }
    }
851099
def validate_file(parser, arg):
    """"""
    if not os.path.isfile(arg):
        parser.error("%s is not a file." % arg)
    return arg
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')
289273
def valid_path?(pathname)
      # directory
      return false if pathname.directory?

      # overreaching AWS globbing
      return false if !destination_dir.to_s.empty? && !(pathname.to_s =~ /^#{destination_dir.to_s}\//)

      true
    end
669669
def isabspath(self):
        """"""
        return (self.scheme is None and self.authority is None and
                self.path.startswith(self.SLASH))
369380
def validate_no_duplicate_paths(self, resources):
        
        paths = set()
        for item in resources:
            file_name = item.get('path')
            if file_name in paths:
                raise ValueError(
                    '%s path was specified more than once in the metadata' %
                    file_name)
            paths.add(file_name)
531963
def _assert_path_is_rw(self):
        
        if not self.path:
            raise ValueError("`path` argument must be set!")

        if not os.path.exists(self.path):
            raise IOError("`%s` not found." % self.path)

        if not os.path.isdir(self.path):
            raise IOError("`%s` is not a directory!" % self.path)

        if not os.access(self.path, (os.R_OK or os.W_OK)):
            raise IOError(
                "Can't access `%s`, please check permissions." % self.path
            )
1167212
def _validate_extension(self):
        
        extension = self.fpath.split('.')[-1]
        if extension not in self.supported_extensions:
            raise UnsupportedExtensionError