Script Loader#

wellies.scripts.ScriptLoader(subdir='scripts') #

Load scripts/snippets from package resources (default: wellies/scripts).

The main method load takes a script name and returns a pyflow.Script.

Source code in wellies/scripts.py
def __init__(self, subdir: str = "scripts"):
    self.subdir = subdir

Methods:#

load(script_name) #

Load a script from the wellies/scripts directory.

Parameters:
  • script_name (str) –

    The name of the script to load.

Returns:
  • Script –

    The contents of the script as a pyflow.Script object.

Source code in wellies/scripts.py
def load(self, script_name: str) -> pyflow.Script:
    """
    Load a script from the wellies/scripts directory.

    Parameters
    ----------
    script_name : str
        The name of the script to load.

    Returns
    -------
    pyflow.Script
        The contents of the script as a pyflow.Script object.
    """
    resource = files("wellies")
    for part in self.subdir.split("/"):
        resource = resource.joinpath(part)
    return pyflow.Script(
        resource.joinpath(script_name).read_text().splitlines()
    )

Mars Request#

wellies.mars.Request(requests, command='mars') #

Bases: Script

Source code in wellies/mars.py
def __init__(self, requests, command="mars"):
    req = []
    if isinstance(requests, list):
        for request in requests:
            req.append(_process_request(request))
    elif isinstance(requests, tuple):
        req.append(_process_request(requests))
    req_str = "\n".join(req)
    script = f"\n{command} << EOF\n{req_str}\nEOF\n"
    super().__init__(script)