dfvfs.resolver package

Submodules

dfvfs.resolver.context module

The resolver context object.

class dfvfs.resolver.context.Context[source]

Bases: object

Resolver context.

CacheFileObject(path_spec, file_object)[source]

Caches a file-like object based on a path specification.

Parameters
  • path_spec (PathSpec) – path specification.

  • file_object (FileIO) – file-like object.

Raises

KeyError – if the file object already is cached.

CacheFileSystem(path_spec, file_system)[source]

Caches a file system object based on a path specification.

Parameters
  • path_spec (PathSpec) – path specification.

  • file_system (FileSystem) – file system object.

Raises

KeyError – if the file system already is cached.

DeregisterMountPoint(mount_point)[source]

Deregisters a path specification mount point.

Parameters

mount_point (str) – mount point identifier.

Raises

KeyError – if the corresponding mount point is not set.

Empty()[source]

Empties the caches.

GetFileObject(path_spec)[source]

Retrieves a file-like object defined by path specification.

Parameters

path_spec (PathSpec) – path specification.

Returns

a file-like object or None if not cached.

Return type

FileIO

GetFileSystem(path_spec)[source]

Retrieves a file system object defined by path specification.

Parameters

path_spec (PathSpec) – path specification.

Returns

a file system object or None if not cached.

Return type

FileSystem

GetMountPoint(mount_point)[source]

Retrieves the path specification of a mount point.

Parameters

mount_point (str) – mount point identifier.

Returns

path specification of the mount point or None if the mount

point does not exists.

Return type

PathSpec

RegisterMountPoint(mount_point, path_spec)[source]

Registers a path specification mount point.

Parameters
  • mount_point (str) – mount point identifier.

  • path_spec (PathSpec) – path specification of the mount point.

Raises

KeyError – if the corresponding mount point is already set.

dfvfs.resolver.resolver module

The path specification resolver.

class dfvfs.resolver.resolver.Resolver[source]

Bases: object

Path specification resolver.

classmethod OpenFileEntry(path_spec_object, resolver_context=None)[source]

Opens a file entry object defined by path specification.

Parameters
  • path_spec_object (PathSpec) – path specification.

  • resolver_context (Optional[Context]) – resolver context, where None represents the built in context which is not multi process safe.

Returns

file entry or None if the path specification could not be

resolved.

Return type

FileEntry

classmethod OpenFileObject(path_spec_object, resolver_context=None)[source]

Opens a file-like object defined by path specification.

Parameters
  • path_spec_object (PathSpec) – path specification.

  • resolver_context (Optional[Context]) – resolver context, where None represents the built in context which is not multi process safe.

Returns

file-like object or None if the path specification could not

be resolved.

Return type

FileIO

Raises
  • BackEndError – if the file object cannot be opened.

  • MountPointError – if the mount point specified in the path specification does not exist.

  • PathSpecError – if the path specification is incorrect.

  • TypeError – if the path specification type is unsupported.

classmethod OpenFileSystem(path_spec_object, resolver_context=None)[source]

Opens a file system object defined by path specification.

Parameters
  • path_spec_object (PathSpec) – path specification.

  • resolver_context (Optional[Context]) – resolver context, where None represents the built in context which is not multi process safe.

Returns

file system or None if the path specification could not

be resolved or has no file system object.

Return type

FileSystem

Raises
  • AccessError – if the access to open the file system was denied.

  • BackEndError – if the file system cannot be opened.

  • MountPointError – if the mount point specified in the path specification does not exist.

  • PathSpecError – if the path specification is incorrect.

  • TypeError – if the path specification type is unsupported.

key_chain = <dfvfs.credentials.keychain.KeyChain object>

Module contents