Base¶
- class audbackend.interface.Base(backend)[source]¶
Interface base class.
Provides an interface to a backend, see e.g.
audbackend.Unversioned
andaudbackend.Versioned
.Derive from this class to create a new interface.
- Parameters
backend (
Base
) – backend object
backend¶
- Base.backend¶
Backend object.
- Returns
backend object
Examples
>>> interface.backend audbackend.backend.FileSystem('host', 'repo')
join()¶
- Base.join(path, *paths)[source]¶
Join to path on backend.
- Parameters
path (
str
) – first part of path*paths – additional parts of path
- Return type
- Returns
path joined by
Backend.sep
- Raises
ValueError – if
path
contains invalid character or does not start with'/'
, or if joined path contains invalid character
Examples
>>> interface.join("/", "file.txt") '/file.txt' >>> interface.join("/sub", "file.txt") '/sub/file.txt' >>> interface.join("//sub//", "/", "", None, "/file.txt") '/sub/file.txt'
repository¶
- Base.repository¶
Repository name.
- Returns
repository name
Examples
>>> interface.repository 'repo'
split()¶
- Base.split(path)[source]¶
Split path on backend into sub-path and basename.
- Parameters
path (
str
) – path containingBackend.sep
as separator- Return type
- Returns
tuple containing (root, basename)
- Raises
ValueError – if
path
does not start with'/'
or does not match'[A-Za-z0-9/._-]+'
Examples
>>> interface.split("/") ('/', '') >>> interface.split("/file.txt") ('/', 'file.txt') >>> interface.split("/sub/") ('/sub/', '') >>> interface.split("/sub//file.txt") ('/sub/', 'file.txt')