Checks the validity of the load_path, returns a sanitized version
    with invalid paths removed.
767323
def _check_load_paths(load_path):
    '''
    
    '''
    if load_path is None or not isinstance(load_path, six.string_types):
        return None

    _paths = []

    for _path in load_path.split(':'):
        if os.path.isabs(_path) and os.path.isdir(_path):
            _paths.append(_path)
        else:
            log.info('Invalid augeas_cfg load_path entry: %s removed', _path)

    if not _paths:
        return None

    return ':'.join(_paths)
947475
def bad_uri?(path)
      invalid_segments = %w{. ..}
      path.split('/').any? { |segment| invalid_segments.include?(segment) }
    end
644215
def file_verified?(path, expected_digest, digest_type=:md5)
      return false unless file_exists?(path)
      raise "Unknown disgest type: #{digest_type}" unless can?("digest_#{digest_type}")
      digest = self.send("digest_#{digest_type}", path).first
      info "#{digest_type} (#{path}) = #{digest}"
      digest.to_s == expected_digest.to_s
    end
1324446
def inform_if_paths_invalid(egrc_path, examples_dir, custom_dir, debug=True):
    
    if (not debug):
        return

    if (egrc_path):
        _inform_if_path_does_not_exist(egrc_path)

    if (examples_dir):
        _inform_if_path_does_not_exist(examples_dir)

    if (custom_dir):
        _inform_if_path_does_not_exist(custom_dir)
694567
def safe_remove(path):
    
    if not os.path.exists(path):
        return

    try:
        if os.path.isdir(path) and not os.path.islink(path):
            shutil.rmtree(path)
        else:
            os.remove(path)
    except OSError:
        if os.path.exists(path):
            raise
641907
def isvalid(self):
        

        gcontents = [gf.rstrip('\n') for gf in self.repo.bake('ls-files')()]
        fcontents = os.listdir(self.repopath)
        return all([sf in gcontents for sf in std_files]) and all([sf in fcontents for sf in std_files])
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
10423
def in_dest_dir(*paths)
      paths.reduce(dest) do |base, path|
        Bunto.sanitized_path(base, path)
      end
    end
1211396
def _paths_must_exists(path):
    
    path = to_unicode(path)
    if not os.path.exists(path):
        raise argparse.ArgumentTypeError("{} is not a valid file/folder.".format(path))
    return path
358819
def verify(path):
        """"""
        path = pathlib.Path(path)
        valid = False
        if path.suffix == ".npy":
            try:
                nf = np.load(str(path), mmap_mode="r", allow_pickle=False)
            except (OSError, ValueError, IsADirectoryError):
                pass
            else:
                if len(nf.shape) == 2:
                    valid = True
        return valid
327224
def sanitize_lib_name(library_path):
    

    lib_name = os.path.basename(library_path)

    # Some regexp magic needed to extract in a system-independent (mac/linux) way the library name

    tokens = re.findall("lib(.+)(\.so|\.dylib|\.a)(.+)?", lib_name)

    if not tokens:
        raise RuntimeError('Attempting to find %s in directory %s but there are no libraries in this directory'%(lib_name,library_path))


    return tokens[0][0]
1029696
def is_valid(file_path):
    
    from os import path, stat

    can_open = False

    try:
        with open(file_path) as fp:
            can_open = True
    except IOError:
        return False

    is_file = path.isfile(file_path)

    return path.exists(file_path) and is_file and stat(file_path).st_size > 0
201434
def clean_path(p):
    
    p = os.path.expanduser(p)
    p = os.path.expandvars(p)
    p = os.path.abspath(p)
    return p
789754
def _validate_cert_path(name):
    '''
    
    '''
    cmd = r"Test-Path -Path '{0}'".format(name)

    if not ast.literal_eval(_cmd_run(cmd=cmd)):
        raise SaltInvocationError(r"Invalid path specified: {0}".format(name))
551859
def LoadChecksFromFiles(file_paths, overwrite_if_exists=True):
  """"""
  loaded = []
  for file_path in file_paths:
    configs = LoadConfigsFromFile(file_path)
    for conf in itervalues(configs):
      check = Check(**conf)
      # Validate will raise if the check doesn't load.
      check.Validate()
      loaded.append(check)
      CheckRegistry.RegisterCheck(
          check,
          source="file:%s" % file_path,
          overwrite_if_exists=overwrite_if_exists)
      logging.debug("Loaded check %s from %s", check.check_id, file_path)
  return loaded
1216063
def isValid( self ):
        
        check = nativestring(self._filepathEdit.text()).split(os.path.pathsep)[0]
        if ( self.filepathMode() == XFilepathEdit.Mode.SaveFile ):
            check = os.path.dirname(check)
        
        return os.path.exists(check)
305421
def plugin_valid(self, filepath):
        
        plugin_valid = False
        for extension in self.extensions:
            if filepath.endswith(".{}".format(extension)):
                plugin_valid = True
                break
        return plugin_valid