A collection of Placeholder variables.

Methods

Public methods


Method new()

Initialize Placeholder class

Usage

Placeholder$new(schema = NULL, name = NULL, type = NULL, parent = NULL)

Arguments

schema

(dict, optional): Schema for the placeholder collection. (default: None) Example below:: list( 'ModelName'=str, 'JobName'=str, 'Hyperparameters'= list( 'tol'=float) ) Keyword Args:

name

(str, optional): Name of the placeholder variable. (default: None)

type

(type, optional): Type of the placeholder variable. (default: None)

parent

(Placeholder, optional): Parent variable for a placeholder variable. (default: None)


Method get()

Create a placeholder variable with an associated type.

Usage

Placeholder$get(name, type)

Arguments

name

(str): Name of the placeholder variable.

type

(type): Type of the placeholder variable.

Returns

Placeholder: Placeholder variable.


Method get_schema_as_list()

Generate a schema for the placeholder collection as a R named list.

Usage

Placeholder$get_schema_as_list()

Returns

list: Placeholder collection schema.


Method get_schema_as_json()

Generate a schema for the placeholder collection as a JSON formatted string.

Usage

Placeholder$get_schema_as_json(pretty = FALSE)

Arguments

pretty

(bool, optional): Boolean flag set to `True` if JSON string should be prettified. `False`, otherwise. (default: False)

Returns

str: JSON formatted string representation of the block.


Method contains()

Check if the placeholder collection contains the specified placeholder variable.

Usage

Placeholder$contains(placeholder)

Arguments

placeholder

(Placeholder): Placeholder variable to search for, in the collection.

Returns

bool: `True` if placeholder variable was found in the collection. `False`, otherwise.


Method validate()

Validate a specified input against the placeholder collection schema.

Usage

Placeholder$validate(input = NULL)

Arguments

input

(dict): Input to validate against the placeholder collection schema.

Returns

ValidationResult: Named tuple with the keys:

  • `valid` (Boolean): Representing the result of validation

  • `keys_missing` (list(str)): List of keys missing in the input

  • `keys_type_mismatch` (list(str), type, type): List of tuples with key name, expected type, and provided type.


Method to_jsonpath()

Returns a JSON path representation of the placeholder variable to be used for step parameters.

Usage

Placeholder$to_jsonpath()

Returns

str: JSON path representation of the placeholder variable


Method clone()

The objects of this class are cloneable with this method.

Usage

Placeholder$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.