BlockData¶
- class BlockData(root: Block)[source]¶
Class for a storing, managing and accessing data for a block file.
- add_after(after: Block, new: Block) None[source]¶
Adds a new block to the data after another specified block.
- add_before(before: Block, new: Block) None[source]¶
Adds a new block to the data before another specified block.
- append(b: Block) None[source]¶
Appends a block to the end of the data.
- Parameters:
b (Block) – The new block to append to the data
- get_blocks_of_type(t: type[_T], **kwargs: object) _T | list[_T] | None[source]¶
A block or block list that only returns blocks of type T that meet given filter requirements passed as kwargs.
- Parameters:
t (Type[_T]) – The block type that is desired
- Returns:
Blocks filtered by type _T and optional properties
- Return type:
_T | list[_T] | None
- of_type(t: type[_T]) Generator[_T, None, None][source]¶
A block generator that only returns blocks of type T.
- Parameters:
t (Type[_T]) – The block type that is desired
- Yield:
Blocks filtered by type _T
- Return type:
Generator[_T, None, None]
- preppend(b: Block) None[source]¶
Appends a block to the beginning of the data.
- Parameters:
b (Block) – The new block to preppended to the data.