collaboration.snapshot module¶
Class representing a remote Snapshot |
|
Class representing a remote undo entry |
- class CollabSnapshot(handle: LP_BNCollaborationSnapshot)[source]¶
Bases:
object
Class representing a remote Snapshot
- Parameters:
handle (LP_BNCollaborationSnapshot) –
- create_undo_entry(parent: int | None, data: str) UndoEntry [source]¶
Create a new Undo Entry in this snapshot.
- download(progress: ~typing.Callable[[int, int], bool] = <function nop>) bytes [source]¶
Download the snapshot fields blob, compatible with KeyValueStore.
- download_analysis_cache(progress: ~typing.Callable[[int, int], bool] = <function nop>) bytes [source]¶
Download the analysis cache fields blob, compatible with KeyValueStore.
- download_snapshot_file(progress: ~typing.Callable[[int, int], bool] = <function nop>) bytes [source]¶
Download the contents of the file in the Snapshot.
- finalize()[source]¶
Mark a snapshot as Finalized, committing it to the Remote, preventing future updates, and allowing snapshots to be children of it.
- Raises:
RuntimeError if there was an error
- static get_for_local_snapshot(snapshot: Snapshot) CollabSnapshot | None [source]¶
Get the remote snapshot associated with a local snapshot (if it exists)
- Parameters:
snap – Local snapshot
snapshot (Snapshot) –
- Returns:
Remote snapshot if it exists, or None if not
- Raises:
RuntimeError – If there was an error
- Return type:
CollabSnapshot | None
- get_local_snapshot(bv: BinaryView) Snapshot | None [source]¶
Get the local snapshot associated with a remote snapshot (if it exists)
- Parameters:
bv (BinaryView) – BinaryView with database to search
- Returns:
Local snapshot, if one exists. Else, None
- Raises:
RuntimeError if there was an error
- Return type:
Snapshot | None
- get_undo_entry_by_id(id: int) UndoEntry | None [source]¶
Get a specific Undo Entry in the Snapshot by its id
Note
If undo entries have not been pulled, they will be pulled upon calling this.
- pull_undo_entries(progress: ~typing.Callable[[int, int], bool] = <function nop>)[source]¶
Pull the list of Undo Entries from the Remote.
- property author_username: str¶
Get the username of the author of a snapshot, if possible (vs author which is user id)
- Returns:
Snapshot author username
- property child_ids: List[str]¶
List of ids of all remote child Snapshots
- Returns:
List of id strings
- Raises:
RuntimeError if there was an error
- property children: List[CollabSnapshot]¶
List of all child Snapshot objects
- Returns:
List of Snapshot objects
- Raises:
RuntimeError if there was an error
- property description: str¶
Get the description of a snapshot: the lines of its name after the first line
- Returns:
Snapshot description as described
- property file: RemoteFile¶
Owning File
- Returns:
File object
- property has_pulled_undo_entires: bool¶
If the snapshot has pulled undo entries yet
- Returns:
True if they have been pulled
- property hash: str¶
Hash of snapshot data (analysis and markup, etc) No specific hash algorithm is guaranteed
- Returns:
Hash string
- property is_finalized: bool¶
If the snapshot has been finalized on the server and is no longer editable
- Returns:
True if finalized
- property last_modified: datetime¶
Date of last modification to the snapshot
- Returns:
Last modified date
- property parent_ids: List[str]¶
List of ids of all remote parent Snapshots
- Returns:
List of id strings
- Raises:
RuntimeError if there was an error
- property parents: List[CollabSnapshot]¶
List of all parent Snapshot objects
- Returns:
List of Snapshot objects
- Raises:
RuntimeError if there was an error
- property project: RemoteProject¶
Owning Project
- Returns:
Project object
- property snapshot_file_hash: str¶
Hash of file contents in snapshot No specific hash algorithm is guaranteed
- Returns:
Hash string
- property title: str¶
Get the title of a snapshot: the first line of its name
- Returns:
Snapshot title as described
- class UndoEntry(handle: LP_BNCollaborationUndoEntry)[source]¶
Bases:
object
Class representing a remote undo entry
- Parameters:
handle (LP_BNCollaborationUndoEntry) –
- property file: RemoteFile¶
Owning File
- Returns:
File object
- property parent: UndoEntry | None¶
Parent Undo Entry object
- Returns:
Undo Entry object, if there is one, None otherwise
- property parent_id: int | None¶
Id of parent undo entry
- Returns:
Parent id number, if there is one, None otherwise
- property project: RemoteProject¶
Owning Project
- Returns:
Project object
- property snapshot: CollabSnapshot¶
Owning Snapshot
- Returns:
Snapshot object