How to use the s3contents.ipycompat.ContentsManager function in s3contents

To help you get started, we’ve selected a few s3contents examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github danielfrg / s3contents / s3contents / genericmanager.py View on Github external
from s3contents.genericfs import GenericFSError, NoSuchFile
from s3contents.ipycompat import (
    ContentsManager,
    GenericFileCheckpoints,
    HasTraits,
    Unicode,
    from_dict,
    reads,
)


DUMMY_CREATED_DATE = datetime.datetime.fromtimestamp(86400)
NBFORMAT_VERSION = 4


class GenericContentsManager(ContentsManager, HasTraits):

    # This makes the checkpoints get saved on this directory
    root_dir = Unicode("./", config=True)

    def __init__(self, *args, **kwargs):
        super(GenericContentsManager, self).__init__(*args, **kwargs)
        self._fs = None

    def get_fs(self):
        return self._fs

    fs = property(get_fs)

    def _checkpoints_class_default(self):
        return GenericFileCheckpoints