bamboost.index.scanner
Attributes
- log=
BAMBOOST_LOGGER.getChild('Scanner') - IDENTIFIER_PREFIX=
'.bamboost-collection' - IDENTIFIER_SEPARATOR=
'-'
Functions
(path, uid) -> dict[str, Any] | NoneLoad the metadata of a collection from its identifier file.
Arguments:
- path:
pathlib.PathPath to the collection directory
- uid:
strUID of the collection
(data) -> dict[str, Any]Normalize the metadata of a collection.
This also handles backward compatibility for the "Date of creation" field.
Arguments:
- data:
typing.Mapping[str, typing.Any]The raw metadata dictionary.
(data) -> dict[str, Any]Normalize simulation metadata before writing to SQL.
Arguments:
- data:
typing.Mapping[str, typing.Any]
(values, *, casefold=False) -> list[str]Deduplicate a sequence of strings.
Arguments:
- values:
typing.AnyThe sequence of strings to deduplicate.
- casefold:
bool=FalseWhether to ignore case when deduplicating.
(path, uid) -> NoneCreate an identifier file in the collection directory.
Arguments:
- path:
StrPathPath to the collection directory
- uid:
strUID of the collection
(uid) -> strArguments:
- uid:
str
(path, uid) -> boolArguments:
- path:
pathlib.Path - uid:
str
(path) -> str | NoneArguments:
- path:
pathlib.Path
(uid, root_dir) -> tuple[Path, ...]Find the collection with UID under given root_dir.
Arguments:
- uid:
strUID to search for
- root_dir:
pathlib.Pathroot directory for search
(pattern, root_dir, exclude=None) -> tuple[Path, ...]Locate every file matching pattern under root_dir while pruning directory names listed in exclude (exact-match on the final path part).
Returns an immutable tuple of absolute paths (str) just like the POSIX helper.
Arguments:
- pattern:
str - root_dir:
str | os.os.PathLike - exclude:
typing.Iterable[str] | None=None
(root_dir) -> tuple[tuple[str, Path], ...]Scan the directory for collections.
Arguments:
- root_dir:
pathlib.PathDirectory to scan for collections
Returns
tuple[tuple[str, pathlib.Path], ...]Tuple of tuples with the UID and path of the collection(value) -> datetime | NoneArguments:
- value:
typing.Any
Bamboost