capturegraph.data.save.markers
#
Save Markers#
Marker classes that signal save intent when traversing CaptureTarget data. When a traversal function encounters these markers, it serializes the contained value and writes it to the appropriate file location.
Example
SaveOverWith
#
Marker that signals the value should always be saved.
When traversing a CaptureTarget, if a SaveOverWith is encountered, the contained value will be serialized and written to the corresponding file location, overwriting any existing file.
Attributes:
| Name | Type | Description |
|---|---|---|
value |
The value to be saved. |
Example
Source code in capturegraph-lib/capturegraph/data/save/markers.py
__init__(value)
#
Create a SaveOverWith marker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
The value to be saved. Must have a registered saver or a to_json() method. |
required |
SaveIfMissing
#
Marker that signals the value should only be saved if no file exists.
When traversing a CaptureTarget, if a SaveIfMissing is encountered, the value will only be saved if the corresponding file does not already exist on disk.
Attributes:
| Name | Type | Description |
|---|---|---|
value |
The value to be saved if no file exists. |
Example
Source code in capturegraph-lib/capturegraph/data/save/markers.py
__init__(value)
#
Create a SaveIfMissing marker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
The value to be saved. Must have a registered saver or a to_json() method. |
required |