Determines if a file entry for a path specification exists.

    Args:
      path_spec (PathSpec): path specification.

    Returns:
      bool: True if the file entry exists.
776392
def FileEntryExistsByPathSpec(self, path_spec):
    
    # Opening a file by inode number is faster than opening a file by location.
    tsk_file = None
    inode = getattr(path_spec, 'inode', None)
    location = getattr(path_spec, 'location', None)

    try:
      if inode is not None:
        tsk_file = self._tsk_file_system.open_meta(inode=inode)
      elif location is not None:
        tsk_file = self._tsk_file_system.open(location)

    except IOError:
      pass

    return tsk_file is not None
831157
def RegisterPathSpec(cls, path_spec_type):
    
    type_indicator = path_spec_type.TYPE_INDICATOR
    if type_indicator in cls._path_spec_types:
      raise KeyError(
          'Path specification type: {0:s} already set.'.format(
              type_indicator))

    cls._path_spec_types[type_indicator] = path_spec_type

    if getattr(path_spec_type, '_IS_SYSTEM_LEVEL', False):
      cls._system_level_type_indicators[type_indicator] = path_spec_type
311004
def check_path(path, otherwise):
    

    if os.path.exists(path):
        print("WARNING: Path '%s' already exists; skipping" % path)
    else:
        otherwise(path)
431873
def is_installable_file(path):
    # type: (PipfileType) -> bool
    """"""
    from packaging import specifiers

    if isinstance(path, Mapping):
        path = convert_entry_to_path(path)

    # If the string starts with a valid specifier operator, test if it is a valid
    # specifier set before making a path object (to avoid breaking windows)
    if any(path.startswith(spec) for spec in "!=<>~"):
        try:
            specifiers.SpecifierSet(path)
        # If this is not a valid specifier, just move on and try it as a path
        except specifiers.InvalidSpecifier:
            pass
        else:
            return False

    parsed = urlparse(path)
    is_local = (
        not parsed.scheme
        or parsed.scheme == "file"
        or (len(parsed.scheme) == 1 and os.name == "nt")
    )
    if parsed.scheme and parsed.scheme == "file":
        path = vistir.compat.fs_decode(vistir.path.url_to_path(path))
    normalized_path = vistir.path.normalize_path(path)
    if is_local and not os.path.exists(normalized_path):
        return False

    is_archive = pip_shims.shims.is_archive_file(normalized_path)
    is_local_project = os.path.isdir(normalized_path) and is_installable_dir(
        normalized_path
    )
    if is_local and is_local_project or is_archive:
        return True

    if not is_local and pip_shims.shims.is_archive_file(parsed.path):
        return True

    return False
480087
def valid_config_exists(config_path=CONFIG_PATH):
    
    if os.path.isfile(config_path):
        try:
            config = read_config(config_path)
            check_config(config)
        except (ConfigurationError, IOError):
            return False
    else:
        return False
    return True
1319371
def check_path(path, create=False):
    
    if not os.path.exists(path):
        if create:
            os.makedirs(path)
            return os.path.exists(path)
        else:
            return False

    return True
5408
def file_exists(filename):
    
    try:
        return os.path.isfile(filename)
    except (UnicodeDecodeError, UnicodeEncodeError, ValueError):
        return False
363966
def FileEntryExistsByPathSpec(self, path_spec):
    
    # Opening a file by MFT entry is faster than opening a file by location.
    # However we need the index of the corresponding $FILE_NAME MFT attribute.
    fsntfs_file_entry = None
    location = getattr(path_spec, 'location', None)
    mft_attribute = getattr(path_spec, 'mft_attribute', None)
    mft_entry = getattr(path_spec, 'mft_entry', None)

    try:
      if mft_attribute is not None and mft_entry is not None:
        fsntfs_file_entry = self._fsntfs_volume.get_file_entry(mft_entry)
      elif location is not None:
        fsntfs_file_entry = self._fsntfs_volume.get_file_entry_by_path(location)

    except IOError as exception:
      raise errors.BackEndError(exception)

    return fsntfs_file_entry is not None
804357
def FileEntryExistsByPathSpec(self, path_spec):
    
    location = getattr(path_spec, 'location', None)

    if (location is None or
        not location.startswith(self.LOCATION_ROOT)):
      return False

    if len(location) == 1:
      return True

    try:
      self._zip_file.getinfo(location[1:])
      return True
    except KeyError:
      pass

    # Check if location could be a virtual directory.
    for name in iter(self._zip_file.namelist()):
      # The ZIP info name does not have the leading path separator as
      # the location string does.
      if name.startswith(location[1:]):
        return True

    return False
445159
def file_exists?(paths, file)
      paths.any? do |path|
        Find.find(path)
            .map { |path_file| Shellwords.escape(path_file) }
            .include?(file)
      end
    end
176774
def FileEntryExistsByPathSpec(self, path_spec):
    
    volume_index = apfs_helper.APFSContainerPathSpecGetVolumeIndex(path_spec)

    # The virtual root file has not corresponding volume index but
    # should have a location.
    if volume_index is None:
      location = getattr(path_spec, 'location', None)
      return location is not None and location == self.LOCATION_ROOT

    return 0 <= volume_index < self._fsapfs_container.number_of_volumes
90291
def GetFileEntryByPathSpec(self, path_spec):
    
    if not self.FileEntryExistsByPathSpec(path_spec):
      return None
    return os_file_entry.OSFileEntry(self._resolver_context, self, path_spec)
127921
def exists(self, path, **kwargs):
        """"""
        try:
            self.get_file_status(path, **kwargs)
            return True
        except HdfsFileNotFoundException:
            return False
1324978
def CheckPathExists(path):
  
  i = 0
  root, ext = os.path.splitext(path)
  while os.path.exists(path):
    i = i + 1
    goodlogging.Log.Info("UTIL", "Path {0} already exists".format(path))
    path = "{0}_{1}".format(root, i) + ext
  return path
210824
def exists(path, **kwargs):
    """"""
    import os.path
    return os.path.exists(path, **kwargs)
1291553
def all_files_exist(file_list):
    
    all_exist = True
    for filename in file_list:
        all_exist = all_exist and os.path.isfile(filename)
    return all_exist
1254266
def check_file_path(self, path):
        
        if os.path.exists(path) is not True:
            msg = "File Not Found {}".format(path)
            raise OSError(msg)