Shortcuts

mmengine.fileio.get_file_backend

mmengine.fileio.get_file_backend(uri=None, *, backend_args=None, enable_singleton=False)[source]

Return a file backend based on the prefix of uri or backend_args.

Parameters:
  • uri (str or Path) – Uri to be parsed that contains the file prefix.

  • backend_args (dict, optional) – Arguments to instantiate the corresponding backend. Defaults to None.

  • enable_singleton (bool) – Whether to enable the singleton pattern. If it is True, the backend created will be reused if the signature is same with the previous one. Defaults to False.

Returns:

Instantiated Backend object.

Return type:

BaseStorageBackend

Examples

>>> # get file backend based on the prefix of uri
>>> uri = 's3://path/of/your/file'
>>> backend = get_file_backend(uri)
>>> # get file backend based on the backend_args
>>> backend = get_file_backend(backend_args={'backend': 'petrel'})
>>> # backend name has a higher priority if 'backend' in backend_args
>>> backend = get_file_backend(uri, backend_args={'backend': 'petrel'})
Read the Docs v: latest
Versions
latest
stable
v0.10.3
v0.10.2
v0.10.1
v0.10.0
v0.9.1
v0.9.0
v0.8.5
v0.8.4
v0.8.3
v0.8.2
v0.8.1
v0.8.0
v0.7.4
v0.7.3
v0.7.2
v0.7.1
v0.7.0
v0.6.0
v0.5.0
v0.4.0
v0.3.0
v0.2.0
Downloads
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.