Check if path is a valid directory.
480329
def valid_directory?(entry)
      File.directory?(source.join(entry)) && !IGNORE_DIR.include?(File.basename(entry))
    end
711953
def isdir(path, message):
    
    if not os.path.isdir(path):
        raise FileNotFoundError(
            errno.ENOENT,
            "{}: {}".format(message, os.strerror(errno.ENOENT)), path)
634416
def is_readable_dir(path):
  """"""
  return os.path.isdir(path) and os.access(path, os.R_OK) and os.access(path, os.X_OK)
872786
def is_dir(path):
    """"""
    try:
        return path.expanduser().absolute().is_dir()
    except AttributeError:
        return os.path.isdir(os.path.abspath(os.path.expanduser(str(path))))
796247
def check_path():
    """"""
    dirname = osp.abspath(osp.join(osp.dirname(__file__), osp.pardir))
    if dirname not in sys.path:
        show_warning("Spyder must be installed properly "
                     "(e.g. from source: 'python setup.py install'),\n"
                     "or directory '%s' must be in PYTHONPATH "
                     "environment variable." % dirname)
630920
def ensure_dir(path):
    
    if not os.path.exists(path):
        # path does not exist, create the directory
        os.mkdir(path)
    else:
        # The path exists, check that it is not a file
        if os.path.isfile(path):
            raise Exception("Path %s already exists, and it is a file, not a directory" % path)
487494
def check_file_existence(path):
    

    pathvalidate.validate_file_path(path)

    if not os.path.lexists(path):
        raise FileNotFoundError(path)

    if os.path.isfile(path):
        logger.debug("file found: " + path)
        return FileType.FILE

    if os.path.isdir(path):
        logger.debug("directory found: " + path)
        return FileType.DIRECTORY

    if os.path.islink(path):
        logger.debug("link found: " + path)
        return FileType.LINK

    raise RuntimeError()
1283654
def path_is_inside(path, dirname):
    """"""
    path = os.path.abspath(path)
    dirname = os.path.abspath(dirname)
    while len(path) >= len(dirname):
        if path == dirname:
            return True
        newpath = os.path.dirname(path)
        if newpath == path:
            return False
        path = newpath
    return False
303568
def ensure_dir(path):
    
    os.makedirs(os.path.abspath(os.path.dirname(path)), exist_ok=True)
85329
def has_directory(self, name: str):
        '''
        
        '''
        return os.path.isdir(self._path / name)
1040318
def _check_directory(directory):
    """"""
    if directory is not None:
        if not exists(directory):
            raise CommandError(
                "Cannot run command - directory {0} does not exist".format(directory)
            )

        if not isdir(directory):
            raise CommandError(
                "Cannot run command - specified directory {0} is not a directory.".format(
                    directory
                )
            )
1224349
def _valid_folder(self, base, name):
        """"""

        valid = True
        fullpath = os.path.join(base, name)
        if (
            not self.recursive or
            (
                self.folder_exclude_check is not None and
                not self.compare_directory(fullpath[self._base_len:] if self.dir_pathname else name)
            )
        ):
            valid = False
        if valid and (not self.show_hidden and util.is_hidden(fullpath)):
            valid = False
        return self.on_validate_directory(base, name) if valid else valid
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
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
580710
def valid_path(value):
    ""
    # Generate UnicodeDecodeError if path can't store as ASCII.
    value.encode("ascii")
    # Cookies without leading slash will likely be ignored, raise ASAP.
    if not (value and value[0] == "/"):
        return False
    if not Definitions.PATH_RE.match(value):
        return False
    return True
1302474
def is_valid_file(path):
    '''  '''
    return os.path.exists(path) and os.path.isfile(path)
449310
def _path_is_valid(self, path):
        
        VALIDATORS = [
            (os.path.isabs, self._ERROR_PATH_NOT_ABSOLUTE),
            (os.path.exists, self._ERROR_PATH_DOESNT_EXISTS),
            (os.path.isdir, self._ERROR_PATH_NOT_A_DIR),
        ]

        for validator in VALIDATORS:
            func, str_err = validator
            if not func(path):
                self._print(str_err.format(path), 'red')
                return
        return True