save

method of dascore.core.annotations.AnnotationSet source

save(
    self ,
    path ,
)-> ‘pathlib.Path’

Write the set to a directory, creating it if needed.

The directory states the set in three parts: what it is and which dimensions it holds, its annotations, and – where any path or polygon needs them – its vertices. It reads back through dascore.annotations.

The attributes are written as JSON rather than as YAML, so storing a set needs nothing beyond the standard library; a set authored by hand may spell them in YAML, which reads back the same.

Writing states the whole directory, so a part this set does not have is removed rather than left behind. A stale vertices table, or the YAML the attributes used to be spelled in, would otherwise sit beside what was written and leave a directory which loaded before the save refusing to load after it.

Parameters

Parameter Description
path The directory to write into.

Returns

The directory written to, so a save reads straight back.