README
liblaf.cherries.core.assets.bundle
¶
Classes:
-
Bundle–Base class for artifact companion-file discovery.
-
BundleItem–Related file discovered for a logged artifact.
-
BundleLandmarks–Expand mesh artifacts to an optional sibling landmark file.
-
BundleRegistry–Registry that expands logged artifacts through matching bundles.
-
BundleSeries–Expand a VTK
.seriesmanifest to its required frame files.
Functions:
-
relative_or_absolute–Return
pathrelative toprefix, or an absolute path if unrelated. -
relative_or_name–Return
pathrelative toprefix, or just the file name if unrelated.
Attributes:
Bundle
¶
Bases: ABC
flowchart TD
liblaf.cherries.core.assets.bundle.Bundle[Bundle]
click liblaf.cherries.core.assets.bundle.Bundle href "" "liblaf.cherries.core.assets.bundle.Bundle"
Base class for artifact companion-file discovery.
Methods:
-
ls_files–Yield files that should be logged with
path. -
match–Return whether this bundle can expand
path.
ls_files
abstractmethod
¶
ls_files(path: Path) -> Iterable[BundleItem]
Yield files that should be logged with path.
Parameters:
-
path(Path) –Primary artifact path.
Returns:
-
Iterable[BundleItem]–Iterable of companion files and their optional/missing-file policy.
Source code in src/liblaf/cherries/core/assets/bundle/_abc.py
BundleItem
¶
Bases: NamedTuple
flowchart TD
liblaf.cherries.core.assets.bundle.BundleItem[BundleItem]
click liblaf.cherries.core.assets.bundle.BundleItem href "" "liblaf.cherries.core.assets.bundle.BundleItem"
Related file discovered for a logged artifact.
Attributes:
Parameters:
-
path(ForwardRef, default:None) – -
optional(ForwardRef, default:None) –
BundleLandmarks
¶
Bases: Bundle
flowchart TD
liblaf.cherries.core.assets.bundle.BundleLandmarks[BundleLandmarks]
liblaf.cherries.core.assets.bundle._abc.Bundle[Bundle]
liblaf.cherries.core.assets.bundle._abc.Bundle --> liblaf.cherries.core.assets.bundle.BundleLandmarks
click liblaf.cherries.core.assets.bundle.BundleLandmarks href "" "liblaf.cherries.core.assets.bundle.BundleLandmarks"
click liblaf.cherries.core.assets.bundle._abc.Bundle href "" "liblaf.cherries.core.assets.bundle._abc.Bundle"
Expand mesh artifacts to an optional sibling landmark file.
Cherries treats files such as mesh.vtu and mesh.stl as primary mesh
artifacts. When a sibling mesh.landmarks.json exists, the file is logged
with the primary artifact; when it is absent, no warning is emitted.
Parameters:
-
suffixes(set[str], default:{'.vtr', '.vtkhdf', '.obj', '.stl', '.ply', '.vtu', '.vtp', '.vti', '.vts'}) –
Methods:
-
ls_files–Yield the optional
.landmarks.jsoncompanion forpath. -
match–Return whether
pathhas a supported mesh suffix.
Attributes:
suffixes
class-attribute
instance-attribute
¶
suffixes: set[str] = field(
factory=lambda: {
".obj",
".ply",
".stl",
".vti",
".vtkhdf",
".vtp",
".vtr",
".vts",
".vtu",
}
)
ls_files
¶
ls_files(path: Path) -> Generator[BundleItem]
Yield the optional .landmarks.json companion for path.
Source code in src/liblaf/cherries/core/assets/bundle/_landmarks.py
match
¶
BundleRegistry
¶
Registry that expands logged artifacts through matching bundles.
Examples:
Parameters:
-
registry(list[Bundle], default:[BundleLandmarks(suffixes={'.vtr', '.vtkhdf', '.obj', '.stl', '.ply', '.vtu', '.vtp', '.vti', '.vts'}), BundleSeries()]) –
Methods:
-
ls_files–Yield companion files from every bundle that matches
path. -
register–Append
bundleto the registry.
Attributes:
registry
class-attribute
instance-attribute
¶
ls_files
¶
ls_files(path: Path) -> Generator[BundleItem]
Yield companion files from every bundle that matches path.
BundleSeries
¶
Bases: Bundle
flowchart TD
liblaf.cherries.core.assets.bundle.BundleSeries[BundleSeries]
liblaf.cherries.core.assets.bundle._abc.Bundle[Bundle]
liblaf.cherries.core.assets.bundle._abc.Bundle --> liblaf.cherries.core.assets.bundle.BundleSeries
click liblaf.cherries.core.assets.bundle.BundleSeries href "" "liblaf.cherries.core.assets.bundle.BundleSeries"
click liblaf.cherries.core.assets.bundle._abc.Bundle href "" "liblaf.cherries.core.assets.bundle._abc.Bundle"
Expand a VTK .series manifest to its required frame files.
Methods:
-
ls_files–Read
pathand yield every frame listed in the manifest. -
match–Return whether
pathends with.series.
ls_files
¶
ls_files(path: Path) -> Generator[BundleItem]
Read path and yield every frame listed in the manifest.
Source code in src/liblaf/cherries/core/assets/bundle/_series.py
relative_or_absolute
¶
Return path relative to prefix, or an absolute path if unrelated.
Examples:
>>> relative_or_absolute(
... Path("/tmp/cherries/data/out.txt"), Path("/tmp/cherries")
... )
PosixPath('data/out.txt')
>>> relative_or_absolute(Path("/var/tmp/out.txt"), Path("/tmp/cherries"))
PosixPath('/var/tmp/out.txt')
Source code in src/liblaf/cherries/core/assets/bundle/_utils.py
relative_or_name
¶
Return path relative to prefix, or just the file name if unrelated.
Examples:
>>> relative_or_name(Path("/tmp/cherries/data/out.txt"), Path("/tmp/cherries"))
PosixPath('data/out.txt')
>>> relative_or_name(Path("/var/tmp/out.txt"), Path("/tmp/cherries"))
PosixPath('out.txt')