SectionData
- class SectionData(root: Section)[source]
Class for a storing, managing and accessing data for a section file.
- add_after(after: Section, new: Section)[source]
Adds a new section to the data after another specified section.
- add_before(before: Section, new: Section)[source]
Adds a new section to the data before another specified section.
- append(s: Section)[source]
Appends a section to the end of the data.
- Parameters:
s (Section) – The new section to append to the data
- get_sections_of_type(t: Type[T], **kwargs) T | List[T] | None [source]
A section or section list that only returns sections of type T that meet given filter requirements passed as kwargs.
- Parameters:
t (Type[T]) – The section type that is desired
- Returns:
Sections filtered by type T and optional properties
- Return type:
T | list[T] | None
- of_type(t: Type[T]) Generator[T, None, None] [source]
A section generator that only returns sections of type T.
- Parameters:
t (Type[T]) – The section type that is desired
- Yield:
Sections filtered by type T
- Return type:
Generator[T, None, None]
- preppend(s: Section)[source]
Appends a section to the beginning of the data.
- Parameters:
s (Section) – The new section to preppended to the data.
- remove(s: Section)[source]
Removes an existing section in the chain.
- Parameters:
s (Section) – The section to be removed
- remove_sections_of_type(t: Type[T], **kwargs)[source]
Removes a set of sections given a type and an optional group of filters, similar to
get_sections_of_type()
- Parameters:
t (Type[T]) – The section type that is desired