Warning

This documentation is for an old version of IPython. You can find docs for newer versions here.

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.fileio.FileManagerMixin, IPython.html.services.contents.manager.ContentsManager

delete_file(path)

Delete file at path.

dir_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.

exists(path)

Returns True if the path exists, else returns False.

API-style wrapper for os.path.exists

Parameters:

path : string

The API path to the file (with ‘/’ as separator)

Returns:

exists : bool

Whether the target exists.

file_exists(path)

Returns True if the file exists, else returns False.

API-style wrapper for os.path.isfile

Parameters:

path : string

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

Returns:

exists : bool

Whether the file exists.

get(path, content=True, type=None, format=None)

Takes a path for an entity and returns its model

Parameters:

path : str

the API path that describes the relative path for the target

content : bool

Whether to include the contents in the reply

type : str, optional

The requested type - ‘file’, ‘notebook’, or ‘directory’. Will raise HTTPError 400 if the content doesn’t match.

format : str, optional

The requested format for file contents. ‘text’ or ‘base64’. Ignored if this returns a notebook or directory model.

Returns:

model : dict

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

get_kernel_path(path, model=None)

Return the initial API path of a kernel associated with a given notebook

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:

hidden : bool

Whether the path exists and is hidden.

rename_file(old_path, new_path)

Rename a file.

run_post_save_hook(model, os_path)

Run the post-save hook if defined, and log errors

save(model, path='')

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