Vfs#

class Vfs(**properties: Any)#

Superclasses: Object

Entry point for using GIO functionality.

Methods#

class Vfs
get_default() Vfs#

Gets the default Vfs for the system.

get_file_for_path(path: str) File#

Gets a File for path.

Parameters:

path – a string containing a VFS path.

get_file_for_uri(uri: str) File#

Gets a File for uri.

This operation never fails, but the returned object might not support any I/O operation if the URI is malformed or if the URI scheme is not supported.

Parameters:

uri – a string containing a URI

get_local() Vfs#

Gets the local Vfs for the system.

get_supported_uri_schemes() list[str]#

Gets a list of URI schemes supported by vfs.

is_active() bool#

Checks if the VFS is active.

parse_name(parse_name: str) File#

This operation never fails, but the returned object might not support any I/O operations if the parse_name cannot be parsed by the Vfs module.

Parameters:

parse_name – a string to be parsed by the VFS module.

register_uri_scheme(scheme: str, uri_func: Callable[[...], File] | None = None, parse_name_func: Callable[[...], File] | None = None, *parse_name_data: Any) bool#

Registers uri_func and parse_name_func as the File URI and parse name lookup functions for URIs with a scheme matching scheme. Note that scheme is registered only within the running application, as opposed to desktop-wide as it happens with GVfs backends.

When a File is requested with an URI containing scheme (e.g. through new_for_uri()), uri_func will be called to allow a custom constructor. The implementation of uri_func should not be blocking, and must not call register_uri_scheme() or unregister_uri_scheme().

When parse_name() is called with a parse name obtained from such file, parse_name_func will be called to allow the File to be created again. In that case, it’s responsibility of parse_name_func to make sure the parse name matches what the custom File implementation returned when get_parse_name() was previously called. The implementation of parse_name_func should not be blocking, and must not call register_uri_scheme() or unregister_uri_scheme().

It’s an error to call this function twice with the same scheme. To unregister a custom URI scheme, use unregister_uri_scheme().

Added in version 2.50.

Parameters:
  • scheme – an URI scheme, e.g. “http”

  • uri_func – a VfsFileLookupFunc

  • parse_name_func – a VfsFileLookupFunc

  • parse_name_data – custom data passed to be passed to parse_name_func, or None

unregister_uri_scheme(scheme: str) bool#

Unregisters the URI handler for scheme previously registered with register_uri_scheme().

Added in version 2.50.

Parameters:

scheme – an URI scheme, e.g. “http”

Virtual Methods#

class Vfs
do_add_writable_namespaces(list: FileAttributeInfoList) None#

The type of the None singleton.

Parameters:

list

do_get_file_for_path(path: str) File#

Gets a File for path.

Parameters:

path – a string containing a VFS path.

do_get_file_for_uri(uri: str) File#

Gets a File for uri.

This operation never fails, but the returned object might not support any I/O operation if the URI is malformed or if the URI scheme is not supported.

Parameters:

uri – a string containing a URI

do_get_supported_uri_schemes() list[str]#

Gets a list of URI schemes supported by vfs.

do_is_active() bool#

Checks if the VFS is active.

do_local_file_add_info(filename: str, device: int, attribute_matcher: FileAttributeMatcher, info: FileInfo, cancellable: Cancellable | None, extra_data: None, free_extra_data: Callable[[None], None]) None#

The type of the None singleton.

Parameters:
  • filename

  • device

  • attribute_matcher

  • info

  • cancellable

  • extra_data

  • free_extra_data

do_local_file_moved(source: str, dest: str) None#

The type of the None singleton.

Parameters:
  • source

  • dest

do_local_file_removed(filename: str) None#

The type of the None singleton.

Parameters:

filename

do_local_file_set_attributes(filename: str, info: FileInfo, flags: FileQueryInfoFlags, cancellable: Cancellable | None = None) bool#

The type of the None singleton.

Parameters:
  • filename

  • info

  • flags

  • cancellable

do_parse_name(parse_name: str) File#

This operation never fails, but the returned object might not support any I/O operations if the parse_name cannot be parsed by the Vfs module.

Parameters:

parse_name – a string to be parsed by the VFS module.

Fields#

class Vfs
parent_instance#