IPython Documentation

Table Of Contents

Previous topic

Module: html.services.clusters.handlers

Next topic

Module: html.services.contents.handlers

This Page

Note

This documentation is for a development version of IPython. There may be significant differences from the latest stable release.

Module: html.services.contents.filemanager

A contents manager that uses the local file system for storage.

1 Class

class IPython.html.services.contents.filemanager.FileContentsManager(**kwargs)

Bases: IPython.html.services.contents.manager.ContentsManager

create_checkpoint(name, path='')

Create a checkpoint from the current state of a file

delete(name, path='')

Delete file by name and path.

delete_checkpoint(checkpoint_id, name, path='')

delete a file’s checkpoint

exists(name=None, path='')

Returns True if the path [and name] exists, else returns False.

API-style wrapper for os.path.exists

Parameters:

name : string

The name of the file you are checking.

path : string

The relative path to the file’s directory (with ‘/’ as separator)

Returns:

exists : bool

Whether the target exists.

file_exists(name, path='')

Returns True if the file exists, else returns False.

API-style wrapper for os.path.isfile

Parameters:

name : string

The name of the file you are checking.

path : string

The relative path to the file’s directory (with ‘/’ as separator)

Returns:

exists : bool

Whether the file exists.

get_checkpoint_model(checkpoint_id, name, path='')

construct the info dict for a given checkpoint

get_checkpoint_path(checkpoint_id, name, path='')

find the path to a checkpoint

get_kernel_path(name, path='', model=None)

Return the initial working dir a kernel associated with a given notebook

get_model(name, path='', content=True)

Takes a path and name for an entity and returns its model

Parameters:

name : str

the name of the target

path : str

the API path that describes the relative path for the target

Returns:

model : dict

the contents model. If content=True, returns the contents of the file or directory as well.

is_hidden(path)

Does the API style path correspond to a hidden directory or file?

Parameters:

path : string

The path to check. This is an API path (/ separated, relative to root_dir).

Returns:

exists : bool

Whether the path is hidden.

list_checkpoints(name, path='')

list the checkpoints for a given file

This contents manager currently only supports one checkpoint per file.

path_exists(path)

Does the API-style path refer to an extant directory?

API-style wrapper for os.path.isdir

Parameters:

path : string

The path to check. This is an API path (/ separated, relative to root_dir).

Returns:

exists : bool

Whether the path is indeed a directory.

rename(old_name, old_path, new_name, new_path)

Rename a file.

restore_checkpoint(checkpoint_id, name, path='')

restore a file to a checkpointed state

save(model, name='', path='')

Save the file model and return the model with no content.

update(model, name, path='')

Update the file’s path and/or name

For use in PATCH requests, to enable renaming a file without re-uploading its contents. Only used for renaming at the moment.