FolderMixin

class pydelfini.collections.FolderMixin(collection, full_path, core)[source]

Bases: ABC

Folder interaction methods as a mixin class.

This class is used by DelfiniCollection and DelfiniFolder.

Attributes

id

path

Parameters:
__getitem__(item_path)[source]

Retrieve an item in this folder.

Relative paths are supported, such as folder_a/folder_b/item_c.

Parameters:

item_path (str)

Return type:

DelfiniItem

__iter__()[source]

Iterate over all items in this folder.

Return type:

Iterator[DelfiniItem]

folder(folder_name)[source]

Open the named folder.

Parameters:

folder_name (str) – the name of the folder to open

Return type:

DelfiniFolder

get_table(item_path)[source]

Retrieve the tabular contents of an item as a pd.DataFrame.

Parameters:

item_path (str) – The path to the item relative to the current folder. Accepts slashes (‘/’) for items in subfolders.

Return type:

DataFrame

new_empty_file(file_name)[source]

Create a new, empty file.

Parameters:

file_name (str) – the name of the file to create

Return type:

DelfiniItem

new_folder(folder_name)[source]

Create a new folder.

Parameters:

folder_name (str) – the name of the folder to create

Return type:

DelfiniFolder

Create a new link pointing to a target.

Parameters:
  • target (str) – the full URL of the target

  • link_name (str) – the name of the newly created link. If not provided, the base name of the target will be used.

Return type:

DelfiniItem

walk()[source]

Iterate over all items in this folder, and all subfolders.

Return type:

Iterator[DelfiniItem]

write_table(item_path, dataframe, format='csv', overwrite=False, **kwargs)[source]

Write a pd.DataFrame to the named item.

Parameters:
Return type:

None