LazyLoadSession

class compas_session.lazyload.LazyLoadSession(*, name=None, basedir=None, scene=None, settings=None, depth=None, delete_existing=False)

Bases: object

Class representing a data session that can be identified by its name.

The class is implemented such that each named instance is a singleton. This means that during the lifetime of a program only one instance with a specific can exist, and that all sessions created with the same name, refer to the same session object instance.

Parameters:
namestr

The name of the unique object instance.

basedirstr or Path-like, optional

A “working” directory that serves as the root for storing (temporary) session data.

Raises:
SessionError

If no name is provided.

Methods

clear_history

Clear session history.

create_dirs

Create all directories.

delete_dirs

Remove all directories.

dump

Dump the data of the current session into a session directory.

dump_history

Dump the session history.

dump_scene

Dump the current scene to the corresponding session file.

dump_settings

Dump the current settings to the corresponding session file.

dump_tolerance

Dump the current tolerance setting to the corresponding session file.

get

Return the value for key if key is in the session, else return default or None.

load_history

Load the session history.

load_scene

Load the scene from the corresponding session file, if it exists.

load_settings

Load the settings from the corresponding session file, if it exists.

load_tolerance

Load the tolerance from the corresponding session file, if it exists.

record

Record the current state of the session into session history.

redo

Move one step forward in recorded session history.

set

Insert key in the session, and assign value to it.

setdefault

Return the value of key in the session.

undo

Move one step backward in recorded session history.