SectionFile
- class SectionFile(data=<cfinterface.data.sectiondata.SectionData object>)[source]
Class that models a file divided by registers, where the reading and writing are given by a series of registers.
- property data: SectionData
Exposes the
SectionData
object, which gives access to the methods:preppend()
append()
add_before()
add_after()
get_blocks_of_type()
- Returns:
The data internal object
- Return type:
SectionData
- classmethod read(content: str | bytes, *args, **kwargs)[source]
Reads the sectionfile data from a given file in disk.
- classmethod set_version(v: str)[source]
Sets the file’s version to be read. Different file versions may contain different sections. The version to be set is considered is forced to the latest version with a new section set available.
If a SectionFile has VERSIONS with keys {“v0”: …, “v1”: …}, calling
set_version("v2")
will set the version tov1
.- Parameters:
v (str) – The file version to be read.