Skip to content

Build examples

source module isofit.data.build_examples

Builds the examples from their template files for a given ISOFIT ini

Classes

  • Example Parameters


    name : str Name of the directory of the example in the examples directory requires : list Required downloads to validate validate : dict, default={} Additional kew-word arguments to pass to the env.validate() function

  • IsofitExample Template for building scripts that directly call the Isofit object

  • ApplyOEExample Template for building scripts that use apply_oe

Functions

  • update Recursively updates string values with .format. This operation occurs in-place.

  • updateTemplate Updates a given template and writes it out to another file

  • createScript Creates an executable script file for a given template and arguments

  • build Builds an example directory

  • cli Builds the ISOFIT examples

source class Example(name, requires, validate={})

Parameters#

name : str Name of the directory of the example in the examples directory requires : list Required downloads to validate validate : dict, default={} Additional kew-word arguments to pass to the env.validate() function

Methods

  • validate Passthrough method to validate required ISOFIT downloads

  • setPath Sets the working path for the example

  • build

  • makeConfigs Creates configs based off the template files from an example directory

source method Example.validate()

Passthrough method to validate required ISOFIT downloads

source method Example.setPath(path)

Sets the working path for the example

Parameters

  • path : pathlib.Path Base path to the directory in which the example is located

Returns

  • None | False Returns False if the example directory is not found

source method Example.build()

Raises

  • NotImplementedError

source method Example.makeConfigs()

Creates configs based off the template files from an example directory

source class IsofitExample(name, requires, validate={})

Bases : Example

Template for building scripts that directly call the Isofit object

Parameters#

name : str Name of the directory of the example in the examples directory requires : list Required downloads to validate validate : dict, default={} Additional kew-word arguments to pass to the env.validate() function

Methods

source method IsofitExample.build()

Makes a formatted bash script

Parameters

  • example : pathlib.Path Path to the example root

  • path : pathlib.Path Path to the subset of scripts to generate scripts for

source method IsofitExample.makeScripts(path)

source class ApplyOEExample(name, requires, validate={})

Bases : Example

Template for building scripts that use apply_oe

Parameters#

name : str Name of the directory of the example in the examples directory requires : list Required downloads to validate validate : dict, default={} Additional kew-word arguments to pass to the env.validate() function

Methods

source method ApplyOEExample.build()

source method ApplyOEExample.makeApplyOE(path)

Creates apply_oe scripts using 'args' template files

source update(obj, **flags)

Recursively updates string values with .format. This operation occurs in-place.

Parameters

  • obj : dict | list Object to iterate over each child value and attempt to format

source updateTemplate(template: str, output: str = None)

Updates a given template and writes it out to another file

Parameters

  • template : str Path to template file to load and update

  • output : str, default=None Path to write the updated template to

Returns

  • config : dict The updated template dictionary

source createScript(script: str, template: dict)

Creates an executable script file for a given template and arguments

Parameters

  • script : str Path to write the script to

  • template : dict Template being used (eg. Bash or Pyth)

source build(example, validate=True)

Builds an example directory

Parameters

  • example : pathlib.Path Path to the example root

  • validate : bool, default=True Validates the required extra downloads for each example. Disabling this will allow examples to build but does not guarantee they will work

source cli(example, no_validate)

Builds the ISOFIT examples