@classmethod
  def OpenFileSystem(cls, path_spec, resolver_context=None):
    """Opens a file system object defined by path specification.

    Args:
      path_spec: the path specification (instance of PathSpec).
      resolver_context: the optional resolver context (instance of
                        resolver.Context). The default is None which will use
                        the built in context which is not multi process safe.

    Returns:
      The file system object (instance of vfs.FileSystem) or None if the path
      specification could not be resolved or has no file system object.

    Raises:
      AccessError: if the access to open the file system was denied.
      BackEndError: if the file system cannot be opened.
      KeyError: if resolver helper object is not set for the corresponding
                type indicator.
      PathSpecError: if the path specification is incorrect.
    """
    if resolver_context is None:
      resolver_context = cls._resolver_context

    if path_spec.type_indicator == definitions.TYPE_INDICATOR_MOUNT:
      if path_spec.HasParent():
        raise errors.PathSpecError(
            u'Unsupported mount path specification with parent.')

      mount_point = getattr(path_spec, u'identifier', None)
      if not mount_point:
        raise errors.PathSpecError(
            u'Unsupported path specification without mount point identifier.')

      path_spec = mount_manager.MountPointManager.GetMountPoint(mount_point)
      if not path_spec:
        raise errors.MountPointError(
            u'No such mount point: {0:s}'.format(mount_point))

    file_system = resolver_context.GetFileSystem(path_spec)
    if not file_system:
      if path_spec.type_indicator not in cls._resolver_helpers:
        raise KeyError((
            u'Resolver helper object not set for type indicator: '
            u'{0:s}.').format(path_spec.type_indicator))

      resolver_helper = cls._resolver_helpers[path_spec.type_indicator]
      file_system = resolver_helper.NewFileSystem(resolver_context)

    try:
      file_system.Open(path_spec)
    except (errors.AccessError, errors.PathSpecError):
      raise
    except (IOError, __HOLE__) as exception:
      raise errors.BackEndError(
          u'Unable to open file system with error: {0:s}'.format(exception))

    return file_system
dataset/ETHPy150Open log2timeline/dfvfs/dfvfs/resolver/resolver.py/Resolver.OpenFileSystem