matflow.InputFile#

class matflow.InputFile(file, path=None, contents=None, extension='', store_contents=True)#

Bases: InputFile

An input file.

Parameters:
  • file (Union[app.FileSpec, str]) – What file is this?

  • path (Path) – Where is the (original) file?

  • contents (str) – What is the contents of the file (if already known)?

  • extension (str) – What is the extension of the file?

  • store_contents (bool) – Are the file’s contents to be cached in the workflow persistent store?

Methods

from_json_like

Make an instance of this class from JSON (or YAML) data.

make_persistent

Save to a persistent workflow.

read_contents

Get the actual contents of the file.

to_dict

Serialize this object as a dictionary.

to_json_like

Serialize this object as an object structure that can be trivially converted to JSON.

Attributes

app

contents

The contents of the file.

extension

The extension of the file.

normalised_files_path

Standard name for the file within the workflow.

normalised_path

Full workflow value path to the file.

path

The path to the file.

store_contents

Whether the file's contents are stored in the workflow's persistent store.

workflow

The owning workflow.

file

What file is this?

app = App(name='MatFlow', version='0.3.0a131')#
property contents#

The contents of the file.

property extension#

The extension of the file.

file#

What file is this?

classmethod from_json_like(json_like, shared_data=None)#

Make an instance of this class from JSON (or YAML) data.

Parameters:
  • json_like (Union[Dict, List]) – The data to deserialise.

  • shared_data (Optional[Dict[str, ObjectList]]) – Shared context data.

Return type:

The deserialised object.

make_persistent(workflow, source)#

Save to a persistent workflow.

Returns:

  • String is the data path for this task input and integer list

  • contains the indices of the parameter data Zarr groups where the data is

  • stored.

Parameters:
Return type:

Tuple[str, List[int], bool]

property normalised_files_path#

Standard name for the file within the workflow.

property normalised_path#

Full workflow value path to the file.

Note

This is not the same as the path in the filesystem.

property path#

The path to the file.

read_contents()#

Get the actual contents of the file.

property store_contents#

Whether the file’s contents are stored in the workflow’s persistent store.

to_dict()#

Serialize this object as a dictionary.

to_json_like(dct=None, shared_data=None, exclude=None, path=None)#

Serialize this object as an object structure that can be trivially converted to JSON. Note that YAML can also be produced from the result of this method; it just requires a different final serialization step.

property workflow: Workflow#

The owning workflow.