BlockFile

class BlockFile(data: BlockData = <cfinterface.data.blockdata.BlockData object>)[source]

Class that models a file divided by blocks, where the reading and writing are given by a series of blocks.

classmethod read(content: str | bytes, *args: Any, version: str | None = None, **kwargs: Any) BlockFile[source]

Read from a file path or buffer. version selects a component set from VERSIONS without mutating the class.

classmethod read_many(paths: list[str], *, version: str | None = None) dict[str, BlockFile][source]

Read multiple files and return a dict keyed by file path.

Parameters:
pathslist[str]

File paths to read.

versionstr or None, optional

Version key passed to read(). Defaults to None.

Returns:
dict[str, BlockFile]

Mapping from each file path to its parsed BlockFile instance.

classmethod set_version(v: str) None[source]

Set the active block set for the given version key.

Resolves to the latest available version <= v, so an out-of-range key falls back to the nearest known version.

Deprecated since version Use: read(content, version="...") instead.

validate(version: str | None = None, threshold: float = 0.5) VersionMatchResult[source]

Validate parsed data against expected component types.